Claudex.ToolRunner.Turn (Claudex v0.6.1)

Copy Markdown View Source

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 in messages, so the conversation can be picked up again by passing that history back.

Summary

Functions

Whether Claude asked to run anything this turn.

Types

stop()

@type stop() :: :completed | :refusal | :max_turns

t()

@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()]
}

Functions

tool_use?(turn)

@spec tool_use?(t()) :: boolean()

Whether Claude asked to run anything this turn.