Strands Agents on AWS
A Bedrock agent with internet access covers the smallest useful agent: one model, one tool, one loop. This is what happens when there is more than one agent, read from aobao32/strands-agents-getting-started — eight runnable lessons from a single tool call up to swarms and graphs.
The SDK is AWS's own, and
BedrockModel is its default. That makes the interesting question not "does this work on AWS" but which of its four multi-agent shapes should be an AWS service instead.The four shapes, and who decides
shape | who decides the next step | topology |
|---|---|---|
agent-as-tool | the orchestrating model | a star — one agent calls specialists |
Swarm | the agents themselves, by handoff | a mesh — anyone to anyone |
Graph | you, at build time | a DAG you declare |
Workflow | you, as ordered tasks | a sequence |
That column is the whole decision. Three of the four hand control to a model; one keeps it. Everything below follows from which you picked.
Agent-as-tool: the star
orchestrator = Agent( model=bedrock_model, system_prompt=MAIN_SYSTEM_PROMPT, tools=[research_assistant, product_recommendation_assistant, trip_planning_assistant],)An agent is just a tool to the agent above it. The routing lives in the system prompt — "for research questions → use the research_assistant tool" — so routing quality is prompt quality, and it degrades the way prompts degrade: gradually, and only under inputs you did not test.
The tutorial's prompt contains one instruction worth stealing:
如果你使用某个一个工具失败,请把那个 tool 直接的报错信息返回给用户,而不是尝试用其他工具回答。 (If a tool fails, return that tool's error to the user rather than trying to answer with a different tool.)
That is a real lesson encoded as a prompt line. Without it, a model whose tool errors will route around the failure and answer anyway — producing a confident answer assembled from the wrong specialist, with nothing in the logs marking it as degraded.
Swarm: and what its parameters admit
swarm = Swarm( [researcher, coder, reviewer, architect], max_handoffs=20, max_iterations=20, execution_timeout=900.0, # 15 minutes node_timeout=300.0, # 5 minutes per agent repetitive_handoff_detection_window=8, repetitive_handoff_min_unique_agents=3,)Six of those seven arguments exist to stop it looping. That is the most informative thing in the whole repository: the SDK ships loop detection in the constructor, not as an optional guard, because agents handing off to each other autonomously is a loop generator. The last two are the giveaway — they require at least 3 distinct agents in any 8 consecutive handoffs, which is a direct defence against two agents bouncing a task between themselves forever.
Use a Swarm when you genuinely cannot predict the order of work. Accept that you are buying an unbounded number of model calls with a timeout as the only hard stop, and that
execution_timeout=900 is a bill as much as a limit.Graph: you declare the topology
builder = GraphBuilder()builder.add_node(researcher, "research")builder.add_node(analyst, "analysis")builder.add_node(fact_checker, "fact_check")builder.add_node(report_writer, "report")
builder.add_edge("research", "analysis") # fan outbuilder.add_edge("research", "fact_check")builder.add_edge("analysis", "report") # joinbuilder.add_edge("fact_check", "report")builder.set_entry_point("research")Fan out to two independent agents, join their results into a third. No model decides the order — you did, and it is the same graph every run.
The one that should probably be Step Functions
A Strands
Graph is a DAG executed in one process, in memory, with no durability. Read that against the AWS service whose entire job is durable DAG execution: | Strands Graph | Step Functions |
|---|---|---|
where it runs | in your process | AWS-managed |
max duration | your process's lifetime | 1 year |
a node fails at minute 40 | the run is gone | resume from that state |
retry semantics | yours to write | declarative, per state |
execution history | your logs, if you kept them | every execution, visually, for free |
parallel branches | yes | yes, with Map and Parallel |
a human approving mid-run | build it | a task token, natively |
If your topology is fixed, Step Functions already does this and survives process death. The pattern that gets the best of both: each node is a Strands agent (possibly with its own tools), and the graph between nodes is a Step Functions state machine. You keep Strands where it is strong — one agent, its tools, its loop — and stop hand-rolling durable orchestration, which is what the app-definition layer argues about pipelines generally.
Keep the Graph in-process when the whole run is seconds, failure means "just run it again", and the operational weight of a state machine is not worth it. That is a real case; it is just not the one people assume.
The cost shape nobody budgets for
Every handoff and every node transition re-sends the accumulated context to the model. A four-agent Swarm that takes eleven handoffs does not cost eleven calls' worth of tokens — it costs the running sum, because turn eleven carries turns one through ten.
Three consequences:
- Cost is roughly quadratic in handoffs, not linear.
max_handoffs=20is therefore a spend ceiling, and the most important number in the constructor.
- Prompt caching is the mitigation, and you cannot tell whether it helped — which is why a wish in this repository asks Bedrock to report what a cache actually saved.
- A Graph is cheaper than a Swarm for the same work, because a declared DAG visits each node once and a mesh may revisit.
The AWS details in the code
bedrock_model = BedrockModel( model_id="us.anthropic.claude-sonnet-4-20250514-v1:0", region_name="us-west-2",)That
us. prefix is a cross-region inference profile, not a typo. It lets Bedrock serve the request from any region in the US group, which is how you get throughput without provisioned capacity — and it also means the request may be processed outside us-west-2 . If you have a data-residency requirement, the prefix is the thing to remove, and the failure mode of removing it is throttling rather than an error.Two more, from the lessons either side of the multi-agent ones:
- MCP over both HTTP and stdio (
02-mcp-client). stdio means a subprocess on the same host — no network boundary, no authentication, and the trust model of "whatever that binary does". HTTP puts a real boundary there. MCP security on AWS works through what each costs.
- A2A server and client (
03-,04-) — agents addressing each other over a protocol rather than in-process. That is when identity stops being theoretical, and on AWS it wants IAM at the boundary, not a shared secret.
Verified, and not
Read, not run. Every code excerpt is from the repository as published; the parameter names, the
us. model id and the graph edges are quoted rather than reconstructed. Nothing was executed: no agent was run, no Bedrock call made, and no cost or latency measured here.The repository has no LICENSE file. GitHub reports no licence, which in the absence of one means all rights reserved — you may read it, and you do not have a grant to reuse the code. That matters if you were planning to lift a module rather than learn from it. The Strands SDK itself is Apache-2.0; this tutorial around it is not licensed.
Not verified, and load-bearing. The claim that a Strands
Graph has no durability across process death is inferred from it being an in-process GraphBuilder with no persistence argument, not from documentation stating it. It is the premise of the Step Functions recommendation, so test it — kill the process mid-graph and see whether anything can resume — before moving a long-running topology onto either.Dated. The repo was last pushed 2025-11-04 and the SDK moves quickly.
Swarm and GraphBuilder signatures are the most likely to have changed.Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article