pub struct LoopConfig<'a> {
pub model: String,
pub system_prompt: String,
pub tools: Vec<ToolDef>,
pub agent_tools: &'a [Box<dyn AgentTool>],
pub extensions: &'a [Box<dyn Extension>],
pub tool_execution: ToolExecutionMode,
pub steering_queue: Option<&'a Mutex<PendingMessageQueue>>,
pub follow_up_queue: Option<&'a Mutex<PendingMessageQueue>>,
pub transform_context: Option<TransformFn>,
pub prepare_next_turn: Option<PrepareNextTurnFn>,
pub should_stop_after_turn: Option<ShouldStopFn>,
}Expand description
Configuration for the agent loop.
Fields§
§model: String§system_prompt: String§tools: Vec<ToolDef>§agent_tools: &'a [Box<dyn AgentTool>]§extensions: &'a [Box<dyn Extension>]§tool_execution: ToolExecutionModeTool execution mode: parallel (default) or sequential.
steering_queue: Option<&'a Mutex<PendingMessageQueue>>Optional steering queue: messages delivered after the current assistant turn’s tool calls finish, before the next LLM call.
follow_up_queue: Option<&'a Mutex<PendingMessageQueue>>Optional follow-up queue: messages delivered only after the agent has no more tool calls (fully idle).
transform_context: Option<TransformFn>Optional transform applied to the message list before each LLM call.
Receives the current messages and returns (possibly modified) messages.
Pi-compatible: transformContext for context window management, pruning, etc.
prepare_next_turn: Option<PrepareNextTurnFn>Optional callback invoked after each turn completes.
Can return a TurnUpdate to modify the context for the next turn.
Pi-compatible: prepareNextTurn.
should_stop_after_turn: Option<ShouldStopFn>Optional predicate invoked after each turn completes.
Return true to stop the agent loop early.
Pi-compatible: shouldStopAfterTurn.