DEVOURED
We rewrote our agent to run entirely in a Durable Object with Pi, Agents SDK, and Code Mode
camelAI migrated its AI agent from expensive virtual machines to Cloudflare Durable Objects to reduce costs and latency.
What: The team moved agent execution into a single Cloudflare Durable Object, replacing bash-based automation with JavaScript and offloading storage to SQLite and R2.
Why it matters: This shift represents an architectural transition from 'server-per-user' models—which are prohibitively expensive at scale—to serverless, event-driven agent architectures.
Deep dive
- The migration eliminated the need for always-on virtual machines for every user.
- SQLite on Durable Objects provides a lightweight, persistent state store for agent memory.
- R2 is used for object storage, replacing local disk access.
- Moving from bash to JavaScript allows the agent to interact directly with runtime environments rather than shell commands.
Decoder
- Durable Object: A Cloudflare-specific serverless primitive that provides consistent, low-latency storage and execution for a specific instance of an application.
Original article
camelAI recently moved its agent off of virtual machines and onto a Cloudflare Durable Object. Its file system lives in SQLite and R2, and it writes JavaScript instead of bash. The team moved off VMs because giving every user an always-on machine with attached disk was too expensive to scale. This post explains how the team completed the migration. camelAI's codebase recently went open source.
Explore all 56 articles in today's digest
Fresh dev news, AI-digested daily. Never miss a trend at devoured.fyi