Skip to content

Architecture

System Execution Architecture
Single-Tenant Cloudflare Perimeter
Stage 01 Entry Surfaces
Web Dashboard /app/

React 19 single-page app with task launcher, live diff review, and run inspector.

Slack ChatOps @AI Intern

Interactive Block Kit approval cards and thread execution updates.

GitHub Webhook HMAC SHA-256

Signature-verified push and issue acknowledgment endpoint.

Transport: Agent SDK RPC & WebSockets
Stage 02 Edge Orchestrator
CodingOrchestrator DO Think + Durable Object

Analyzes issue context, synthesizes multi-step delegation plan using Workers AI.

Human Approval Gate needsApproval: true

Synchronous human sign-off required. No container boots and no code runs without approval.

Retained Run Registry /api/runs

Persistent run state, task parameters, duration tracking, and status timestamps.

Approved Delegation: Spin Up Ephemeral Container
Stage 03 Isolated Sandbox
OpenCodeAgent AIChatAgent DO

Structured task envelope managing lifecycle phases: Clone → Configure → Code → Collect.

Cloudflare Sandbox gVisor MicroVM

Ephemeral container (standard-1 to standard-4). Full Linux isolation with Git and Node.

Multi-Harness Runtime OpenCode / Claude / Codex

Executes code changes, writes regression tests, and validates with test runner.

Egress Proxy: Real Provider Keys Swapped at Boundary
Stage 04 Egress & Output
Cloudflare AI Gateway BYOK Credentials

Container uses dummy API key; egress gateway injects stored secret securely.

Diff Collector Git Intent-to-Add

Captures unified diffs and changed files; packages clean commit envelope.

GitHub Pull Request REST Publication

Opens ready-to-merge PR with summary and links results back to Slack thread.

The parent uses Workers AI for planning. Real model-provider and GitHub credentials are not supplied to the container by this implementation. Provider traffic is intercepted at Sandbox egress; there is no public /api/provider/google route. The callback’s authentication remains incomplete; the diagram is not a validated production security boundary.

Path Responsibility
src/index.ts Assets, SDK routes, run API, provider forwarding, webhook
src/agents/orchestrator.ts Planning, approval, delegation, retained registry
src/agents/opencode-agent.ts Sandbox SDK operations, progress and publishing
src/runtime.ts Clone, OpenCode execution, bounded file/diff collection
src/provider-gateway.ts Server-side provider forwarding
src/github.ts GitHub REST publication
src/runs.ts and src/transcript.ts State and transcript helpers
client/main.tsx and client/app.tsx Mounted dashboard
docs/ and scripts/ Static documentation and build checks

No D1, KV, Queues, R2, Postgres, Redis, or separate frontend service is required. State resides in Agents/Sandbox Durable Objects.

The runtime emits clone/configure/code/collect phases but awaits OpenCode execution; it does not stream every JSON event. The registry stores metadata and summary/error, not separate diff/file fields.

The specification requires Sandbox HTTPS interception, private Git transport credentials, and retained-registry gating of child routes. The present Worker proxy and direct SDK routing do not provide those guarantees. See Readiness.

The computer adapter is a guarded refusal, not an implemented runtime. The intended fit of @cloudflare/computer includes persistent SQLite-backed VFS, typed Git operations, agent tools, and Worker-shell/container backends. It is not installed here. Verify current APIs and preview status in the package documentation before implementing it. The code retains the preview-only warning and defaults to Sandbox.

celld is not a deployment target: Workers-compatible execution alone does not provide the managed Sandbox/Containers bindings this repository uses.

Official sources: Agents, Sandbox, Containers, AI Gateway.