pub struct AgentConfig {
pub max_turns: Option<usize>,
pub max_tokens: Option<u32>,
pub system_prompt: String,
pub model: String,
pub retry: RetryConfig,
pub streaming: bool,
pub tool_timeout_ms: Option<u64>,
pub usage_limits: Option<UsageLimits>,
pub max_parallel_tools: Option<usize>,
}Expand description
Configuration for the agent loop
Fields§
§max_turns: Option<usize>Maximum number of turns (LLM round-trips) before stopping
max_tokens: Option<u32>Maximum tokens per response.
If None, the SDK uses the provider/model-specific default.
system_prompt: StringSystem prompt for the agent
model: StringModel identifier
retry: RetryConfigRetry configuration for transient errors
streaming: boolEnable streaming responses from the LLM.
When true, emits TextDelta and ThinkingDelta events as text arrives
in real-time. When false (default), waits for the complete response
before emitting Text and Thinking events.
tool_timeout_ms: Option<u64>Optional per-tool execution timeout in milliseconds.
When set, the agent loop races each tool’s execute() future
against this budget at the SDK boundary (mirroring
SubagentConfig::timeout_ms). A tool that exceeds the budget is
stopped and reported with a synthetic timeout ToolResult, keeping
the tool_use / tool_result history balanced even for
non-cooperative tools. None (default) disables the boundary
timeout entirely.
usage_limits: Option<UsageLimits>Optional run-level token / cost budgets.
When set, the agent loop checks the cumulative token usage (and the
estimated USD cost, when the provider/model has pricing metadata)
at every turn-continuation boundary. If a configured limit is
exceeded the run stops with
AgentRunState::BudgetExceeded / TurnOutcome::BudgetExceeded
instead of starting another turn. None (default) disables
budgeting entirely.
max_parallel_tools: Option<usize>Maximum number of read-only (ToolTier::Observe) tool calls the SDK
runs concurrently within a single parallel batch.
None (default) keeps the historical unbounded behavior — every
adjacent observe-tier call in a turn is dispatched at once.
Some(1) forces strictly sequential execution; Some(n) caps the
in-flight count at n. Some(0) is not meaningful and is treated
as Some(1) (sequential). Result ordering is always preserved.
Trait Implementations§
Source§impl Clone for AgentConfig
impl Clone for AgentConfig
Source§fn clone(&self) -> AgentConfig
fn clone(&self) -> AgentConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more