Flue 2.0 snippets for Cloudflare
31 agents you can deploy today. Each one builds with Vite, deploys a real Worker, asserts, then deletes it.
31 snippets
- ai-gateway example Workers AI through a Cloudflare AI Gateway. Caching, observability, retries, for free. AI GatewayWorkers AI
- browser-rendering example Real Chromium at the edge. Agent opens a page, returns the title. Browser RenderingWorkers AI
- d1 example SQLite at the edge. INSERT a row, SELECT it back. D1
- durable-objects example Each path segment is its own DO instance. Two POSTs to the same path share state; different paths don't. Durable Objects
- effect-hello example The simplest Flue agent whose tool body is an Effect program. Workers AIEffect v4
- email-workers example Send a real email via Cloudflare Email Service from a Flue agent. Email ServiceWorkers AI
- hyperdrive example Flue agent queries Postgres through a Hyperdrive binding. Hyperdrive
- kv example Write a key, read it back. The simplest stateful CF binding, exposed to the model as a tool. KV
- queues example Agent enqueues a message. Producer-only hello world. Queues
- r2 example Write an object, read it back. The agent's filesystem at the edge. R2
- vectorize example Embed text via Workers AI, store + query in Vectorize. One upsert, one query, top match. VectorizeWorkers AI
- worker-loader example Run dynamic code in a child Worker isolate. AI-generated code, user uploads, sandboxed evals. Dynamic Workers
- workers-ai example The simplest Cloudflare Flue agent: call a model and return its answer. Workers AI
- ai-gateway recipe Route every Workers AI model turn through a named Cloudflare AI Gateway. AI GatewayWorkers AI
- braintrust-ai-gateway recipe Call a provider through the hosted Braintrust AI Gateway from a durable Flue agent tool. Braintrust AI GatewayWorkers AI
- braintrust-eval recipe Evaluate a deployed Flue 2 agent as a Braintrust experiment. Braintrust EvalsWorkers AI
- braintrust-otel recipe Export a Workers AI model-operation span to Braintrust through OpenTelemetry. BraintrustOpenTelemetryWorkers AI
- braintrust-trace recipe Trace a Workers AI model operation in Braintrust from a Flue 2 agent tool. BraintrustWorkers AI
- chat-thinking recipe Read model reasoning and final text as separate parts of one durable Flue conversation. Durable ObjectsWorkers AI
- computer-workspace recipe A durable agent filesystem with @cloudflare/computer, backed by the agent Durable Object SQLite. No container. @cloudflare/computerDurable ObjectsWorkers AI
- do-governor recipe Persist run state and change the next action when an agent loops. Durable ObjectsWorkers AI
- do-session recipe One durable conversation per user id, persisted across requests. Durable ObjectsWorkers AI
- dynamic-workflow recipe Runtime-selected tasks coordinated by one durable Flue agent instance. Durable Agentstool orchestration
- event-trigger recipe Authenticate webhooks at an explicit route, then route the normalized event with an agent tool. Workers AIsigned webhooksDurable Agents
- gateway-lab recipe AI Gateway observes model traffic while Lab records the completed work artifact. AI GatewayWorkers AIlab
- github-triage recipe Triage a GitHub issue with a validated tool result. Workers AIDurable Agentsvalibot
- lab-checkpoint recipe Durable cycle state creates receipts at meaningful checkpoints. Durable Agentslab
- lab-receipt recipe A prompt response and its Lab receipt are one tool result. Workers AIlab
- mcp-client recipe A Flue agent calls a tool from a co-hosted MCP server. MCPCloudflare Agents SDKWorkers AIDurable Objects
- virtual-sandbox recipe Seed an in-memory just-bash sandbox from R2 and inspect it with agent tools. R2Workers AIDurable Agentsjust-bash
- github-app template A forkable GitHub App on Cloudflare Workers, powered by Flue channels. Flue channelsWorkers AIDurable Objects@flue/github
No snippet matches that filter.
New here? Start with these
Four snippets, smallest to largest.
- 1 workers-ai The simplest Cloudflare Flue agent: call a model and return its answer.
- 2 do-session One durable conversation per user id, persisted across requests.
- 3 virtual-sandbox Seed an in-memory just-bash sandbox from R2 and inspect it with agent tools.
- 4 mcp-client A Flue agent calls a tool from a co-hosted MCP server.
FAQ
- Do these agents run on Cloudflare?
- Yes. Each test builds a Worker with Vite, deploys it with Wrangler, asserts against the live endpoint, then deletes the Worker. CI does the same. No mocks.
- How does the build and the deploy work?
- Vite builds each snippet. The flue() plugin finds each 'use agent' module and writes dist/<name>/wrangler.json with the bindings and Durable Object migrations. Then wrangler deploy --config ships it.
- Do I need any third-party API keys?
- No. The examples use Workers AI. You need no OpenAI or Anthropic key. Check your Cloudflare plan before you run the full matrix.
- Can I run one snippet only?
- Yes. Use bun ex:<name> for examples, bun rx:<name> for recipes, and bun tpl:<name> for templates.
- Where can Flue run?
- Flue runs where TypeScript runs. This repository targets Cloudflare Workers. Flue also builds for Node.js, GitHub Actions, GitLab CI, and Daytona. The agent code stays the same.