workflow library
Node-based workflow graph orchestration and deterministic replay utilities.
Provides Workflow, BaseNode, FunctionNode, AgentNode, ToolNode, Edge, and ReplayManager for constructing directed graph workflows with human-in-the-loop interrupts and deterministic replay.
import 'package:adk_dart/workflow.dart';
final step = FunctionNode(
name: 'greet',
function: (context, input) async => 'Hello, $input!',
);
Classes
- AgentNode
- Node that wraps an ADK BaseAgent.
- BaseNode
- Base class for node-based workflow units.
- ChildScanState
- Recovered child scan state from event history for replay interception.
- DynamicNodeRun
- Current in-memory state of a dynamic or static node run.
- Edge
- Directed workflow edge.
- EdgeChain
- A chain of edges positioned at a node, started by EdgesBuilder.from, EdgesBuilder.fromStart, or NodeGroupChain.joinTo.
- EdgesBuilder
- A builder for the edges of a workflow graph, declared as chains of calls that start at from or fromStart.
- FunctionNode
- Function-backed workflow node.
- InterceptionResult
- Decision returned by checkInterception.
- JoinNode
- Node that passes through aggregated predecessor inputs.
- Node
- Node designed for subclassing.
- NodeGroupChain
- A chain of edges positioned at a node group from a fan-out or EdgesBuilder.fromGroup.
- NodeState
- Mutable state for one workflow node.
- ParallelWorker
- Node that runs a wrapped child node for every input item in parallel.
- ReplayManager
- ReplayManager - unified orchestrator for event rehydration, interception, and sequence barriers.
- ReplaySequenceBarrier
- Chronological barrier used to coordinate deterministic replay ordering.
- RetryConfig
- Retry configuration for workflow node execution.
- RouteMap
- A routing map configured in EdgeChain.route mapping routes emitted by the source node to downstream target nodes.
- RouteMapEntry
- A routing-map entry started by RouteMap.on whose route has no target yet; then completes it.
- RouteSet
- A set of routes that select a single edge firing when the source emits any of them.
- ToolNode
- Node that wraps an ADK BaseTool.
- Workflow
- Node-based workflow agent.
- WorkflowContext
- Shared runtime context passed to workflow nodes.
- WorkflowResult
- Execution result from Workflow.runWorkflow.
- WorkflowTool
- A tool wrapper that executes a complete multi-node Workflow graph as a standard ADK BaseTool.
Enums
- NodeStatus
- Runtime status for a workflow node.
Constants
- DEFAULT_ROUTE → const String
- Default route value used by routed workflow edges.
- defaultRoute → const String
- Lower-camel alias for DEFAULT_ROUTE.
- START → const String
- Sentinel node name used for workflow start edges.
Functions
-
authInterruptId(
String nodePath) → String -
Returns the auth interrupt identifier for
nodePath. -
buildNode(
Object nodeLike, {String? name, String description = '', List< String> ? dependsOn, bool? rerunOnResume, bool? waitForOutput, RetryConfig? retryConfig, Duration? timeout, Object? outputSchema, Object? requireConfirmation}) → BaseNode - Converts a workflow-compatible object into a BaseNode.
-
checkInterception(
{required Object node, ChildScanState? recovered, DynamicNodeRun? currentRun}) → InterceptionResult - Evaluates whether a node's execution should be intercepted based on history.
-
confirmationInterruptId(
String nodePath) → String -
Returns the confirmation interrupt identifier for
nodePath. -
hasOwnRetryConfig(
BaseNode node) → bool -
Returns whether
nodehas an explicit RetryConfig configured directly or on its wrapped worker. -
node(
WorkflowFunction function, {required String name, String description = '', List< String> ? dependsOn, bool? rerunOnResume, bool? waitForOutput, RetryConfig? retryConfig, Duration? timeout, Object? outputSchema, Object? requireConfirmation}) → FunctionNode -
Convenience wrapper matching Python's
node(...)helper. -
nodeRetryConfig(
BaseNode node) → RetryConfig? -
Returns the effective RetryConfig configured on
node, unwrapping ParallelWorker and nested Workflow agents if needed. -
parallelWorker(
Object nodeLike, {int? maxConcurrency, int? maxParallelWorkers, RetryConfig? retryConfig, Duration? timeout}) → ParallelWorker -
Wraps
nodeLikein a ParallelWorker. -
rerunsWhileWaiting(
Object node) → bool -
Whether a
waitForOutputnode with no recorded outcome runs again. -
validateNodeData(
Object? schema, Object? data) → Object? -
Validates and sanitizes node input
dataagainstschema. -
withRetryConfig(
BaseNode node, RetryConfig? retryConfig) → BaseNode -
Returns a copy of
nodewithretryConfigapplied.
Typedefs
-
WorkflowFunction
= FutureOr<
Object?> Function(WorkflowContext context, Object? nodeInput) - Function callback signature for FunctionNode.
- WorkflowRetryConfig = RetryConfig
- Retry configuration alias disambiguated for top-level barrel exports.
Exceptions / Errors
- DynamicNodeFailError
- Error thrown when a dynamic workflow node fails during execution.
- GraphValidationError
- Error thrown when a workflow graph fails static validation.
- NodeInterruptedError
- Exception thrown when a dynamic workflow node pauses for user input or an interrupt.
- NodeTimeoutError
- Error thrown when a node exceeds its timeout.
- WorkflowConfigurationError
- Error thrown when a workflow, node, or edge is configured invalidly.
- WorkflowDataError
- Error thrown when runtime workflow data does not match node expectations.
- WorkflowInvariantError
- Error thrown when an internal workflow runtime invariant is violated.