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.
This is the core loop shared by TUI and non-interactive modes. The observer trait provides environment-specific behavior.