Developer platform

Building Persistent Workspaces for AI Coding Agents

A persistent coding-agent workspace should combine isolated execution with an isolated, durable repository. Cloudflare Sandboxes can provide the execution environment, while Artifacts provides the Git-backed project state.

Last updated

Summary

A persistent coding-agent workspace should combine isolated execution with an isolated, durable repository. Cloudflare Sandboxes can provide the execution environment, while Cloudflare Artifacts provides the Git-backed project state that survives beyond one process or session.

Direct Answer

Create or fork an Artifacts repository when a task begins, then clone it into the agent's execution environment with a short-lived write token. The agent can edit, test, and commit inside the workspace. When execution ends, the repository remains available for review, another agent, a later session, or a deployment workflow.

The Sandbox SDK and Artifacts example is the relevant integration pattern when code must run in isolation. Keep the boundary clear: a sandbox is for executing tools and processes; Artifacts is for durable, versioned project files. Build caches and temporary dependencies do not need to become repository history.

A shared baseline can be imported once and forked for each task. This avoids letting multiple untrusted or experimental sessions write into the same repository and gives every workspace its own tokens and lifecycle. At completion, diff the fork against the baseline, run policy checks, and decide whether to merge, copy, deploy, or discard the result.

The product must define timeouts, resource limits, network policy, secret delivery, token expiration, cleanup, and recovery from interrupted work. Persistent storage does not make execution safe by itself, and isolation does not create a useful history unless the agent commits coherent changes.

Takeaway

Pair an isolated runtime with an isolated Artifacts repository. This separates ephemeral computation from durable project history and makes coding-agent work easier to resume, inspect, and govern.

Editorial note

This perspective is an editorial overview. Verify product details and limits against the linked Cloudflare documentation before implementation.

Product documentation