How strands-agents/samples works
Project Type & Purpose
• This is a “sample-code monorepo” showcasing how to build AI agents using the Strands Agents Python SDK.
• It contains:
– “01-getting-started/…”: notebook-driven tutorials (agent basics, AWS integration, guardrails, streaming, deployment).
– “02-samples/…”: standalone Python apps illustrating real-world use cases.
– Top-level infra: AWS CDK apps for Lambda and Fargate deployment.
File Structure
• Top-level:
– README, LICENSE, CONTRIBUTING, requirements.txt
• 01-getting-started: numbered tutorial folders, each with notebooks, helper scripts (cleanup, deploy_prereqs), and “prereqs” subfolders that contain Python scripts to seed DynamoDB, document files, and YAML configs.
• 02-samples: independent sample apps, each with a README, .env examples, Python source, utility modules, and requirements or pyproject files.
• Deployment patterns:
– 11-lambda-deployment & 12-fargate-deployment: AWS CDK in TypeScript, Dockerfiles, agent requirements, CloudFormation stacks.
README
• The project is a demo repo for the Strands Agents SDK.
• It links out to documentation, shows how to install the SDK, pick a model provider, build agents in four lines of code, and then explore tutorials or samples.
a. Main Components
1. Developer Workstation
• Jupyter Notebook Interface (for 01-getting-started)
• CLI / Python runtimes (for 02-samples apps)
2. Strands Agents Python SDK
• Core Agent engine
• Tool registry (calculator, current_time, python_repl, custom tools, knowledge_base scripts)
3. Model Provider Endpoint
• OpenAI API
• Ollama or other local LLM providers
4. External Services & Data Stores
• AWS DynamoDB (knowledge base)
• Optionally S3, other AWS services used in guardrails or observability
5. Deployment Infrastructure
• AWS CDK (TypeScript)
– Lambda stack (11-lambda-deployment)
– Fargate/ECS stack (12-fargate-deployment)
• Docker container for agent runtime (Fargate / Lambda)
6. Sample Application Layer
• Restaurant assistant, Scrum-master assistant, AWS-cost assistant, etc., each a standalone Python service
b. Relationships & Data Flows
1. Developer triggers Notebook or runs CLI script →
2. Notebook/Script calls the Agent API (Strands Agents SDK) →
3. Agent orchestrates:
– Sends prompt to Model Provider (HTTP request)
– Receives response (JSON containing next action or tool call)
– If tool call: invokes a local Python function or AWS service
• e.g., knowledge_base.py writes/reads DynamoDB
• calculator/current_time/python_repl run locally
– Loops until final answer, returns to user
4. For deployed scenarios:
– AWS CDK provisions DynamoDB, IAM roles, Lambda function or ECS service
– Docker image (with Strands Agents & prerequisites) is pushed to ECR
– Event/API Gateway triggers Lambda or directs traffic to Fargate
– The hosted agent runs the same call flow as above
c. Architectural Patterns & Principles
• Modular SDK + plugin tools (tool registry pattern)
• Notebook-driven learning path + standalone samples
• Infrastructure as Code (IaC) with AWS CDK
• Cloud-native deployments: serverless (Lambda) or container-based (Fargate)
• Separation of concerns:
– Agent orchestration vs. tool execution
– Core SDK vs. example code vs. deployment code
d. Key Technologies & Frameworks
• Python, Jupyter notebooks
• strands-agents (Python SDK)
• strands-agents-tools (prebuilt tools)
• AWS CDK (TypeScript)
• Docker, ECS Fargate, AWS Lambda, DynamoDB
• Model providers: OpenAI, Ollama, etc.