Skip to main content

Module agent_loop

Module agent_loop 

Source
Expand description

Shared agent loop for tool-calling models.

Used by non-interactive mode (SilentObserver) and sub-agents (SubagentObserver). The TUI has its own agent loop in tui::loop_coordinator::run_agent_loop because it needs direct Terminal access for live rendering and interrupt handling — Terminal is not Send so it cannot be passed through the AgentObserver trait.

The AgentObserver trait allows each non-TUI consumer to provide its own I/O behavior (interruption checks, status logging, tool result handling).

Structs§

AgentLoopResult
Result of running the agent loop
ToolExecutionResult
Result of a single tool execution

Enums§

LoopControl
Control flow for the agent loop

Constants§

MAX_AGENT_ITERATIONS
Default maximum iterations for the agent loop

Traits§

AgentObserver
How the agent loop communicates with its environment

Functions§

run_agent_loop
Run the agent loop: execute tool calls, feed results back, repeat.