Skip to main content

Module pairing

Module pairing 

Source
Expand description

Tool call / result pairing for outgoing requests.

Strict APIs reject a transcript where an assistant tool call has no result (OpenAI: “tool_calls must be followed by tool messages”; Anthropic: every tool_use needs a tool_result) or where a tool result answers no call. The agent now answers interrupted calls itself, but sessions saved before that, imported transcripts and trimmed histories can still carry either shape. This repairs the request copy only; the stored transcript is left as the user saw it.

Constants§

MISSING_RESULT
Body of the result supplied for a call the transcript never answered.

Functions§

paired_messages
The transcript with every tool call answered and every result owned by a call. None when it already pairs up, so the common case copies nothing.