Source:
cloudflare-agents
— requires 0.0.1-beta.2 or later.@cognition-ai/sdk; useAgentChat
streams Devin’s typed events — text, reasoning, tool calls, plans, permission prompts, pull
requests — into the browser, and the chat, its transcript and its Devin session survive refreshes,
hibernation and deploys in Durable Object storage. The console is laid out like
harness chat: chats on the left, the transcript in the middle, and on
the right a Session panel (status, activity, cost, a link to the session in the Devin app) and
a Workspace panel (Devin’s plan, its pull requests, and the files it touched).
Unlike harness chat, nothing runs in a sandbox you own: Devin works in its own cloud VM, and the
Worker only holds the API key and relays events. That is also why this example can continue a
session you started in the Devin app.

The console: Devin's reasoning, file writes and a test run as typed cards; the Session panel with the cloud session's status; the Workspace panel with the files it touched
How it fits together
Workspace extends Agent(src/server.ts) is the sidebar:createChat,deleteChatandrecentSessionsare@callable()methods, the chat list lives in SQLite and is broadcast as Agent state, andonBeforeSubAgentonly lets clients reach chats this workspace created.DevinChat extends DevinChatAgentis one chat, a facet of the workspace.@cognition-ai/cloudflare-agentsdoes all of the Devin work — session create and attach, one turn per message, stop, permissions as tool approvals, start over, importing a session, recovery. The example addsonChatResponse(the chat’s sidebar entry),sessionSnapshot(what the cloud says about the session between turns) andrespondToPermission.src/console.tsxandsrc/components/are the React app: one chronologicalmessage.parts.map()per message, and a card per tool call rendered from the SDK’s normalizedToolCallDetail.
DEVIN_API_KEY secret only exists in the Worker. The browser talks to your Agents, never to
Devin.
The key pattern
The server is aDevinChatAgent plus whatever your app needs around it:
src/server.ts (excerpt)
src/console.tsx (excerpt)
What maps to what
Internal bookkeeping the cloud reports as tool calls is hidden, as in the Devin app. The full
mapping is in AI SDK UI.
Lifecycle
Nothing here stops a Devin session remotely; archive or end sessions in the Devin app or with
devin.api.
Run it
bun run test runs the Worker in workerd against a fake Devin ACP server; bun run deploy
publishes it (wrangler secret put DEVIN_API_KEY first).

