pub struct WorkflowEngine { /* private fields */ }Expand description
Workflow execution engine with a pre-built agent map.
Agents are keyed by the names used in WorkflowStepDef variants
(e.g. the agent field of Run). The engine looks them up by name
at execution time; an unknown agent name fails the step with a clear
error rather than panicking.
Implementations§
Source§impl WorkflowEngine
impl WorkflowEngine
Sourcepub fn new(agents: HashMap<String, AgentHandle>) -> Self
pub fn new(agents: HashMap<String, AgentHandle>) -> Self
Create a new engine with the given agent map and fresh
SharedMemory / Consensus instances.
Sourcepub fn with_memory(self, memory: Arc<SharedMemory>) -> Self
pub fn with_memory(self, memory: Arc<SharedMemory>) -> Self
Replace the default SharedMemory with a caller-supplied one
(e.g. to share state across multiple workflow runs).
Sourcepub fn with_consensus(self, consensus: Arc<Consensus>) -> Self
pub fn with_consensus(self, consensus: Arc<Consensus>) -> Self
Replace the default Consensus with a caller-supplied one.
Borrow the shared memory (for tests / inspection).
Sourcepub async fn execute(&self, workflow: &WorkflowDefinition) -> WorkflowResult
pub async fn execute(&self, workflow: &WorkflowDefinition) -> WorkflowResult
Execute the workflow top-to-bottom. Stops at the first failing step (subsequent steps are not run).
Auto Trait Implementations§
impl !RefUnwindSafe for WorkflowEngine
impl !UnwindSafe for WorkflowEngine
impl Freeze for WorkflowEngine
impl Send for WorkflowEngine
impl Sync for WorkflowEngine
impl Unpin for WorkflowEngine
impl UnsafeUnpin for WorkflowEngine
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
Mutably borrows from an owned value. Read more