Linear workflows
Linear execution is the default path for multi-agent pipelines where each step runs in a fixed order. You set execution_mode: "linear" on the workflow, assign each step an order integer, and the engine sorts and runs them sequentially. Output from earlier steps can flow into later agents through context policies and shared memory.
If you have not run a workflow yet, start with First workflow in five minutes. For the shared execution concepts (state machine, recovery, test mode), see Execution model.
When linear mode fits
Linear mode works well when the task decomposes into a single path: research then write, extract then classify, or a fixed chat pipeline with two or three agents. You do not need conditional branches or parallel fan-out. When routing depends on step output, switch to Graph workflows.
Engine entry: WorkflowEngine::execute_with_config branches to run_sorted_steps for linear workflows.
workflow specification structure
A linear workflow is a WorkflowDefinition with execution_mode: "linear", a steps array, and graph: null. Each StepDefinition references an agent by UUID and carries an order field used only for sorting (not for graph routing).
| Field | Role |
|---|---|
id, name | Stable identity and trace labels |
execution_mode | Must be "linear" |
steps | List of steps; sorted by order ascending |
graph | Absent or null for linear mode |
retry_policy | Optional workflow-level retry (see Retry and backoff) |
Example two-step research pipeline:
Agents referenced by agent_id must appear in the run request agents array or be embedded in the workflow bundle. See Defining agents for agent fields.
State handoff between steps
The runtime passes prior step output to downstream agents according to each agent's context policy. Defaults include include_prior_steps: "last", include_run_input: true, and max_prior_step_chars: 4096. Shared memory (memory_type: "shared") lets agents read and write a namespace within the same run without relying on prompt injection alone.
Python SDK example
After installing the Python SDK:
Server API example
With Server API quickstart prerequisites (Postgres, migrations, API key):
POST to /v1/runs with Authorization: Bearer <ARCFLOW_SERVER_API_KEY>. Poll GET /v1/runs/{run_id} until status is terminal.
Trace events to expect
A successful linear run typically emits:
Traces are metadata-only per Trace data policy.
Recovery
When exec_config.recovery_enabled is true, linear progress persists to Postgres after each committed step. On resume, the engine continues from the last committed step index (WorkflowRecoveryStarted, WorkflowRecoveryCompleted). Linear recovery is production-ready. See Recovery and resume.
Optional resilience
| Mechanism | Config location | Guide |
|---|---|---|
| Step fallback | fallback_step_id on step | Step fallbacks |
| Retry | exec_config.retry, step retry_policy | Retry and backoff |
| Timeouts | workflow_timeout_secs, step_timeout_secs | Timeouts |
| Validation | Schema + engine validate | Validation and testing |
Related pages
- Graph workflows for conditional routing and joins
- Workflow specification for type definitions
- Python quickstart and TypeScript quickstart