pub struct Workflow { /* private fields */ }Expand description
A built, runnable workflow graph.
Implementations§
Source§impl Workflow
impl Workflow
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
The workflow description, if set.
Sourcepub fn start_executor_id(&self) -> &str
pub fn start_executor_id(&self) -> &str
The start executor id.
Sourcepub fn graph_signature(&self) -> &str
pub fn graph_signature(&self) -> &str
This workflow’s deterministic graph signature (see
WorkflowBuilder::build). Checkpoints record the signature of the
graph that produced them; Workflow::run_from_checkpoint refuses to
resume a checkpoint whose signature does not match this workflow’s.
Sourcepub async fn run(&self, input: impl Into<Value>) -> Result<WorkflowRun, Error>
pub async fn run(&self, input: impl Into<Value>) -> Result<WorkflowRun, Error>
Run the workflow to completion (or until it pauses awaiting external input), returning the run handle with observed events and final state.
Sourcepub fn run_stream(&self, input: impl Into<Value>) -> WorkflowRunStream
pub fn run_stream(&self, input: impl Into<Value>) -> WorkflowRunStream
Run the workflow, streaming events as they happen.
Returns a WorkflowRunStream that yields WorkflowEvents live; call
WorkflowRunStream::into_run after the stream ends to obtain the final
WorkflowRun state.
Sourcepub async fn run_from_checkpoint(
&self,
checkpoint_id: &str,
storage: Arc<dyn CheckpointStorage>,
) -> Result<WorkflowRun, Error>
pub async fn run_from_checkpoint( &self, checkpoint_id: &str, storage: Arc<dyn CheckpointStorage>, ) -> Result<WorkflowRun, Error>
Restore a run from a checkpoint and continue it to completion (or pause).
Restores the in-flight message queue, iteration count, shared state, executor states, and any outstanding requests.
Before restoring, the checkpoint’s recorded graph
signature is compared against this
workflow’s: a mismatch is a hard Error::Workflow (the topology
changed since the checkpoint was saved, so resuming could misroute
messages or drop executor state). A legacy checkpoint carrying no
signature is resumed with a warning. Use
Workflow::run_from_checkpoint_unchecked to bypass the check.
Sourcepub async fn run_from_checkpoint_unchecked(
&self,
checkpoint_id: &str,
storage: Arc<dyn CheckpointStorage>,
) -> Result<WorkflowRun, Error>
pub async fn run_from_checkpoint_unchecked( &self, checkpoint_id: &str, storage: Arc<dyn CheckpointStorage>, ) -> Result<WorkflowRun, Error>
Like Workflow::run_from_checkpoint, but skips graph-signature
validation (a mismatch is logged, not rejected). For deliberately
resuming a checkpoint into an intentionally-evolved graph, where the
caller accepts responsibility for compatibility.
Sourcepub fn viz(&self) -> WorkflowViz<'_>
pub fn viz(&self) -> WorkflowViz<'_>
A visualization helper (Mermaid / Graphviz DOT) for this workflow.
Trait Implementations§
Source§impl WorkflowAgentExt for Workflow
impl WorkflowAgentExt for Workflow
Source§fn as_agent(&self, name: impl Into<String>) -> WorkflowAgent
fn as_agent(&self, name: impl Into<String>) -> WorkflowAgent
WorkflowAgent named name.