Skip to content

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build a Production AI Agent: Strands Agents Hands-On Workshop

Build a production-ready customer service AI agent from scratch with the Strands Agents SDK — the open-source agent harness SDK — adding tools, guardrails, memory, multi-agent delegation, evals, and deployment to Amazon Bedrock AgentCore one module at a time.

Strands Agents Python Amazon Bedrock License MIT-0

This sample works with Strands Agents and Amazon Bedrock AgentCore. Code in this repository is provided "as is" and is not officially supported by Amazon.


What you'll build

A single customer service agent that grows across 7 modules. Each module is a self-contained notebook (12–15 min) that adds one production capability — starting from a bare agent loop and ending with a deployed agent on AgentCore Runtime. Total time: about 90 minutes.

What is an agent harness?

An agent harness is the system that lets an agent actually run: the orchestration loop that calls the model, decides which tool to invoke, passes results back, manages the context window, and handles failures — plus the infrastructure underneath it (compute, a code sandbox, secure tool connections, persistent storage, memory, identity, and observability).

Strands Agents is the open-source agent harness SDK — you don't just write a prompt, you build and control the whole harness (the loop, tools, hooks, memory, guardrails) end-to-end. This workshop builds it layer by layer and then deploys an agent to Amazon Bedrock AgentCore Runtime as the hosting layer:

Stage What you do With
Build the harness Assemble the loop, tools, hooks, skills, and memory — controlling each layer Strands Agents (Modules 1–4)
Run the harness Operate the same harness in production — managed compute, memory, identity, observability Amazon Bedrock AgentCore Runtime (Module 5)
Go further (optional) Add multi-agent delegation and automated evals on top of the deployed agent Strands Agents (Modules 6–7)

Because the harness is config-driven, trying a different model or adding a tool is a config change, not a code rewrite.

Modules

# Module Time What you'll build
1 Agent Loop + Tools 12 min Customer service agent with lookup, orders, and refund tools
2 Hooks 10 min Rate limiter that caps runaway tool calls with deterministic code
3 Skills + Steering 15 min Workflow skills, refund enforcement, and a tone guardrail
4 Session Managers 10 min Persistent memory that survives restarts
5 Deploy 15 min Deployment to Amazon Bedrock AgentCore Runtime
6 Multi-Agent (optional) 15 min Delegation to a tech support specialist agent
7 Evals (optional) 13 min Automated quality testing with LLM-as-judge

Shared mock tools used across modules live in samples/shared/.


How do I get started?

The fastest path is to open Module 1 and run the notebook cells top to bottom. Each module's README explains the concept and links to the next.

# Clone the repo
git clone https://github.com/aws-samples/sample-strands-agents-hands-on-workshop.git
cd sample-strands-agents-hands-on-workshop

Then open samples/01-agent-loop-tools/ in VS Code or JupyterLab and run the notebook.

How do I set up the environment?

This workshop runs in a hosted VS Code environment with dependencies pre-installed. To run locally:

# Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install dependencies (or use each module's requirements.txt)
pip install strands-agents strands-agents-evals bedrock-agentcore

# Configure AWS credentials (Strands uses Amazon Bedrock by default)
aws configure

Each module also ships its own requirements.txt, so you can install only what that module needs.

Module 5 (Deploy) also needs the AgentCore CLI (Node.js 20+). A global install needs root, so use sudo:

sudo npm install -g @aws/agentcore

If you previously installed bedrock-agentcore-starter-toolkit, uninstall it (pip uninstall bedrock-agentcore-starter-toolkit) - it ships an older agentcore CLI that conflicts with this one.

What are the prerequisites?

Requirement Detail
Python 3.10 or higher
AWS credentials Amazon Bedrock model access for Claude Sonnet 4
Deploy module (Module 5) Node.js 20+, the @aws/agentcore CLI, uv, and AWS CDK; provisions an AgentCore Runtime + Amazon S3 staging via CloudFormation

How does the agent loop work?

The agent loop cycles between the LLM and your tools until the model has enough information to answer: User → LLM → Tool Call → Tool Result → LLM → Response. Tools are plain Python functions decorated with @tool, and the LLM reads each docstring to decide when to call them — no manual routing required.

from strands import Agent, tool

@tool
def lookup_customer(customer_id: str) -> str:
    """Look up a customer by their ID."""
    ...

agent = Agent(tools=[lookup_customer], system_prompt=SYSTEM_PROMPT)
agent("I'm C-1001. What are my recent orders?")

See Module 1 for the full walkthrough and an inspection of the loop in action.


Frequently asked questions

Do I need to complete the modules in order? Work through Modules 1–5 in order — each builds on the previous one, ending with the agent deployed to AgentCore Runtime. Modules 6 (Multi-Agent) and 7 (Evals) are optional extensions on the same agent; take them in any order, or skip them.

Which Claude model does this use? The modules default to Claude Sonnet 4 via Amazon Bedrock. You need Bedrock model access enabled in your AWS account.

Can I run this locally without AWS credentials, using Ollama? Yes. Install Ollama, pull a model that supports tool use, install the Strands Ollama extra, then pass OllamaModel to Agent(...):

# 1. Install Ollama (macOS: download DMG from ollama.com; Linux: curl below; Windows: installer from ollama.com/download/windows)
curl -fsSL https://ollama.com/install.sh | sh   # Linux only

# 2. Pull a model with tool/function-calling support
ollama pull llama3.1   # recommended — widely tested with tool use

# 3. Install the Strands Ollama extra
pip install strands-agents[ollama]
from strands import Agent
from strands.models import OllamaModel

model = OllamaModel(host="http://localhost:11434", model_id="llama3.1")
agent = Agent(model=model, tools=[...], system_prompt=...)

Other models with tool support: llama3.2, qwen2.5, qwen3, mistral. See the Ollama model library for the full list. Each notebook and chat.py includes a commented example.

I'm using AWS-provided credits from a sponsored event — how do I use them? AWS credits issued for hackathons and workshops only cover Amazon Nova models, not Claude. To switch any agent to Nova, import BedrockModel and pass it to Agent(...):

from strands.models import BedrockModel

model = BedrockModel(model_id="amazon.nova-pro-v1:0")
agent = Agent(model=model, tools=[...], system_prompt=...)

Available Nova model IDs — see the Amazon Bedrock model cards for the full list:

Model ID Description
amazon.nova-micro-v1:0 Fastest, text-only, lowest cost
amazon.nova-lite-v1:0 Low-cost, multimodal (text, image, video)
amazon.nova-pro-v1:0 Balanced accuracy/speed, multimodal (recommended)

Each notebook and chat.py file includes a commented example showing exactly where to make this change.

What is the difference between an agent framework and an agent harness? A framework gives you the orchestration loop (model calls, tool selection, context). A harness is the full system that lets the agent run: the loop plus compute, a code sandbox, tool connections, memory, identity, and observability.

Can I use a framework other than Strands Agents? The patterns shown here — tool use, hooks, session memory, multi-agent handoff, and LLM-as-judge evals — can be applied to any agent harness. This workshop implements the patterns with the Strands Agents SDK.

How long does the full workshop take? About 90 minutes for all 7 modules. Each module is self-contained and takes 10–15 minutes.

Do I need AWS resources to run the early modules? You need Amazon Bedrock access from Module 1. Additional services (Amazon Bedrock AgentCore Runtime, Amazon S3) are only required for the deployment module (Module 5).


Resources


Contributing

Contributions are welcome! See CONTRIBUTING for more information.


Security

If you discover a potential security issue in this project, notify AWS/Amazon Security via the vulnerability reporting page. Please do not create a public GitHub issue.


License

This library is licensed under the MIT-0 License. See the LICENSE file for details.

About

Hands-on workshop to build a production AI agent with Strands Agents, tools, hooks, memory, multi-agent, evals, and deploy to Amazon Bedrock AgentCore.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors