Skip to main content

Module workflow

Module workflow 

Source
Expand description

Multi-step agent workflow engine with DAG execution.

The WorkflowEngine allows registering named workflows composed of sequential steps or DAG-structured steps with parallel fan-out, conditional branching, loops, and advanced error handling.

§Variable substitution

Prompt templates support:

  • {{input}} / {{previous_output}} — current pipeline input
  • {{step_name}} — name of the current step
  • {{step_N}} — output of step N (1-indexed, sequential mode)
  • {{some_step_name}} — output of a step by name
  • {{step_name.output}} — explicit step output reference
  • {{step_name.status}} — step completion status
  • {{step_name.duration_ms}} — step duration
  • {{loop.index}} — current loop iteration
  • {{loop.item}} — current loop item (ForEach)
  • {{step_name.output.field.nested}} — JSON path into step output
  • {{step_name.output | uppercase}} — data transformation

Structs§

CircuitBreakerState
Tracks circuit breaker state per-step across workflow runs.
DagExecutionResult
Result of executing a DAG workflow.
DagWorkflow
A DAG workflow definition with parallel execution support.
DagWorkflowStep
A single step within a DAG workflow.
DeadLetterEntry
A failed step result stored in the dead letter queue.
ExecutionTraceEntry
An entry in the execution trace showing what happened at each “wave” of execution.
StepResult
Result of executing a single workflow step.
Workflow
A workflow definition composed of sequential steps (legacy).
WorkflowEngine
Engine for registering and executing multi-step agent workflows.
WorkflowId
Unique identifier for a workflow definition.
WorkflowRun
A single execution of a workflow.
WorkflowRunId
Unique identifier for a workflow run (execution instance).
WorkflowStep
A single step within a sequential workflow (legacy format, still supported).

Enums§

OnError
What to do when a workflow step fails.
StepStatus
Per-step execution status.
WorkflowRunStatus
Status of a workflow run.

Traits§

StepExecutor
A step executor trait that allows testing the DAG engine without real LLM calls.

Functions§

execute_dag
Execute a DAG workflow using the provided step executor.
expand_dag_variables
Replace template variables in a prompt string (DAG mode).