First linear workflow

This walkthrough runs a multi-step linear pipeline with the Python SDK and stub provider. You define ordered agents, call run(), and confirm completion through status fields and trace events. No server, Postgres, or API keys are required.

What this example demonstrates

A linear workflow chains agents in fixed order: each step receives the prior step output as context. The pattern matches Track A and production pipelines where routing is not conditional. The runnable script is First linear workflow walkthrough: research, write, then SEO review on one topic string.

Prerequisites

ItemValue
SDKPython SDK built per installation
ProviderDefault stub (no OPENAI_API_KEY required)
InfrastructureNone for embedded SDK
Tutorial trackTrack A

Step 1: Inspect the script

Open First linear workflow walkthrough. It registers three agents and three ordered steps:

python
from arcflow import Agent, Workflow

researcher = Agent(name="researcher", role="researcher", instructions="Collect topic facts.")
writer = Agent(name="writer", role="writer", instructions="Draft a blog post.")
seo = Agent(name="seo", role="seo", instructions="Suggest title and meta description.")

wf = (
 Workflow("blog_pipeline")
.step(researcher)
.step(writer)
.step(seo)
)
result = wf.run("Write about context assembly in agent workflows")
print(result.output)

For a two-step variant identical to Track A, see Track A.

Step 2: Run from repository root

bash
python examples/personal/blog_pipeline.py

Step 3: Verify run outcome

Append checks or run interactively:

python
assert result.step_count == 3
assert result.status == "completed"
assert len(result.output) > 0
assert result.run_id
print("linear workflow checks passed")
FieldExpected
step_count3
statuscompleted (SDK lowercase)
run_idUUID string
outputNon-empty string

Step 4: Verify trace events

python
kinds = {e.get("event_kind") for e in result.trace_events}
required = {"WorkflowStarted", "StepCompleted", "WorkflowCompleted"}
missing = required - kinds
if missing:
 raise SystemExit(f"missing trace kinds: {missing}")
print("trace kinds ok:", sorted(kinds))

Optional structured trace:

python
trace = wf.trace()
assert trace.run_id == result.run_id
assert len(trace) == 3
print(trace.summary())

Expected output

Terminal output includes stub-generated blog text (content varies by version). You should also see three completed steps when printing result.step_count and a UUID when printing result.run_id. Exact prose is not part of pass criteria; structure is.

Example shape (values will differ):

[stub blog draft and SEO suggestions...]

When you add the verification block, expect linear workflow checks passed and trace kinds ok: [...].

Trace events you should see

Event kindWhen
WorkflowStartedRun begins with workflow name and step count
StepStartedEach of the three agents begins
StepCompletedEach agent finishes (three times)
WorkflowCompletedAll steps succeed

Events are metadata only per trace data policy. See trace event reference.

Troubleshooting

SymptomLikely causeFix
ImportError: arcflowSDK not installed in active venvRun maturin develop in sdk-python/
WorkflowConfigurationErrorEmpty agent name or invalid step orderMatch field names in the example script
Empty trace_eventsStale native bindingRebuild the Python extension
step_count not 3Edited script removed a stepRestore three .step() calls
ResourceLink
Minimal two-step tutorialTrack A
Linear workflow guideLinear workflows
Examples catalogcatalog.md