Expand description
Shared agent loop for tool-calling models.
Used by non-interactive mode (SilentObserver), sub-agents
(SubagentObserver), and the TUI (TuiObserver). The observer
pattern lets each consumer plug in its own model-call and subagent-
handling strategies: the default trait methods do simple sync/join
work (good for non-interactive and subagents); the TUI overrides
call_model and run_subagents to drive channel-based streaming
and live rendering without forking the core loop.
The trait is Send-bounded so futures returned by its default
methods are Send (required by tokio::spawn in subagent code).
The TUI observer is also Send: it holds &mut Terminal<...> and
&mut App, both of which are Send since io::Stdout and the
tokio sync primitives inside App are Send.
Structs§
- Agent
Loop Result - Result of running the agent loop
- Model
Call Output - Output of a single model call, returned from the
call_modelhook. - Tool
Execution Result - Result of a single tool execution
Enums§
- Loop
Control - Control flow for the agent loop
Constants§
- MAX_
AGENT_ ITERATIONS - Default maximum iterations for the agent loop
Traits§
- Agent
Observer - How the agent loop communicates with its environment.
Functions§
- run_
agent_ loop - Run the agent loop: execute tool calls, feed results back, repeat.