Repository navigation
agents@0.35.0
·
11 commits
to main
since this release
This release moves @cloudflare/ai-chat and @cloudflare/think onto a shared durable chat engine, raises the SQLite row limit to 8 MB, and replaces AiSdkHarness with ThinkHarness (including Code Mode support). It also adds typed CDP browser automation, multi-instance Tasks, Sessions and Streams, OpenTelemetry tracing for Pi, and updates to the Pi and OpenCode harnesses.
Highlights
ThinkHarnessand Code Mode:ThinkHarness(agents/harness/think) replaces the removedAiSdkHarness(#3112) and runs turns on the same engine as Think (#3295). The newagents/harness/think/extensionsentry point addscodemode(),CodemodeSandbox, andsandboxExecutor(), giving the model a singlecodetool whose script calls your other tools and records each call as a step (#3294).ThinkHarnessalso accepts atracingoption for model and tool spans. Experimental.- Typed browser automation and tab observers:
CdpConnection.send()is now typed fromdevtools-protocol, with newon()andwaitFor()methods for CDP events (#3155).Browseradds ahostObserveroption that runs once for each tab a session opens, can subscribe to CDP events and append a notice for the model, and answers blocking page dialogs (#3058). See Browse the web. - 8 MB SQLite rows and paged reads:
agentsnow stores up to 8 MB in a single SQLite row (up from 2 MB), and pages event-log replay, Sessions search, andgetAgentToolChunks()at 16 MiB per call (#3100). Sessions loads long histories faster (a cold read of 50,000 messages reads about 40,000 rows instead of 260,000 to 390,000) and searches over large messages and long texts (#3056, #3075, #3084, #3124). See Sessions. - Multiple Tasks, Sessions, and Streams per object:
Tasks,Sessions, andagents/streamseach take an optionalname(such asnew Tasks({ name: "imports" })) and keep separate tables per instance; unnamed instances keep the existing tables (#3132, #3131, #3146). Experimental. See Tasks and Sessions. - Pi 1.8, Pi OpenTelemetry tracing, and OpenCode 2.4.3: The Pi harness moves to Pi
~1.8.0(#3846) and adds experimentalpiTracing()fromagents/observability/pito export pi-durable runs, model requests, and tool calls as OpenTelemetry GenAI spans to anotlpbinding (#3619).PiImagesCallOptionsaddsaspectRatio,size, andsessionId, andPiModelOptions.costaddsimageOutput. The OpenCode harness andagents/models/opencodeupdate to OpenCode 2.4.3 (#3509, #3595). See Pi harness. - Durable recovery across resets, workflows, and sub-agents: Work cut off by a reset now resumes within 5 seconds instead of 30 and recovers even when an alarm was dropped, and failing jobs stop retrying forever and reach
onJobError()(#3023).AgentWorkflowruns and stubs, workflow callbacks, the MCP RPC transport, andgetAgentByName()survive resets (#3052). Sub-agents no longer stall when many start at once, work under a jurisdiction (#3085), run jobs andgetSchedule(), and empty descendant storage ondeleteSubAgent(). See Lifecycle. - Agent-tool and tab reliability: Detached agent-tool runs accept
eventDelivery: "terminal"(#3955),AIChatAgenttool runs now survive child resets and cancel immediately, and connecting tabs receive at most 10,000 stored chunks of finished runs after the handshake so long runs no longer fail handshakes (#3548, #3955, #3960).useAgentandAgentClientwait up to 15 seconds for the handshake (was 4 seconds) and jitter their first reconnect between 1 and 5 seconds (#2988). - Stricter MCP URL checks: The MCP client now validates every request it sends—MCP messages, SSE streams, OAuth discovery and token calls, and redirects—and blocks URLs with embedded credentials,
.internalnames, carrier-grade NAT, reserved/multicast ranges, and IPv4-mapped, NAT64, or 6to4 private IPv6 addresses (localhostand loopback still work) (#3110). See MCP client. - Fixes and polish:
- Experimental
agents/tasksrenamesstatetostatus(error,aborted,pending, plusskipped) (#3010), throwsTaskInputConflictErrorwhen reusing an id or idempotency key with different input (#2986), aborts immediately oncancel(), and jitters retry backoff (#3114). - Experimental
agents/contextmovesfreezeSystemPrompt(),refreshSystemPrompt(), andreminder()fromContextBlocksto the new session-backedContextclass (#2773). - Size limits fail loudly: RPC results over the 32 MiB WebSocket frame limit return an error instead of dropping silently (#2991, #3050), and oversized SQL or state writes throw
SqlError. - Workers extending Think bundle without
just-bash; install it only to run Bash skill scripts (#3952). - Sessions no longer send raw history for compacted chats or fail with missing reasoning items on
web_search_call(#3090);Streams.list()breakscreated_atties by insertion order (#3062) and sub-agent event-log frames reach the sub-agent (#3018). ThinkandThinkHarnessrecover model streams that close without a finish signal (#3953);ThinkChatreaches sub-agent tabs; Channels adds an optionalChannelMessageSurface.key(experimental) and no longer answers twice after a reset.replyToEmail()no longer adds a secondRe:; AnthropiconResponseAbortErrorstops the pi-ai fallback chain;x402fixes payment caps, offer selection, and UTF-8 tokens and addsFacilitatorConfig.timeoutMs(#3538); Voice turns plain-object provider stream errors into the generic stream error on newer AI SDK 7 releases (#3912).- The already-deprecated
@cloudflare/shellpackage was removed from the repository (#2896); its last npm release (0.5.0) remains published and deprecated in favor of@cloudflare/computer.
- Experimental
Minor Changes
-
#3988
17862acThanks @mattzcarey! - New and changed APIs. See the docs.- Experimental
ThinkHarness(agents/harness/think) replacesAiSdkHarness, which is removed; it takesextensions(Code Mode) and atracingoption. - Experimental
agents/tasks:stateis nowstatus,failediserror,cancelledisaborted,waitingispending; stored runs migrate. - Tasks, Sessions and
agents/streamstake an optionalname, for more than one in an object. - Experimental
agents/context:freezeSystemPrompt,refreshSystemPromptandremindermove fromContextBlocksto the newContext. - Sessions:
addCompaction()throws on an anchor that can never apply, and a read from the root throws past 200,000 visible messages. - Browser:
CdpConnectionhason()andwaitFor(),send()is typed, andBrowsertakes ahostObserver. - One SQLite row holds up to 8 MB (was 2 MB);
ROW_MAX_BYTESandenforceRowSizeLimitare removed fromagents/chat(useROW_VALUE_BYTES). getAgentToolChunksanswers a page at a time: pass the lastafterSequenceuntil a call returns no chunks.- Agent tools:
eventDelivery: "terminal"works for detached runs, andThink.startAgentToolRuntakes asignal. - On connect a tab is sent at most 10,000 stored chunks of finished agent-tool runs, after the handshake; a longer run shows its status and summary.
- Experimental
agents/observability/pi:piTracing()records a Pi harness's runs as OpenTelemetry GenAI spans. - Pi harness: the peer ranges are
~1.8.0; the Pi session store migrates when it opens, so roll forward. - OpenCode harness: opencode 2.4.3; upgrade
@opencode/sdkand@opencode/pluginto 2.2.3 or later with it. useAgentandAgentClientwait up to 15 s for the handshake (was 4 s).- A Worker that extends Think bundles without
just-bash; install it only for Bash skill scripts.
- Experimental
-
#3988
17862acThanks @mattzcarey! - Upgradeagents,@cloudflare/ai-chatand@cloudflare/thinktogether. See Upgrading from ai-chat 0.12 and Upgrading Think from 0.24.@cloudflare/ai-chatand@cloudflare/thinkneedagents0.35.0 or later;agents/chatis internal and exports less.- An agent from the previous release migrates its storage in place at its first start; rolling back afterwards is not supported.
Patch Changes
-
#3988
17862acThanks @mattzcarey! - Fixes.- Work cut off by a reset resumes within seconds, a failing job stops retrying and reaches
onJobError, and jobs work in sub-agents. AgentWorkflowruns and stubs, the MCP RPC transport andgetAgentByNamesurvive an Agent reset.- Sub-agents: many started at once no longer stall, they work under a jurisdiction, and
deleteSubAgent()empties their storage. - Agent-tool runs cut off by a reset re-attach to their child and end once; a run whose child cannot stay up ends
error. - A tab joining a running reply gets live chunks and each request's end once, also after a stop or a reconnect.
- The MCP client refuses more private addresses,
.internalnames and URLs with credentials. - Voice: a provider's stream error sent as a plain object reaches a voice client as the generic stream error on newer AI SDK 7 releases.
- x402: payment caps, offer selection and UTF-8 tokens are fixed; with
@x402/core2.23+ upgrade@x402/coreand@x402/evmtogether.
- Work cut off by a reset resumes within seconds, a failing job stops retrying and reaches