What it is
A small chat assistant for questions about the Cloudflare developer platform, built on Cloudflare end to end. I built it in a day.
How it works
BrowserCloudflare Pages
WebSocket
WorkerrouteAgentRequest
ChatAgent Durable Objectconversation state in SQLite
Workers AIllama-3.3-70b-instruct-fp8-fast, streamed
Tokens are broadcast back to the browser over the same WebSocket as they arrive.
- Worker. Routes WebSocket upgrades to the agent. It also has a plain
POST /api/chatfallback that calls the agent over RPC. - Durable Object. One
ChatAgentper session holds the message history. I chose it over KV or D1 because each new message has to see the previous one, and a Durable Object gives read-after-write consistency without fetching the whole history on every request. - Streaming. The agent reads the Workers AI server-sent events, sends each token to the browser as it arrives, then saves the full reply to state.
- Front end. One static page on Cloudflare Pages that renders replies as Markdown.
Stack
TypeScript, Cloudflare Workers, Durable Objects (SQLite), Agents SDK, Workers AI, Cloudflare Pages, Wrangler.