Public API
This page organizes the Flow 1.1 Rust surface by use case. Refer to docs.rs for exhaustive signatures, fields, and Rustdoc.
Feature flags
A minimal Rust host may disable default features.
Engine construction
FlowEngine is cloneable and shares runtime and store through Arc. Public runtime, store, queue, and observer traits require Send + Sync.
Start and drive runs
start_with_id() redelivery succeeds only with identical definition and input. Changes to name, version, runtime, entrypoint, runtime build, patch markers, accepted signals, or input return RunConflict.
Inspection
Large production queries should use SQL projections and control-plane pagination. list_snapshots() reads many histories and does not fit an unbounded hot path.
External input and control
Token lookup covers active hooks only. Reliable redelivery stores the run and hook IDs returned by first resolution.
FlowRuntime
WorkflowInvocation exposes run ID, definition, initial input, and complete history. context() returns WorkflowContext for projection queries and command construction.
StepInvocation exposes run ID, step ID, step name, input, and history. Keep physical side effects in run_step().
WorkflowContext queries
Typed reads deserialize with Serde and return FlowError instead of panicking.
WorkflowContext commands
One run_workflow() call returns one RuntimeCommand.
Definition and policy types
Snapshots and outcomes
Primary read-only projections include WorkflowRunSnapshot, StepSnapshot, WaitSnapshot, HookSnapshot, SignalWaitSnapshot, ChildWorkflowSnapshot, and ScheduledWakeup.
WorkflowRunStatus expresses current lifecycle. WorkflowTerminalOutcome expresses the final typed result. Public enums are #[non_exhaustive], so matches need fallback arms.
Stores
Production PostgreSQL migration uses migrate_postgres_flow(), followed by verified serving constructors.
Scheduling and tasks
FlowWorker fits embedded queues. Production hosts generally use task management that owns lifecycle consistently.
Observation
FlowEventObserver receives envelopes after commit. Built-in implementations include NoopFlowEventObserver, InMemoryFlowEventObserver, FanoutFlowEventObserver, and the local JSONL sink.
A3sFlowEvent is a low-cardinality event projection. safe_metric_labels() returns metric-safe fields only. Observation failure cannot change committed workflow history.
Workflow graph
Error handling
The crate returns a3s_flow::Result<T> with FlowError. Production code usually handles these categories separately.
Do not retry every error blindly. Nondeterminism, identity conflicts, and build admission require a code, route, or caller-identity correction.
