A fixed pipeline — nodes execute in the order you define, no surprises.
mode: graphinorchestrations:— a deterministic DAG with explicit edgesedges:list — each edge is afrom: -> to:pair that locks in execution orderentry_name:— the starting node (must have no incoming edges)- The difference between graph and swarm: you decide the order, not the agents
A graph pipeline executes nodes in topological order. The output of each node is passed as context to the next.
content_strategist ──▶ content_writer ──▶ copy_editor
In YAML, edges are explicit from: / to: pairs:
orchestrations:
blog_pipeline:
mode: graph
entry_name: content_strategist
edges:
- from: content_strategist
to: content_writer
- from: content_writer
to: copy_editorThat's it — three agents, two edges, one pipeline. strands-compose builds the DAG and runs each node in sequence.
Graph vs Swarm vs Delegate. Use graph when the execution order is fixed and known upfront — e.g. content pipelines, multi-stage validation, ETL. Use swarm for collaborative back-and-forth. Use delegate for a coordinator that picks tools on the fly.
Nodes at the same depth can run in parallel. If two nodes share no dependency, strands executes them concurrently — but that's handled for you.
Conditional edges are supported too — see example 13 for that.
- AWS credentials configured (
aws configureor environment variables) - Dependencies installed:
uv sync
uv run python examples/09_graph/main.pyWrite a blog post about why Rust is gaining popularity among Python developers.Create a post about the importance of code review in software teams.Write about how large language models are changing software development.
Strands agents log actions to the console through their default callback_handler.
If you want cleaner example output, set the handler to null in agent_kwargs for any agent:
agents:
my_agent:
agent_kwargs:
callback_handler: null # or ~