Cloudflare's Agents SDK now hosts pi-durable first party. agents/harness/pi shipped in agents@0.26.0 (cloudflare/agents#2424, #2451, #2452) alongside agents/models/pi-ai (#2446). It is beta. PiHarness opens Pi over the object's SQLite and plugs Pi's sessions into the Durable Object lifecycle (added in 0.22), which wakes sessions that still have work after an eviction. Pi owns the transcript, inbox, generation, tool calls, retries and crash recovery. The SDK supplies storage and the wake.
The extension host builds on @cloudflare/think today, and that stays. We may one day move from Think to Pi, because Pi's recovery is per task and has a per-tool replay policy (replay: "safe") that Think lacks. If we do, do-runtime has to run PiHarness the way workerd does. These issues establish that without changing the host:
Open questions outside do-runtime, recorded here so they are not lost:
- Model provider. Pi needs a pi-ai
Provider. agents/models/pi-ai targets Workers AI and AI Gateway, so a browser host needs its own provider over its model client. See the rfc-harness-model-provider-boundary design in cloudflare/agents.
- Synchronization. Pi replaces Think, not the Agents SDK. State synchronization, callables and the client protocol stay where they are, and Pi's
events() stream would need folding into the host's UI.
- Released transcripts. A move needs a Think-to-Pi transcript migration, which is the host's problem, not this repository's.
The source was read at Pi v1.0.0 and agents@0.26.0. No code has been run yet.
Cloudflare's Agents SDK now hosts pi-durable first party.
agents/harness/pishipped inagents@0.26.0(cloudflare/agents#2424, #2451, #2452) alongsideagents/models/pi-ai(#2446). It is beta.PiHarnessopens Pi over the object's SQLite and plugs Pi's sessions into the Durable Object lifecycle (added in 0.22), which wakes sessions that still have work after an eviction. Pi owns the transcript, inbox, generation, tool calls, retries and crash recovery. The SDK supplies storage and the wake.The extension host builds on
@cloudflare/thinktoday, and that stays. We may one day move from Think to Pi, because Pi's recovery is per task and has a per-tool replay policy (replay: "safe") that Think lacks. If we do, do-runtime has to runPiHarnessthe way workerd does. These issues establish that without changing the host:Open questions outside do-runtime, recorded here so they are not lost:
Provider.agents/models/pi-aitargets Workers AI and AI Gateway, so a browser host needs its own provider over its model client. See therfc-harness-model-provider-boundarydesign in cloudflare/agents.events()stream would need folding into the host's UI.The source was read at Pi v1.0.0 and
agents@0.26.0. No code has been run yet.