pub async fn run_loop(
agent: &dyn Agent,
tools: &ToolRegistry,
ctx: &mut AgentContext,
messages: &mut Vec<Message>,
config: &LoopConfig,
on_event: impl FnMut(LoopEvent),
) -> Result<usize, AgentError>Expand description
Run the agent loop: decide → execute tools → feed results → repeat.
Returns the number of steps taken.