Skip to main content

run_agent_loop

Function run_agent_loop 

Source
pub async fn run_agent_loop(
    prompts: Vec<AgentMessage>,
    history: Vec<AgentMessage>,
    config: &LoopConfig<'_>,
    provider: &dyn Provider,
    emit: &mut (dyn FnMut(AgentEvent) + Send),
) -> Result<Vec<AgentMessage>>
Expand description

Run the full agent loop. Returns all new messages added during the run. history contains pre-existing messages from a previous session (if continuing).

Supports parallel tool execution (default) and sequential, plus steering/follow-up message queues for mid-stream interruption (pi-compatible).