Skip to main content

Installation

Setup

Wrap your Anthropic client with patch():
patch() wraps client.messages.create to automatically log tool_use content blocks into the active reagent-flow session.

Basic usage

Tool result capture

When you thread tool results back as user messages with tool_result content blocks, the adapter captures them automatically:
The adapter handles both string content and list-of-text-blocks content in tool_result blocks. JSON-encoded content is automatically decoded for schema validation.

What gets captured

Streaming

Streaming (stream=True) is detected and skipped with a warning. Use stream=False for traced calls.

No session active

If no reagent-flow session is active when create() is called, the adapter is a no-op.