Agentic.Loop.Stages.ToolExecutor (agentic v0.2.2)

Copy Markdown

Executes pending tool calls and re-enters the loop.

When ModeRouter detects a tool_use stop_reason, it stores the tool calls in ctx.pending_tool_calls. This stage executes them, appends tool results to messages, rebuilds the tool list, and re-invokes the full pipeline.

Callbacks

Required on ctx.callbacks:

  • :execute_tool - (name, input, ctx) -> {:ok, out} | {:ok, out, ctx} | {:error, term}

Optional:

  • :on_tool_facts - (workspace_id, tool_name, result, turn) -> :ok