Source linked

Flue Brings Durable Execution and $0.002 Code Runs to Agent Harnesses

blog.cloudflare.com@systems_wire1 hour ago·Artificial Intelligence·3 comments

Flue, an open-source framework from the Astro team, uses Cloudflare's Agents SDK to give agent harnesses durable execution, sandboxed code in under 10ms isolates, and a durable filesystem backed by SQLite.

fluecloudflareagents sdkdurable executionai agentsframeworks

Running LLM-generated code in a fresh Worker isolate costs $0.002 and starts in under 10ms. That single number makes container-based sandboxes for agent tool execution look like a relic.

Cloudflare just shipped Flue 1.0 Beta, an open-source agent framework from the team behind Astro. It sits on top of the Cloudflare Agents SDK and wraps the Pi harness. What Flue does differently: you don't script what your agent does, you describe what it knows. Define its model, skills, sandbox, and instructions, and it autonomously solves whatever task you give it. No orchestration loop to write.

Durable Streams Rescue Interrupted Agent Turns

Agent harnesses have a dirty secret: when a process crashes mid-turn, all in-memory state vanishes. The streaming connection, pending tool calls, the exact step where the agent was working - gone. Conversation history on disk doesn't fix the broken spinner the user sees.

Flue solves this with Durable Streams, an append-only log that records every prompt, tool response, and model choice as an immutable ledger. Each event in the execution history is persisted. If a process dies, another instance picks up the log and continues from the exact step it left off.

Under the hood, Flue targets Cloudflare's Durable Objects and uses the Agents SDK's runFiber() method for native checkpointing. runFiber() records progress to SQLite storage before work begins and checkpoints with stash() as the turn advances. When a fresh agent boots after an interruption, onFiberRecovered() delivers the last checkpoint. Your harness can decide how to resume - full reconstruction like Project Think or partial replay.

Code Mode Runs LLM-Generated Code in 10ms Isolates

Agent harnesses give models access to the outside world through tools. But tool surfaces grow fast, and models get worse at selecting the right tool as the list lengthens. Better pattern: give the model one tool that executes code. The model writes a TypeScript function, and the harness runs it.

Cloudflare's Agents SDK provides @cloudflare/codemode, wrapping Dynamic Workers. Each snippet gets its own Worker isolate with only the bindings you provide. Isolates start in under 10ms and cost $0.002 per load. Compare that to booting a container for every short code execution. Flue uses @cloudflare/codemode on its Cloudflare target to power its code tool - the agent writes JavaScript against the workspace and runs it with Code Mode.

Same philosophy applies to filesystem operations. Agents often need to read, write, edit, search through code. The usual answer is a container. But most filesystem operations are text. @cloudflare/shell gives your agent a durable virtual filesystem inside its Durable Object, backed by SQLite. Typed file operations - read, write, edit, search, grep, diff - run inside the isolate, avoiding container overhead entirely.

The Three-Layer Stack for Production AI

Flue's architecture maps cleanly to what Cloudflare calls the emerging three-layer stack for production-grade agents. At the top is the framework (Flue) - project structure, conventions, CLI, developer experience. Below that is the harness (Pi or Project Think) - the agentic loop that calls tools, reads results, manages context. At the bottom is the platform (Cloudflare Agents SDK) - compute, state, and storage primitives like durable execution, Dynamic Workers, and Durable Objects.

Flue agents run as long-lived processes on Node.js, deployable to any VM or container. But when you target Cloudflare, each agent becomes a Durable Object. Automatic scaling, isolated storage and compute, no server provisioning or sticky session management. Flue also integrates with @cloudflare/dynamic-workflows for multi-step pipelines that persist each step, retry failures, and sleep for hours waiting for human approval.

Bring Your Own Harness to the Agentic Cloud

Flue is the first framework to build on the Agents SDK, but Cloudflare designed the SDK so any harness or framework can leverage these primitives. Bindings give agents access to AI Gateway (per-agent spend tracking), Browser Run (web automation), Email Service, Agent Memory, AI Search, Containers, and inference across 14+ model providers. Credentials never enter agent-generated code.

If you are building your own agent harness or framework, target the Agents SDK and get durable execution, sandboxed code, and durable storage for free. Flue shows exactly how - its source code is open and demonstrates adapting the Pi harness to run on Workers. The days of fragile, stateless agent turns are running out.


Source: Bringing more agent harnesses and frameworks to Cloudflare, starting with Flue
Domain: blog.cloudflare.com

Read original source ->

External source stays available while the OJO article and comment thread stay local.

Comments load interactively on the live page.