pub struct WorkflowEngine { /* private fields */ }Expand description
Workflow execution engine.
Implementations§
Source§impl WorkflowEngine
impl WorkflowEngine
pub fn new(runner: Arc<dyn AgentRunner>, infra: SharedInfra) -> Self
Sourcepub fn run<'a>(
&'a self,
workflow: &'a Workflow,
) -> BoxFuture<'a, Result<WorkflowResult, WorkflowError>>
pub fn run<'a>( &'a self, workflow: &'a Workflow, ) -> BoxFuture<'a, Result<WorkflowResult, WorkflowError>>
Execute a workflow to completion, following the stage graph.
Sourcepub async fn run_cached(
&self,
workflow: &Workflow,
prior: &WorkflowResult,
) -> Result<WorkflowResult, WorkflowError>
pub async fn run_cached( &self, workflow: &Workflow, prior: &WorkflowResult, ) -> Result<WorkflowResult, WorkflowError>
Re-run a workflow, reusing the successful prefix of a prior result.
Every stage that succeeded in prior is replayed from its cached result
(instantly, no agent/proposal call); the first stage that did not succeed —
and everything after it — runs live, seeded with prior.final_state. Same
workflow + same prior result → the same resume point, deterministically.
Use this to recover a long run that failed partway, or to continue after
fixing the cause of a failure, without re-paying for completed work. Does
not resume an approval pause (use resume for that),
though it can newly pause at an approval gate the prior run never reached.
Replayed stages keep their original recorded duration_ms, so summing
per-stage durations across the original and cached runs would double-count
the replayed prefix.
Sourcepub async fn resume(
&self,
paused: PausedWorkflow,
input: HashMap<String, Value>,
) -> Result<WorkflowResult, WorkflowError>
pub async fn resume( &self, paused: PausedWorkflow, input: HashMap<String, Value>, ) -> Result<WorkflowResult, WorkflowError>
Resume a run that was parked at an approval gate.
Applies input as the approval stage’s response (written to its
output_key and mirrored to stage.<id>.answer), records the stage as
succeeded, then continues the stage graph. Chained approval gates pause
again, returning a fresh PausedWorkflow each time.
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more