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, sub-agents, AND the TUI. The observer’s call_model and run_subagents hooks let each caller customize the execution strategy without duplicating the loop skeleton.