Flows
A Flow is one execution run driven by a set of Goal Steps. Covers the lifecycle (active, terminal, deactivated), how state advances, and how Flows compose through sub-flow Steps.
What is a Flow?
A Flow is one execution run. You specify Goal Steps and initial values, then Argyll plans and executes the work needed to reach those Goals. The same Flow definition can be executed many times with different inputs.
Flow Execution
When you start a Flow:
- You provide the Goal Steps you want to achieve
- You provide initial state values
- Argyll plans what work is required
- Argyll executes Steps in parallel where possible
- Results are stored in committed state
- The Flow advances based only on what it already knows
Flow Lifecycle
A Flow moves through three phases:
Active: Steps are running, events are being recorded, the Flow is progressing toward its Goals.
Terminal (completed or failed): The outcome is decided and callers can use it immediately. Either all Goal Steps succeeded, or one failed. No new Steps will start. However, work that has already started may still produce side effects (changes to external systems) and report results, and compensation may still run after failure. This is intentional: the audit trail stays complete even after the outcome is known.
Deactivated: Terminal and no pending, active, or compensating work remains. No further work or compensation can produce side effects. Its event log is complete and cannot gain further Flow activity.
The full Flow state reports completed or failed as soon as the terminal event is committed; use it or terminal flow events when callers must act on the outcome immediately. The lightweight status and query indexes remain active until the Flow is deactivated, then report completed or failed; they report final status only after remaining work can no longer produce side effects.
Flow State
Every Flow has explicit state that you can inspect at any time:
- What Steps have executed and what status they reached
- What outputs each Step produced
- What Steps are still pending
- Why the Flow is in its current state
Reusable Flows
Flows can be packaged as Sub-Flow Steps. This lets you compose complex Flows from simpler ones. A Sub-Flow Step targets a specific set of Goals and maps its outputs back to parent Flow Attributes.