@cloudflare/think@0.7.1

cloudflare/agents@cloudflare/think@0.7.1May 20, 2026by github-actions[bot]

AI Summary

This patch release for @cloudflare/think adds two key improvements: the ability to end agentic loops early using new `TurnConfig.stopWhen` conditions while maintaining the existing `maxSteps` safety bound, and RPC-safe cancellation support for `chat()` turns with new callback and cancellation methods.

Key Highlights

  • Exposed additive `TurnConfig.stopWhen` conditions for early agentic loop termination
  • Added RPC-safe cancellation for `chat()` turns
  • New `StreamCallback.onStart()` callback for turn start handling
  • New `cancelChat()` method for cancelling in-progress chats
  • Retains `maxSteps` safety bound while allowing early termination via stop conditions

New Features

  • TurnConfig.stopWhen conditions allowing Think subclasses to end agent loops after designated tool calls
  • StreamCallback.onStart() callback for handling turn start events
  • cancelChat() method for RPC-safe cancellation of chat turns

Full Release Notes

### Patch Changes

-   [#1561](https://github.com/cloudflare/agents/pull/1561) [`831ba1d`](https://github.com/cloudflare/agents/commit/831ba1d20d76c35c9de6ff1799c5f103256dee31) Thanks [@whoiskatrin](https://github.com/whoiskatrin)! - Expose additive `TurnConfig.stopWhen` conditions so Think subclasses can end an agentic loop early, for example after a designated tool call, while retaining the existing `maxSteps` safety bound.

-   [#1563](https://github.com/cloudflare/agents/pull/1563) [`32cde40`](https://github.com/cloudflare/agents/commit/32cde406b3ab022ec83707863c42f22c741527d8) Thanks [@threepointone](https://github.com/threepointone)! - Add RPC-safe cancellation for `chat()` turns with `StreamCallback.onStart()` and `cancelChat()`.