Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Retry & Timeout

Graph-level Retry Policy

#![allow(unused)]
fn main() {
CompileConfig {
    retry_policy: Some(RetryPolicy {
        max_attempts: 3,
        initial_interval_ms: 500,
        backoff_factor: 2.0,
        max_interval_ms: 128_000,
        jitter: false,
    }),
    ..Default::default()
}
}

Node-level Override

Implement GraphNode and override retry_policy:

#![allow(unused)]
fn main() {
fn retry_policy(&self) -> Option<&RetryPolicy> {
    Some(&self.custom_policy)
}
}

Node-level policy overrides the graph-level policy for that node.

Retryable Errors

Only AgentError::Llm and AgentError::Other are retried. Other error variants fail immediately.

Timeout

Graph-level

#![allow(unused)]
fn main() {
GraphConfig {
    step_timeout: Some(Duration::from_secs(30)),
    ..Default::default()
}
}

Node-level

#![allow(unused)]
fn main() {
fn timeout(&self) -> Option<Duration> {
    Some(Duration::from_secs(60))
}
}

Node timeout overrides graph timeout for that node.