pub struct WorkflowGuardConfig {
pub max_depth: u32,
pub max_fan_out: u32,
pub max_workflow_tokens: u64,
pub workflow_timeout_secs: u64,
}Expand description
Configurable execution limits for a workflow run.
Each limit has a sensible default. Limits can be set per-handler via
WorkflowHandler::guard_config
or globally on the Engine.
§Examples
use ironflow_engine::guard::WorkflowGuardConfig;
let config = WorkflowGuardConfig::new()
.with_max_depth(3)
.with_max_fan_out(10);
assert_eq!(config.max_depth, 3);
assert_eq!(config.max_fan_out, 10);
assert_eq!(config.max_workflow_tokens, 100_000);Fields§
§max_depth: u32Maximum depth of nested sub-workflows (default 5).
max_fan_out: u32Maximum total number of workflow invocations (default 20).
max_workflow_tokens: u64Cumulative token budget across all agent steps (default 100,000).
workflow_timeout_secs: u64Global timeout in seconds (default 120).
Implementations§
Source§impl WorkflowGuardConfig
impl WorkflowGuardConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a configuration with default limits.
§Examples
use ironflow_engine::guard::WorkflowGuardConfig;
assert_eq!(WorkflowGuardConfig::new(), WorkflowGuardConfig::default());Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Load configuration from environment variables.
Reads IRONFLOW_GUARD_MAX_DEPTH, IRONFLOW_GUARD_MAX_FAN_OUT,
IRONFLOW_GUARD_MAX_WORKFLOW_TOKENS, and IRONFLOW_GUARD_WORKFLOW_TIMEOUT_SECS.
Missing or unparseable variables fall back to defaults.
§Examples
use ironflow_engine::guard::WorkflowGuardConfig;
let config = WorkflowGuardConfig::from_env();
// Without env vars set, returns defaults.
assert_eq!(config.max_depth, 5);Sourcepub fn with_max_depth(self, max_depth: u32) -> Self
pub fn with_max_depth(self, max_depth: u32) -> Self
Set the maximum sub-workflow nesting depth.
§Examples
use ironflow_engine::guard::WorkflowGuardConfig;
let config = WorkflowGuardConfig::new().with_max_depth(3);
assert_eq!(config.max_depth, 3);Sourcepub fn with_max_fan_out(self, max_fan_out: u32) -> Self
pub fn with_max_fan_out(self, max_fan_out: u32) -> Self
Set the maximum total workflow invocations.
§Examples
use ironflow_engine::guard::WorkflowGuardConfig;
let config = WorkflowGuardConfig::new().with_max_fan_out(10);
assert_eq!(config.max_fan_out, 10);Sourcepub fn with_max_workflow_tokens(self, max: u64) -> Self
pub fn with_max_workflow_tokens(self, max: u64) -> Self
Set the cumulative token budget.
§Examples
use ironflow_engine::guard::WorkflowGuardConfig;
let config = WorkflowGuardConfig::new().with_max_workflow_tokens(50_000);
assert_eq!(config.max_workflow_tokens, 50_000);Sourcepub fn with_workflow_timeout_secs(self, secs: u64) -> Self
pub fn with_workflow_timeout_secs(self, secs: u64) -> Self
Set the global timeout in seconds.
§Examples
use ironflow_engine::guard::WorkflowGuardConfig;
let config = WorkflowGuardConfig::new().with_workflow_timeout_secs(60);
assert_eq!(config.workflow_timeout_secs, 60);Trait Implementations§
Source§impl Clone for WorkflowGuardConfig
impl Clone for WorkflowGuardConfig
Source§fn clone(&self) -> WorkflowGuardConfig
fn clone(&self) -> WorkflowGuardConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WorkflowGuardConfig
impl Debug for WorkflowGuardConfig
Source§impl Default for WorkflowGuardConfig
impl Default for WorkflowGuardConfig
impl Eq for WorkflowGuardConfig
Source§impl PartialEq for WorkflowGuardConfig
impl PartialEq for WorkflowGuardConfig
impl StructuralPartialEq for WorkflowGuardConfig
Auto Trait Implementations§
impl Freeze for WorkflowGuardConfig
impl RefUnwindSafe for WorkflowGuardConfig
impl Send for WorkflowGuardConfig
impl Sync for WorkflowGuardConfig
impl Unpin for WorkflowGuardConfig
impl UnsafeUnpin for WorkflowGuardConfig
impl UnwindSafe for WorkflowGuardConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.