One exchange in a tool conversation: what Claude said, what it asked to run, and what running it produced.
messages carries the whole conversation up to and including this turn, so
you can stop consuming at any point and still have the complete history from
the last turn you saw.
stop is nil while the conversation is still going, and says why it ended on
the final turn:
:completed- Claude answered without asking for another tool.:refusal- Claude declined. Its tool calls, if any, were not run.:max_turns- the runner's turn limit ran out. The tools for this turn did run and their results are inmessages, so the conversation can be picked up again by passing that history back.
Summary
Functions
Whether Claude asked to run anything this turn.
Types
@type stop() :: :completed | :refusal | :max_turns
@type t() :: %Claudex.ToolRunner.Turn{ index: pos_integer(), message: Claudex.Message.t(), messages: [map()], stop: stop() | nil, tool_results: [map()], tool_uses: [Claudex.ContentBlock.ToolUse.t()] }