ExAthena.Modes.ReAct (ExAthena v0.4.1)

Copy Markdown View Source

Default mode: Reason-Act cycle.

Each iteration:

  1. Build a Request from current messages + tools + system prompt.
  2. Call the provider — uses stream/3 when the loop was started with on_event: set (so partial token deltas flow to the caller in real time), falls back to one-shot query/2 when no event callback is registered.
  3. Extract tool calls (native, or TextTagged fallback via ExAthena.ToolCalls).
  4. If no tool calls: emit {:content, text}, set finish_reason: :stop, and halt.
  5. If tool calls: run them (parallel-safe ones concurrently, mutating ones serially), append results, continue.

Budget + mistake-counter checks happen between iterations in the kernel. This mode only implements the turn-by-turn behaviour.