Agents SDK adds OpenCode 2.0: sessions live in SQLite, and evicted work wakes itself up
Synopsis
Starting with Agents SDK 0.28.0, the experimental OpenCodeHarness supports OpenCode 2.0, letting OpenCode run inside a plain Durable Object with sessions stored in SQLite and Lifecycle jobs that wake interrupted work after eviction. Previously this session state and interruption recovery had to be arranged separately. The agents/models/opencode provider connects OpenCode to Workers AI through the AI binding, and plugins add custom tools, remote MCP servers, and skills.
Interpretation
Agents SDK now supports OpenCode 2.0 through the experimental OpenCodeHarness, so OpenCode can run inside a plain Durable Object with session data kept in SQLite. Previously, running OpenCode in Agents SDK did not come with this combination, and session storage and interruption recovery had to be handled separately. The support ships with Agents SDK 0.28.0 or later, installed alongside the agents, @opencode/sdk@2, and @opencode/plugin@2 packages.
Work interrupted by eviction is woken by Lifecycle jobs, so a session can continue beyond the object's lifetime. Without a Lifecycle, work interrupted after a Durable Object is evicted does not resume on its own. The usage is to create a harness and install a Lifecycle on the Durable Object.
The agents/models/opencode provider connects OpenCode to Workers AI through the AI binding, while OpenCode plugins extend the harness with custom tools, remote MCP servers, and skills. This connection and extension path comes with the harness rather than requiring a separate build. The OpenCode harness guide includes the workerTools plugin, Wrangler configuration, and session APIs, and the working example adds a browser UI, WebSocket streaming, and persistent note tools.
Perspective
The support targets developers building agents on Cloudflare Workers, used through Agents SDK 0.28.0 or later with @opencode/sdk@2 and @opencode/plugin@2, and OpenCodeHarness is explicitly labeled experimental. The 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 described as experimental, and the material does not state its stability or long-term support. Sessions stored in SQLite and Lifecycle waking interrupted work after eviction are capabilities the material states, without performance under load or at scale.
