Skip to content

Chat: programmatic turns under a given id, the run checkpoint on a model call, a cancel reason (4.iii 6f, parity 10, draft) - #3342

Closed
mattzcarey wants to merge 1 commit into
slim/chat-fn-6f10from
slim/chat-fn-6f11
Closed

mattzcarey wants to merge 1 commit into
slim/chat-fn-6f10from
slim/chat-fn-6f11

Conversation

@mattzcarey

Copy link
Copy Markdown
Member

DRAFT, 4.iii 6f parity step 10, stacked on #3330. What R3-identity (agent-runs) needs from the chat core, items 1, 3 and 5 of its list:

  • submitTurn(…, { requestId, retain, metadata }) starts a programmatic turn under the id it's given, kept after it settles, with its metadata. The core's own metadata is under its chat key, so an agentTool key sits beside it.
  • ChatModelCall.checkpoint is the turn's run checkpoint, for state a turn's tools keep across a reset (an agent tool's progress and milestones). A set is one statement. A reader outside the run sees it with tasks.checkpointOf while the run is live; a settled run's checkpoints are gone, so what a parent reads after that is the result.
  • cancelTurn(deps, id, reason?) carries the caller's reason to the run.

Tests:

  • a turn under agent-tool:run-1 is retained with its metadata, and its progress is visible while it runs;
  • a cancel's reason is on the aborted run.

Both fail before.

Cost: none on the hot path.

@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 34e3dec

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@3342

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@3342

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@3342

hono-agents

npm i https://pkg.pr.new/hono-agents@3342

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@3342

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@3342

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@3342

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@3342

commit: 34e3dec

@agent-think

agent-think Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ agents import sizes: no significant changes (82fc0a7d → 34e3dec6, workflow run)

…all carries the run's checkpoint, cancelTurn takes a reason (agent-runs' R3 needs)
@mattzcarey

Copy link
Copy Markdown
Member Author

Closed to drain open PRs (COMMON, 27 Nov). This PR's commits are commits of #3361 (the switch), which now sits directly on #3298. The branch is kept.

@mattzcarey mattzcarey closed this Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant