pub struct ExecutionConfig {
pub max_concurrency: usize,
pub default_timeout: Duration,
pub max_retries: u32,
pub initial_retry_delay: Duration,
pub max_retry_delay: Duration,
pub idempotency_ttl: Duration,
pub enable_idempotency: bool,
}Expand description
Configuration for tool execution behavior.
This struct controls all aspects of how tools are executed by the ToolWorker,
including retry behavior, timeouts, concurrency limits, and idempotency settings.
§Examples
use riglr_core::ExecutionConfig;
use std::time::Duration;
// Default configuration
let config = ExecutionConfig::default();
// Custom configuration for high-throughput scenario
let high_throughput_config = ExecutionConfig {
max_concurrency: 50,
default_timeout: Duration::from_secs(120),
max_retries: 5,
initial_retry_delay: Duration::from_millis(200),
max_retry_delay: Duration::from_secs(60),
enable_idempotency: true,
..Default::default()
};
// Conservative configuration for sensitive operations
let conservative_config = ExecutionConfig {
max_concurrency: 5,
default_timeout: Duration::from_secs(300),
max_retries: 1,
initial_retry_delay: Duration::from_secs(5),
max_retry_delay: Duration::from_secs(30),
enable_idempotency: true,
..Default::default()
};Fields§
§max_concurrency: usizeMaximum number of concurrent executions per resource type.
This controls the default concurrency limit when no specific resource
limit is configured. Individual resource types can have their own
limits configured via ResourceLimits.
Default: 10
default_timeout: DurationDefault timeout for tool execution.
Individual tool executions will be cancelled if they exceed this duration. Tools should be designed to complete within reasonable time bounds.
Default: 30 seconds
max_retries: u32Maximum number of retry attempts for failed operations.
This applies only to retriable failures. Permanent failures are never retried.
The total number of execution attempts will be max_retries + 1.
Default: 3 retries (4 total attempts)
initial_retry_delay: DurationInitial retry delay for exponential backoff.
The first retry will wait this long after the initial failure. Subsequent retries will use exponentially increasing delays.
Default: 100 milliseconds
max_retry_delay: DurationMaximum retry delay for exponential backoff.
Retry delays will not exceed this value, even with exponential backoff. This prevents excessive wait times for highly retried operations.
Default: 10 seconds
idempotency_ttl: DurationTTL for idempotency cache entries.
Completed operations with idempotency keys will be cached for this duration. Subsequent requests with the same key will return the cached result.
Default: 1 hour
enable_idempotency: boolWhether to enable idempotency checking.
When enabled, jobs with idempotency keys will have their results cached and subsequent identical requests will return cached results instead of re-executing the tool.
Default: true
Trait Implementations§
Source§impl Clone for ExecutionConfig
impl Clone for ExecutionConfig
Source§fn clone(&self) -> ExecutionConfig
fn clone(&self) -> ExecutionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more