Skip to main content

run_loop_interactive

Function run_loop_interactive 

Source
pub async fn run_loop_interactive<F, Fut>(
    agent: &dyn Agent,
    tools: &ToolRegistry,
    ctx: &mut AgentContext,
    messages: &mut Vec<Message>,
    config: &LoopConfig,
    on_event: impl FnMut(LoopEvent),
    on_input: F,
) -> Result<usize, AgentError>
where F: FnMut(String) -> Fut, Fut: Future<Output = String>,
Expand description

Core agent loop — single implementation for both interactive and non-interactive modes.

When a tool returns ToolOutput::waiting, calls on_input with the question. run_loop delegates here with a passive handler that returns a placeholder.