
Strands Agents SDK Explained: Build Your First AI Agent on AWS with a Real-World Shop Example
Learn what the Strands Agents SDK is, how an AI agent differs from a chatbot, and how to build a simple order-support agent in Python with custom tools and Amazon Bedrock, using an online shop example, with setup, code, testing and cost tips.
Introduction
A chatbot answers questions from what it already knows. An AI agent goes further: it can decide to use tools, such as looking up an order, doing a calculation or calling an API, and then use the results to answer.
Strands Agents is an open-source SDK from AWS that makes building agents simple. It takes a model-driven approach to building and running AI agents. In plain words, you give the model a goal and a set of tools, and the model decides which tool to use and when.
Chatbot vs agent
| Chatbot | Agent | |
|---|---|---|
| Answers from | Its training knowledge | Knowledge plus live tools |
| Can take actions | No | Yes (look up data, call APIs, run code) |
| Example | "What is a refund?" | "Where is my order 1042, and can I still cancel it?" |
Real-time example: an online shop support agent
Imagine our online shop from the earlier posts. Customers keep asking:
- "Where is my order?"
- "How much is 3 shirts at ₹799 with 10% off?"
A normal chatbot would guess. Our agent will have two tools:
get_order_status: looks up an ordercalculator: does the maths correctly
The model reads the question, picks the right tool, and writes a clear answer.
What you need
- An AWS account with a budget alert set
- Python 3.10 or newer
- AWS credentials configured (for example with
aws configure) - Access to a model enabled in the Amazon Bedrock console
By default, the SDK uses Amazon Bedrock as the model provider, so you need AWS credentials and model access enabled. The default model has changed between versions, so check the current Strands docs and enable that model in your Region.
Step 1: Install
1
2
3
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install strands-agents strands-agents-toolsThe
strands-agents-tools package provides ready-made example tools such as a calculator.Step 2: Create your first agent
1
2
3
4
5
6
from strands import Agent
from strands_tools import calculator
agent = Agent(tools=[calculator])
agent("What is the total for 3 shirts at 799 rupees each with a 10% discount?")Run it:
1
python agent.pyThe agent uses the calculator tool instead of guessing the maths.
Step 3: Add your own tool
You can build a tool from a Python function with the
@tool decorator. The function's docstring matters, because the model reads it to understand when to use the tool.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from strands import Agent, tool
from strands_tools import calculator
# A fake order database for the demo
ORDERS = {
"1042": {"status": "Shipped", "eta": "2 days"},
"1043": {"status": "Processing", "eta": "5 days"},
}
def get_order_status(order_id: str) -> str:
"""Look up the status of a customer order.
Args:
order_id: The order number, for example 1042.
"""
order = ORDERS.get(order_id)
if not order:
return "Order not found."
return f"Order {order_id} is {order['status']}. Estimated delivery: {order['eta']}."
agent = Agent(
system_prompt=(
"You are a friendly support agent for an online clothing shop. "
"Use the tools to answer. If an order is not found, say so politely."
),
tools=[get_order_status, calculator],
)
agent("Where is my order 1042?")
agent("If I buy 3 shirts at 799 rupees with 10% off, what do I pay?")What happens behind the scenes
- You ask a question.
- The model reads the tool descriptions and decides which tool fits.
- Strands runs the tool and sends the result back to the model.
- The model writes the final answer in natural language.
This repeating cycle of think, act and observe is the agent loop.
Step 4: Connect real data
In production, replace the fake
ORDERS dictionary with a real lookup, such as a DynamoDB table:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import boto3
table = boto3.resource("dynamodb", region_name="ap-south-1").Table("Orders")
def get_order_status(order_id: str) -> str:
"""Look up the status of a customer order.
Args:
order_id: The order number.
"""
item = table.get_item(Key={"orderId": order_id}).get("Item")
if not item:
return "Order not found."
return f"Order {order_id} is {item['status']}."Change the table name, key and region to match yours. Give the code an IAM role with read-only access to just that table, and don't store access keys in code.
Where can it run?
For learning, run it on your laptop. For production, common options are:
- AWS Lambda for short, event-driven requests
- ECS Fargate or EC2 for always-on services
- Amazon Bedrock AgentCore for hosting agents. This is a newer AWS service, so check its current docs and pricing.
Why developers like Strands
- Simple: a working agent takes a few lines
- Model-driven: the model plans the steps, so you write less control logic
- Many providers: different model providers can be configured, not only Bedrock
- Python and TypeScript: both SDKs are available
- Open source: you can read the code and contribute
Safety and cost tips
- Limit tool permissions. An agent can only do what its tools allow, so give each tool the smallest access it needs.
- Be careful with powerful tools such as shell or file editing. Don't give them to an agent that talks to the public.
- Validate inputs inside your tools, because the model may pass unexpected values.
- Watch usage costs. Each question can involve several model calls, so set a budget and a Bedrock usage alarm.
- Test with unusual questions to see how the agent behaves when a tool fails.
Cleanup
- Delete any test DynamoDB tables, Lambda functions or other resources you created
- Remove unused IAM roles and access keys
- Check Billing → Cost Explorer the next day
Key takeaways
- An agent is a model plus tools, and it decides which tool to use
- Strands Agents lets you build one in a few lines of Python
- Custom tools are just Python functions with a clear docstring
- Start small, give tools minimal permissions, and watch your costs
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article