pub struct AgentLoopConfig {Show 20 fields
pub model: Model,
pub convert_to_llm: ConvertToLlm,
pub transform_context: Option<TransformContext>,
pub get_api_key: Option<GetApiKey>,
pub should_stop_after_turn: Option<ShouldStopAfterTurn>,
pub prepare_next_turn: Option<PrepareNextTurn>,
pub after_tool_results: Option<AfterToolResults>,
pub get_steering_messages: Option<GetSteeringMessages>,
pub get_follow_up_messages: Option<GetFollowUpMessages>,
pub before_tool_call: Option<BeforeToolCall>,
pub after_tool_call: Option<AfterToolCall>,
pub tool_execution: ToolExecutionMode,
pub thinking_level: ThinkingLevel,
pub api_key: Option<String>,
pub timeout: Option<Duration>,
pub max_retries: Option<u32>,
pub max_retry_delay: Option<Duration>,
pub cache_retention: CacheRetention,
pub session_id: Option<String>,
pub signal: CancellationToken,
}Expand description
The config bundle handed to run_agent_loop / run_agent_loop_continue.
Mirrors TS AgentLoopConfig. Hook fields are Option except convert_to_llm
(required). The provider-options subset (api_key, timeout, cache_retention,
session_id, max_retries, max_retry_delay, signal) is kept as plain
fields the loop stuffs into a SimpleStreamOptions per turn.
Fields§
§model: Model§convert_to_llm: ConvertToLlmRequired: AgentMessage[] → Message[]. Never None at call time; the
AgentBuilder installs default_convert_to_llm (drop custom roles) when
the caller doesn’t supply one.
transform_context: Option<TransformContext>§get_api_key: Option<GetApiKey>§should_stop_after_turn: Option<ShouldStopAfterTurn>§prepare_next_turn: Option<PrepareNextTurn>§after_tool_results: Option<AfterToolResults>§get_steering_messages: Option<GetSteeringMessages>§get_follow_up_messages: Option<GetFollowUpMessages>§before_tool_call: Option<BeforeToolCall>§after_tool_call: Option<AfterToolCall>§tool_execution: ToolExecutionModePer-batch execution mode. Default Parallel.
thinking_level: ThinkingLevel§api_key: Option<String>§timeout: Option<Duration>§max_retries: Option<u32>§max_retry_delay: Option<Duration>§cache_retention: CacheRetention§session_id: Option<String>§signal: CancellationTokenCancellation token for the whole run. The loop clones a child per tool.
Implementations§
Source§impl AgentLoopConfig
Build a SimpleStreamOptions from this config’s provider-options subset,
overriding signal with the run’s token. Mirrors the TS spread
{ ...config, apiKey: resolvedApiKey, signal } passed to streamFunction.
impl AgentLoopConfig
Build a SimpleStreamOptions from this config’s provider-options subset,
overriding signal with the run’s token. Mirrors the TS spread
{ ...config, apiKey: resolvedApiKey, signal } passed to streamFunction.
pub fn to_stream_options(&self, api_key: Option<String>) -> SimpleStreamOptions
Trait Implementations§
Source§impl Clone for AgentLoopConfig
impl Clone for AgentLoopConfig
Source§fn clone(&self) -> AgentLoopConfig
fn clone(&self) -> AgentLoopConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more