The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | # Cloudflare: Agents SDK |
| 2 | |
| 3 | Deploys an app built on Cloudflare's [Agents SDK](https://developers.cloudflare.com/agents/) |
| 4 | with `Cloudflare.Website.Vite`. `vite.config.ts` is the Agents starter's, |
| 5 | unchanged: `agents()` compiles the `@callable()` decorators. |
| 6 | |
| 7 | `src/server.ts` defines two agents, each a Durable Object declared in |
| 8 | `alchemy.run.ts`: |
| 9 | |
| 10 | - `Counter`, a stateful `Agent`. Its state syncs to connected clients, |
| 11 | `@callable()` methods run over its WebSocket, `schedule()` calls it back |
| 12 | later, and `onRequest` answers plain HTTP. `routeAgentRequest` serves it at |
| 13 | `/agents/counter/:name`, through the binding named after the class. |
| 14 | - `Calculator`, an `McpAgent` MCP server with an `add` tool, served at `/mcp` |
| 15 | through the `MCP_OBJECT` binding `McpAgent.serve()` expects. |
| 16 | |
| 17 | `src/client.tsx` is a React client that connects with `useAgent`. |
| 18 | |
| 19 | ## Deploy |
| 20 | |
| 21 | ```sh |
| 22 | bun run deploy |
| 23 | ``` |
| 24 | |
| 25 | ## Develop |
| 26 | |
| 27 | ```sh |
| 28 | bun run dev |
| 29 | ``` |
| 30 | |
| 31 | ## Destroy |
| 32 | |
| 33 | ```sh |
| 34 | bun run destroy |
| 35 | ``` |