Skip to main content

run_agent_loop

Function run_agent_loop 

Source
pub async fn run_agent_loop(
    model: Arc<RwLock<Box<dyn Model>>>,
    config: &ModelConfig,
    messages: &mut Vec<ChatMessage>,
    initial_tool_calls: Vec<ToolCall>,
    observer: &mut dyn AgentObserver,
    max_iterations: usize,
) -> Result<AgentLoopResult>
Expand description

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

Used by non-interactive mode and sub-agents. The TUI has its own implementation in tui::loop_coordinator::run_agent_loop — see that function’s documentation for the rationale.