github cloudflare/agents @cloudflare/think@0.6.0

latest release: @cloudflare/ai-chat@0.7.0
3 hours ago

Minor Changes

  • #1456 787e73d Thanks @mattzcarey! - Stop applying pruneMessages({ toolCalls: "before-last-2-messages" }) to the model context by default. The previous default silently stripped client-side tool results (no execute, output supplied via addToolOutput) from any turn beyond the second, breaking multi-turn flows where the user's choices live in those tool results (see #1455). truncateOlderMessages still runs as before, so context cost stays bounded.

    This is a behavior change. Subclasses that relied on the old aggressive pruning can opt back in from beforeTurn:

    import { pruneMessages } from "ai";
    
    beforeTurn(ctx) {
      return {
        messages: pruneMessages({
          messages: ctx.messages,
          toolCalls: "before-last-2-messages"
        })
      };
    }
  • #1517 449b421 Thanks @threepointone! - Wrap Think.chat() RPC turns in chat recovery fibers and persist their stream chunks so interrupted sub-agent turns can recover partial output. ChatOptions.tools has been removed from the TypeScript API; runtime options.tools values passed by legacy callers are ignored with a warning. Define durable tools on the child agent or use agent tools for orchestration.

  • #1511 bf3860c Thanks @threepointone! - Add durable programmatic submissions for Think. submitMessages() now provides fast durable acceptance, idempotent retries, status inspection, cancellation, and cleanup for server-driven turns that should continue after the caller returns.

Patch Changes

  • #1500 7090e9e Thanks @threepointone! - Preserve structured tool output shapes when truncating older messages or oversized persisted rows, preventing custom toModelOutput handlers from crashing or mis-replaying compacted results.

    Also harden Think's workspace read tool so legacy raw-string read outputs replay as text instead of stalling subsequent turns.

  • #1483 5373f5c Thanks @whoiskatrin! - Allow Think agent-tool children to complete without emitting assistant text. Non-chat tool-step agents can now provide structured output through getAgentToolOutput, with summaries derived from assistant text, string output, structured output, or an empty string.

    Fix useAgentChat().isServerStreaming cleanup when a resumed stream first enters the fallback observer path and later becomes transport-owned.

  • #1463 ab2b1db Thanks @whoiskatrin! - Avoid throwing when chat stream resume negotiation/replay races with a closed WebSocket connection. Resume protocol sends and the _handleStreamResumeAck fallback now go through sendIfOpen helpers that swallow the TypeError: WebSocket send() after close race instead of letting it propagate up through onMessage.

Don't miss a new agents release

NewReleases is sending notifications on new releases.