Skip to main content
@cognition-ai/harness-devin is a HarnessV1 adapter backed by @cognition-ai/sdk, which drives the Devin CLI over ACP. The adapter ships a bridge process that runs inside a sandbox and talks to the host over a WebSocket on a sandbox-proxied loopback port. This is Devin running inside a sandbox you own. To put a Devin cloud session behind useChat instead — no sandbox, Devin works in its own VM — use @cognition-ai/ai-sdk, or @cognition-ai/cloudflare-agents on Cloudflare Workers.

Setup

Install the adapter together with the AI SDK harness packages:
The @cognition-ai packages are in beta. Every release is a 0.0.1-beta.N prerelease on the beta dist-tag (currently 0.0.1-beta.7), so the @beta suffix is required: a bare npm install @cognition-ai/sdk fails on purpose. Pin the exact version in your lockfile, and keep every @cognition-ai package you use (sdk, ai-sdk, cloudflare-agents, harness-devin) on the same version; they release together. Each published version is stable, but the API can change between beta bumps; see the changelog for what moved.

Usage

The adapter requires a HarnessV1SandboxProvider whose handles expose at least one port for the bridge WebSocket (ports: [<port>], or createDevin({ port })). Use session.detach() to park the bridge and sandbox, session.stop() to save state and stop the sandbox, or session.destroy() to clean up without keeping resume state.

Known limitations

The adapter preserves live text streaming, but cannot faithfully apply ACP updates that replace or withdraw text already sent. The current HarnessV1 text events support starting a block, appending text, and ending it; they have no replacement or withdrawal event. If Devin revises earlier text, the streamed and assembled response can retain the old text or append the replacement beside it. For example, "draft" followed by a replacement of "final" can appear as "draftfinal". Ordinary append-only streaming is unaffected. This limitation applies to the harness adapter. The core SDK’s SessionEventReducer handles replacement and withdrawal updates; use @cognition-ai/sdk directly when those semantics are required. What the adapter reports while it sets up the sandbox and session is listed in Diagnostics; the harness-chat example is a complete Next.js app built on it.