pub async fn run_agent_loop_with_config(
session: &mut Session,
initial_message: String,
event_tx: Sender<AgentEvent>,
llm: Arc<dyn LLMProvider>,
tools: Arc<dyn ToolExecutor>,
cancel_token: CancellationToken,
config: AgentLoopConfig,
) -> Result<()>Expand description
Runs the agent loop with a custom configuration.
This is the primary entry point for executing an agent conversation loop. It manages LLM streaming, tool execution, task list tracking, metrics collection, and event emission throughout the conversation lifecycle.
§Arguments
session- The conversation session to operate oninitial_message- The user’s initial message to processevent_tx- Channel sender for agent eventsllm- The LLM provider to use for generationtools- The tool executor for handling tool callscancel_token- Token for cancelling the operationconfig- Configuration controlling loop behavior
§Returns
Returns Ok(()) on successful completion, or an error if the loop fails.