Skip to main content
Back to timeline
CloudflareSource publication:

Agents SDK adds OpenCode 2.0: sessions live in SQLite, interrupted work resumes after eviction

Lead

From Agents SDK 0.28.0, an experimental OpenCodeHarness runs OpenCode 2.0 inside a plain Durable Object, with sessions stored in SQLite and Lifecycle jobs that wake interrupted work after eviction.

Source-provided article image: Changelog
Cloudflare

Story

The Agents SDK can now host OpenCode 2.0 through an experimental OpenCodeHarness, so the coding agent runs inside a plain Durable Object instead of a separate hosting arrangement. Previously the Agents SDK offered no such path, leaving OpenCode 2.0 to be placed by other means. The changelog states the runtime shape: OpenCode runs inside a plain Durable Object, sessions are stored in SQLite, and Lifecycle jobs wake interrupted work after eviction.

The integration mounts OpenCode as a harness on a Durable Object, keeps session state in SQLite, and lets Lifecycle jobs restart interrupted work. The agents/models/opencode provider connects OpenCode to Workers AI through the AI binding, while plugins extend the harness with custom tools, remote MCP servers, and skills. Installation requires Agents SDK 0.28.0 or later together with @opencode/sdk@2 and @opencode/plugin@2; the harness guide covers the workerTools plugin, Wrangler configuration, and session APIs.

What to watch

This change is aimed at developers deploying agents on Cloudflare: OpenCode 2.0 runs in a plain Durable Object through the experimental OpenCodeHarness, sessions are stored in SQLite, and Lifecycle jobs wake interrupted work after eviction. Adoption requires Agents SDK 0.28.0 or later plus @opencode/sdk@2 and @opencode/plugin@2. The harness guide covers the workerTools plugin, Wrangler configuration, and session APIs, and the working example adds a browser UI, WebSocket streaming, and persistent note tools.

OpenCodeHarness is labeled experimental, and the changelog gives no statement about stability or long-term support. Sessions in SQLite and Lifecycle jobs waking interrupted work are the runtime behavior the changelog describes, with no performance or scale figures attached.

Sources