agentic_workflow library
A graph workflow engine for the agentic framework.
For work whose shape is known in advance, where an agent loop is the wrong tool: a directed graph of typed nodes, validated before it runs and able to pause for a human and resume days later on another device.
import 'package:agentic_workflow/agentic_workflow.dart';
final graph = (WorkflowBuilder('triage')
..chain([StartNode(), classify])
..branch('classify', {'urgent': escalate, 'routine': reply})
..edge('escalate', 'end')
..edge('reply', 'end')
..add(EndNode()))
.build(); // throws here if the graph is wrong
final result = await WorkflowEngine().run(graph, input: {'ticket': ticket});
Two properties drive the design. Validation before execution: a node reading a key nothing upstream writes is a build-time error, not a failure three minutes into a run. Resumability: a suspended run is a JSON snapshot, so it survives the app being killed.
Classes
- AgentNode
- Runs an agent.
- ConditionNode
- Chooses between two paths.
- CustomNode
- Runs a caller-supplied function.
- DelayNode
- Waits.
- EndNode
- Where a run ends.
- GraphViolation
- One problem found in a graph.
- HumanApprovalNode
- Pauses until a person decides.
- InMemoryWorkflowSnapshotStore
- A WorkflowSnapshotStore that lives as long as the process.
- LlmNode
- Asks a model.
- LoopNode
- Repeats a target node until a condition holds.
- MapNode
- Runs one node once per item of a collection.
- NodeContext
- What a node was given when it ran.
- NodeExecution
- One node execution.
- NodeOutcome
- What a node decided.
- NodeSuspension
- A pause, waiting for something outside the workflow.
- ParallelNode
- Runs several nodes concurrently and merges their writes.
- StartNode
- Where a run begins.
- StructuredLlmNode
- Asks a model for a structured value.
- SwitchNode
- Chooses between several paths.
- ToolNode
- Runs one tool.
- TransformNode
- Computes new state from old.
- WaitForEventNode
- Pauses until an external event arrives.
- WorkflowBudget
- Bounds on a single workflow run.
- WorkflowBuilder
- Assembles a graph without repeating node identifiers.
- WorkflowCompleted
- A run ended, for any reason.
- WorkflowEdge
- A directed connection between two nodes.
- WorkflowEngine
- Executes workflow graphs.
- WorkflowEvent
- Base for every workflow event.
- WorkflowGraph
- A validated workflow.
- WorkflowNode
- One step of a workflow.
- WorkflowNodeCompleted
- A node finished.
- WorkflowNodeStarted
- A node is about to run.
- WorkflowResult
- The outcome of running a workflow.
- WorkflowSnapshot
- Everything needed to resume a suspended run.
- WorkflowSnapshotStore
- Keeps WorkflowSnapshots until their runs resume.
- WorkflowStarted
- A run began, or resumed.
- WorkflowState
- An immutable snapshot of a run's data.
- WorkflowSuspended
- A run paused, waiting for something outside it.
Enums
- WorkflowStatus
- How a run ended.