Installation
Setup
Create aReagentCallbackHandler and pass it to your chain:
How it works
The callback handler hooks into LangChain’s event system:
Tool results are automatically unwrapped from
ToolMessage.content and JSON-parsed when possible, so assert_tool_output_matches can validate dict/list shapes.
Full example
Parallel tool calls
The handler correctly tracks parallel tool calls usingcall_id from LangChain’s response. When the LLM requests multiple tools in a single turn, each result is matched to its corresponding call.