Skip to content

agents@0.35.0

Choose a tag to compare

@github-actions github-actions released this 04 Dec 16:02
· 11 commits to main since this release
fdaa297

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

  • ThinkHarness and Code Mode: ThinkHarness (agents/harness/think) replaces the removed AiSdkHarness (#3112) and runs turns on the same engine as Think (#3295). The new agents/harness/think/extensions entry point adds codemode(), CodemodeSandbox, and sandboxExecutor(), giving the model a single code tool whose script calls your other tools and records each call as a step (#3294). ThinkHarness also accepts a tracing option for model and tool spans. Experimental.
  • Typed browser automation and tab observers: CdpConnection.send() is now typed from devtools-protocol, with new on() and waitFor() methods for CDP events (#3155). Browser adds a hostObserver option 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: agents now stores up to 8 MB in a single SQLite row (up from 2 MB), and pages event-log replay, Sessions search, and getAgentToolChunks() 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, and agents/streams each take an optional name (such as new 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 experimental piTracing() from agents/observability/pi to export pi-durable runs, model requests, and tool calls as OpenTelemetry GenAI spans to an otlp binding (#3619). PiImagesCallOptions adds aspectRatio, size, and sessionId, and PiModelOptions.cost adds imageOutput. The OpenCode harness and agents/models/opencode update 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). AgentWorkflow runs and stubs, workflow callbacks, the MCP RPC transport, and getAgentByName() survive resets (#3052). Sub-agents no longer stall when many start at once, work under a jurisdiction (#3085), run jobs and getSchedule(), and empty descendant storage on deleteSubAgent(). See Lifecycle.
  • Agent-tool and tab reliability: Detached agent-tool runs accept eventDelivery: "terminal" (#3955), AIChatAgent tool 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). useAgent and AgentClient wait 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, .internal names, carrier-grade NAT, reserved/multicast ranges, and IPv4-mapped, NAT64, or 6to4 private IPv6 addresses (localhost and loopback still work) (#3110). See MCP client.
  • Fixes and polish:
    • Experimental agents/tasks renames state to status (error, aborted, pending, plus skipped) (#3010), throws TaskInputConflictError when reusing an id or idempotency key with different input (#2986), aborts immediately on cancel(), and jitters retry backoff (#3114).
    • Experimental agents/context moves freezeSystemPrompt(), refreshSystemPrompt(), and reminder() from ContextBlocks to the new session-backed Context class (#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() breaks created_at ties by insertion order (#3062) and sub-agent event-log frames reach the sub-agent (#3018).
    • Think and ThinkHarness recover model streams that close without a finish signal (#3953); ThinkChat reaches sub-agent tabs; Channels adds an optional ChannelMessageSurface.key (experimental) and no longer answers twice after a reset.
    • replyToEmail() no longer adds a second Re:; Anthropic onResponse AbortError stops the pi-ai fallback chain; x402 fixes payment caps, offer selection, and UTF-8 tokens and adds FacilitatorConfig.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/shell package was removed from the repository (#2896); its last npm release (0.5.0) remains published and deprecated in favor of @cloudflare/computer.

Minor Changes

  • #3988 17862ac Thanks @mattzcarey! - New and changed APIs. See the docs.

    • Experimental ThinkHarness (agents/harness/think) replaces AiSdkHarness, which is removed; it takes extensions (Code Mode) and a tracing option.
    • Experimental agents/tasks: state is now status, failed is error, cancelled is aborted, waiting is pending; stored runs migrate.
    • Tasks, Sessions and agents/streams take an optional name, for more than one in an object.
    • Experimental agents/context: freezeSystemPrompt, refreshSystemPrompt and reminder move from ContextBlocks to the new Context.
    • Sessions: addCompaction() throws on an anchor that can never apply, and a read from the root throws past 200,000 visible messages.
    • Browser: CdpConnection has on() and waitFor(), send() is typed, and Browser takes a hostObserver.
    • One SQLite row holds up to 8 MB (was 2 MB); ROW_MAX_BYTES and enforceRowSizeLimit are removed from agents/chat (use ROW_VALUE_BYTES).
    • getAgentToolChunks answers a page at a time: pass the last afterSequence until a call returns no chunks.
    • Agent tools: eventDelivery: "terminal" works for detached runs, and Think.startAgentToolRun takes a signal.
    • 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/sdk and @opencode/plugin to 2.2.3 or later with it.
    • useAgent and AgentClient wait 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.
  • #3988 17862ac Thanks @mattzcarey! - Upgrade agents, @cloudflare/ai-chat and @cloudflare/think together. See Upgrading from ai-chat 0.12 and Upgrading Think from 0.24.

    • @cloudflare/ai-chat and @cloudflare/think need agents 0.35.0 or later; agents/chat is 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 17862ac Thanks @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.
    • AgentWorkflow runs and stubs, the MCP RPC transport and getAgentByName survive 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, .internal names 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/core 2.23+ upgrade @x402/core and @x402/evm together.