#[non_exhaustive]pub struct RuntimePolicy {Show 14 fields
pub max_iterations: usize,
pub max_tokens: Option<usize>,
pub max_tool_concurrency: usize,
pub tool_timeout: Duration,
pub provider_timeout: Duration,
pub continue_on_tool_failure: bool,
pub retry_on_provider_error: bool,
pub max_retries: usize,
pub compaction: CompactionConfig,
pub tool_output: ToolOutputConfig,
pub doom_loop: DoomLoopConfig,
pub input_admission: InputAdmissionConfig,
pub max_output_recovery_attempts: usize,
pub prompt_cache: PromptCacheConfig,
}Expand description
Runtime policy for agent execution.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_iterations: usizeMaximum number of model call iterations per run.
max_tokens: Option<usize>Maximum total tokens per run.
max_tool_concurrency: usizeMaximum concurrent tool executions.
tool_timeout: DurationTimeout for individual tool execution.
provider_timeout: DurationTimeout for provider calls.
continue_on_tool_failure: boolWhether to allow tool execution failures to continue the run.
retry_on_provider_error: boolWhether to retry on retryable provider errors.
max_retries: usizeMaximum retries for provider calls.
compaction: CompactionConfigCompaction strategy configuration.
tool_output: ToolOutputConfigTool output truncation configuration.
doom_loop: DoomLoopConfigDoom loop detection configuration.
input_admission: InputAdmissionConfigInput admission pipeline configuration.
max_output_recovery_attempts: usizeMaximum attempts to recover from model output truncation
(FinishReason::Length). When exceeded, the run completes with
truncated output. Default: 3.
prompt_cache: PromptCacheConfigPrompt caching strategy. Default: enabled with auto-breakpoints and 5-minute TTL.
Implementations§
Source§impl RuntimePolicy
impl RuntimePolicy
Sourcepub fn with_max_iterations(self, max_iterations: usize) -> Self
pub fn with_max_iterations(self, max_iterations: usize) -> Self
Sets the maximum iterations.
Sourcepub fn with_max_tokens(self, max_tokens: usize) -> Self
pub fn with_max_tokens(self, max_tokens: usize) -> Self
Sets the maximum tokens.
Sourcepub fn with_max_tool_concurrency(self, max_tool_concurrency: usize) -> Self
pub fn with_max_tool_concurrency(self, max_tool_concurrency: usize) -> Self
Sets the maximum tool concurrency.
Sourcepub fn with_tool_timeout(self, tool_timeout: Duration) -> Self
pub fn with_tool_timeout(self, tool_timeout: Duration) -> Self
Sets the tool timeout.
Sourcepub fn with_provider_timeout(self, provider_timeout: Duration) -> Self
pub fn with_provider_timeout(self, provider_timeout: Duration) -> Self
Sets the provider timeout.
Sourcepub fn with_continue_on_tool_failure(
self,
continue_on_tool_failure: bool,
) -> Self
pub fn with_continue_on_tool_failure( self, continue_on_tool_failure: bool, ) -> Self
Sets whether to continue on tool failure.
Sourcepub fn with_retry_on_provider_error(self, retry_on_provider_error: bool) -> Self
pub fn with_retry_on_provider_error(self, retry_on_provider_error: bool) -> Self
Sets whether to retry on provider errors.
Sourcepub fn with_max_retries(self, max_retries: usize) -> Self
pub fn with_max_retries(self, max_retries: usize) -> Self
Sets the maximum retries.
Sourcepub fn with_compaction(self, compaction: CompactionConfig) -> Self
pub fn with_compaction(self, compaction: CompactionConfig) -> Self
Sets the compaction configuration.
Sourcepub fn with_tool_output(self, config: ToolOutputConfig) -> Self
pub fn with_tool_output(self, config: ToolOutputConfig) -> Self
Sets the tool output truncation configuration.
Sourcepub fn with_doom_loop(self, config: DoomLoopConfig) -> Self
pub fn with_doom_loop(self, config: DoomLoopConfig) -> Self
Sets the doom loop detection configuration.
Sourcepub fn with_input_admission(self, config: InputAdmissionConfig) -> Self
pub fn with_input_admission(self, config: InputAdmissionConfig) -> Self
Sets the input admission pipeline configuration.
Sourcepub fn with_max_output_recovery_attempts(self, attempts: usize) -> Self
pub fn with_max_output_recovery_attempts(self, attempts: usize) -> Self
Sets the maximum output recovery attempts for truncated responses.
Sourcepub fn with_prompt_cache(self, config: PromptCacheConfig) -> Self
pub fn with_prompt_cache(self, config: PromptCacheConfig) -> Self
Sets the prompt caching configuration.
Trait Implementations§
Source§impl Clone for RuntimePolicy
impl Clone for RuntimePolicy
Source§fn clone(&self) -> RuntimePolicy
fn clone(&self) -> RuntimePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more