#[non_exhaustive]pub struct GraphConfig {
pub thread_id: String,
pub checkpoint_id: Option<String>,
pub recursion_limit: u32,
pub max_concurrency: Option<usize>,
pub configurable: HashMap<String, Value>,
pub max_execution_time: Option<Duration>,
pub retry_policy: Option<RetryPolicy>,
}Expand description
Configuration for a single graph execution.
§Example
use pe_graph::GraphConfig;
let config = GraphConfig::default()
.with_thread_id("my-thread")
.with_recursion_limit(50);NOTE: #[non_exhaustive] — will grow with timeout, retry policy, etc.
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.thread_id: StringConversation thread identifier. Used as the checkpoint key.
checkpoint_id: Option<String>Resume from a specific past checkpoint (time travel).
recursion_limit: u32Maximum supersteps before PeError::GraphRecursion. Default: 25.
Kept low to catch infinite loops early in agentic systems. Users can raise this for legitimately deep graphs.
max_concurrency: Option<usize>Maximum parallel nodes per superstep. Default: unbounded.
Tokio’s thread pool naturally bounds actual parallelism. This provides an additional application-level limit.
configurable: HashMap<String, Value>User-defined values readable inside nodes.
max_execution_time: Option<Duration>Maximum wall-clock time for the entire graph execution.
The Pregel engine checks elapsed time at the start of each superstep.
If exceeded, returns PeError::Timeout before running nodes.
Default: None (no timeout).
retry_policy: Option<RetryPolicy>Retry policy for failed nodes.
When set, nodes that return NodeResult::Error(e) where
e.is_retryable() are retried up to max_attempts times
with backoff delays. Only the individual failed node is retried,
not the entire superstep.
Default: None (no retries — errors are immediate).
Implementations§
Source§impl GraphConfig
impl GraphConfig
Sourcepub fn with_thread_id(self, id: impl Into<String>) -> Self
pub fn with_thread_id(self, id: impl Into<String>) -> Self
Set the thread identifier for this execution.
Sourcepub fn with_recursion_limit(self, limit: u32) -> Self
pub fn with_recursion_limit(self, limit: u32) -> Self
Set the maximum number of supersteps before recursion error.
Sourcepub fn with_max_concurrency(self, n: usize) -> Self
pub fn with_max_concurrency(self, n: usize) -> Self
Limit parallel node executions per superstep.
Sourcepub fn with_checkpoint_id(self, id: impl Into<String>) -> Self
pub fn with_checkpoint_id(self, id: impl Into<String>) -> Self
Resume from a specific checkpoint.
Sourcepub fn with_max_execution_time(self, duration: Duration) -> Self
pub fn with_max_execution_time(self, duration: Duration) -> Self
Set the maximum wall-clock time for the entire execution.
The engine checks this at the start of each superstep, before running any nodes. Running nodes are never cancelled mid-execution.
Sourcepub fn with_retry_policy(self, policy: RetryPolicy) -> Self
pub fn with_retry_policy(self, policy: RetryPolicy) -> Self
Set a retry policy for failed nodes.
When set, nodes returning retryable errors are retried individually with exponential backoff. Non-retryable errors fail immediately.
§Example
use pe_graph::{GraphConfig, RetryPolicy};
let config = GraphConfig::default()
.with_retry_policy(RetryPolicy::default());Trait Implementations§
Source§impl Clone for GraphConfig
impl Clone for GraphConfig
Source§fn clone(&self) -> GraphConfig
fn clone(&self) -> GraphConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more