feat(agents): add durable pi harness capability - #2197
Closed
mattzcarey wants to merge 1 commit into
Closed
Conversation
🦋 Changeset detectedLatest commit: 3d13af6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
mattzcarey
changed the base branch from
main
to
feat/move-sessions-into-a-capability
September 2, 2026 09:52
This was referenced Sep 2, 2026
Contributor
Author
|
Superseded by #2210, which scopes this to an example. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PiHarnessfromagents/harnessAgentHarnessin a Lifecycle Durable Object using namespaced DO SQLite tablescreateWorkersAIfromagents/providers/pi; Kimi K2.7 Code is the default modelIntended API
prompt(),getMessages(),findEntries(), andgetResult()follow pi's public vocabulary.submit()is intentionally host-specific: it records the recovery wake before pi lane admission.Why Lifecycle rather than Tasks
Pi already owns the durable operation state machine, including provider intent, tool intent and settlement, retries, cancellation, and recovery. Wrapping it in
Taskswould introduce a second replay authority for the same effects. Lifecycle supplies storage and durable wake delivery only.Temporary upstream pin
The completed durable harness is currently available on pi's
devbranch but not in its npm release. This PR pinsearendil-works/pi@c4b0e35abe631bc830190fa6cafbe81b098b97d7as checked-in, checksummed build inputs. The publishedagentstarball contains the bundled runtime and licenses, but excludes those archives. We can replace this with normal released dependencies once upstream publishes the completed harness.Demo
https://pi-harness-playground.mattzcarey.workers.dev
The deployed example uses
@cf/moonshotai/kimi-k2.7-code. Production smoke tests exercised calculator tool calls and durable memory across turns.Verification
pnpm install --frozen-lockfilepnpm run check(all 122 TypeScript projects)pnpm exec nx affected -t test --base=origin/main --head=HEAD(24 affected projects)node:imports, andcreateRequireReview focus
This is a draft so we can iterate together. The decisions most worth reviewing are:
PiHarnessAPI and pi-aligned method namesagents/providers/pias the provider boundarysubmit()contractprompt()andgetMessages()