Technical Documentation: strands-agents/sdk-python
โน๏ธ Provenance: Hybrid Fusion: strands-agents/sdk-python (README + 3 In-Tree Chapters) ยท CodeWiki Reference ยท Recency: Active (< 180 days)1. Project Overview & Quickstart (strands-agents/sdk-python)
<div align="center">
<div>
<a href="https://strandsagents.com">
<img src="https://strandsagents.com/latest/assets/logo-github.svg" alt="Strands Agents" width="55px" height="105px">
</a>
</div>
<h1>
Strands Agents
</h1>
<h2>
A model-driven approach to building AI agents in just a few lines of code.
</h2>
<div align="center">
<a href="https://github.com/strands-agents/harness-sdk/graphs/commit-activity"><img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/strands-agents/harness-sdk"/></a>
<a href="https://github.com/strands-agents/harness-sdk/issues"><img alt="GitHub open issues" src="https://img.shields.io/github/issues/strands-agents/harness-sdk"/></a>
<a href="https://github.com/strands-agents/harness-sdk/pulls"><img alt="GitHub open pull requests" src="https://img.shields.io/github/issues-pr/strands-agents/harness-sdk"/></a>
<a href="https://github.com/strands-agents/harness-sdk/blob/main/LICENSE.APACHE"><img alt="License" src="https://img.shields.io/github/license/strands-agents/harness-sdk"/></a>
<a href="https://pypi.org/project/strands-agents/"><img alt="PyPI version" src="https://img.shields.io/pypi/v/strands-agents"/></a>
<a href="https://www.npmjs.com/package/@strands-agents/sdk"><img alt="npm version" src="https://img.shields.io/npm/v/%40strands-agents%2Fsdk"/></a>
<a href="https://python.org"><img alt="Python versions" src="https://img.shields.io/pypi/pyversions/strands-agents"/></a>
<a href="https://discord.gg/strands"><img alt="Strands Discord" src="https://img.shields.io/badge/Discord-Strands-5865F2?logo=discord&logoColor=white"/></a>
</div>
<p>
<a href="https://strandsagents.com/">Documentation</a>
โ <a href="https://github.com/strands-agents/samples">Samples</a>
โ <a href="https://github.com/strands-agents/tools">Tools</a>
โ <a href="https://github.com/strands-agents/harness-sdk/tree/main/strands-mcp">MCP Server</a>
</p>
</div>
Strands Agents is a simple yet powerful SDK that takes a model-driven approach to building and running AI agents. From simple conversational assistants to complex autonomous workflows, from local development to production deployment, Strands Agents scales with your needs.
This monorepo contains the Python SDK, TypeScript SDK, documentation site, and supporting packages:
| Directory | Description |
|-----------|-------------|
| strands-py/ | Python SDK: agent loop, model providers, tools (PyPI ยท releases) |
| strands-ts/ | TypeScript SDK: agent loop, model providers, tools (npm ยท releases) |
| site/ | Source for the strandsagents.com documentation site (Astro/Starlight) |
| team/ | Governance and cross-SDK process docs (tenets, decisions, PR & compatibility guidelines, and designs/ proposals) |
Why Strands
Build an agent harness. Control it end-to-end.
- Build your way. Any model, any cloud. Context management, execution limits, and observability built in before you write a line of config. Swap backends when you scale; your code stays the same.
- Model agnostic. First-class support for Amazon Bedrock, Anthropic, OpenAI, and Gemini, plus many more providers and custom ones.
- Stay in control. The agent loop traces every decision by default. Hooks let you intercept any step to log it, validate it, or redirect it.
- Deliver outcomes that work. Guardrails catch mistakes before they run. Steering handlers let agents correct themselves instead of failing silently.
MCP, streaming, multi-agent patterns, and structured output are all built in.
Quick Start
Both SDKs default to the Amazon Bedrock model provider, so you'll need AWS credentials configured and model access enabled for Claude Sonnet. The Quickstart Guide covers configuring other providers (Anthropic, OpenAI, Gemini, Ollama, and more).
Python
Requires Python 3.10+:
pip install strands-agents strands-agents-toolsfrom strands import Agent
from strands_tools import calculatoragent = Agent(tools=[calculator])
agent("What is the square root of 1764")
The Python SDK README covers tools, model providers, MCP, and bidirectional streaming.
TypeScript
Requires Node.js 20+:
npm install @strands-agents/sdkimport { Agent } from '@strands-agents/sdk'const agent = new Agent()
const result = await agent.invoke('What is the square root of 1764?')
console.log(result)
More in the TypeScript SDK README, including Zod-typed tools, structured output, and multi-agent patterns.
Documentation
For detailed guidance & examples, explore our documentation:
- User Guide
- Quick Start Guide
- Agent Loop
- Examples
- API Reference: Python ยท TypeScript
- Production & Deployment Guide
The docs themselves live in this monorepo under site/, and doc PRs are welcome alongside code changes.
Development
Git operations (commits, branches, PRs) are done from the repo root. Each package has its own toolchain:
Python SDK (strands-py/):
cd strands-py
pip install hatch
hatch test # run unit tests
hatch fmt # format & lintTypeScript SDK (strands-ts/):
npm ci # install from repo root
npm run build # build
npm test # run unit testsDocumentation site (site/):
cd site
npm install
npm run dev # local dev server at http://localhost:4321/Contributing โค๏ธ
We welcome contributions! See our Contributing Guide for details on:
- Reporting bugs & features
- Development setup
- Contributing via Pull Requests
- Code of Conduct
- Reporting of security issues
Stay in touch with the team
Come meet the Strands team and other users on Discord
License
This project is licensed under the Apache License 2.0 - see the LICENSE.APACHE file for details.
Security
See CONTRIBUTING for more information.
2. In-Tree Documentation Chapters (strands-agents/sdk-python)
CONTRIBUTING
Contributing Guidelines
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution.
Reporting Bugs/Feature Requests
We welcome you to use the Bug Reports file to report bugs or Feature Requests to suggest features.
For a list of known bugs and feature requests:
- Check Bug Reports for currently tracked issues
- See Feature Requests for requested enhancements
When filing an issue, please check for already tracked items
Please try to include as much information as you can. Details like these are incredibly useful:
* A reproducible test case or series of steps
* The version of our code being used (commit ID)
* Any modifications you've made relevant to the bug
* Anything unusual about your environment or deployment
Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute to. We label issues that are well-defined and ready for community contributions with the "ready for contribution" label.
Check our Ready for Contribution issues for items you can work on.
Before starting work on any issue:
1. Check if someone is already assigned or working on it
2. Comment on the issue to express your interest and ask any clarifying questions
3. Wait for maintainer confirmation before beginning significant work
Development Tenets
Our team follows these core principles when designing and implementing features. These tenets help us make consistent decisions, resolve trade-offs, and maintain the quality and coherence of the SDK. When contributing, please consider how your changes align with these principles:
1. Simple at any scale: We believe that simple things should be simple. The same clean abstractions that power a weekend prototype should scale effortlessly to production workloads. We reject the notion that enterprise-grade means enterprise-complicated - Strands remains approachable whether it's your first agent or your millionth.
2. Extensible by design: We allow for as much configuration as possible, from hooks to model providers, session managers, tools, etc. We meet customers where they are with flexible extension points that are simple to integrate with.
3. Composability: Primitives are building blocks with each other. Each feature of Strands is developed with all other features in mind, they are consistent and complement one another.
4. The obvious path is the happy path: Through intuitive naming, helpful error messages, and thoughtful API design, we guide developers toward correct patterns and away from common pitfalls.
5. We are accessible to humans and agents: Strands is designed for both humans and AI to understand equally well. We donโt take shortcuts on curated DX for humans and we go the extra mile to make sure coding assistants can help you use those interfaces the right way.
6. Embrace common standards: We respect what came before, and do not want to reinvent something that is already widely adopted or done better.
When proposing solutions or reviewing code, we reference these principles to guide our decisions. If two approaches seem equally valid, we choose the one that best aligns with our tenets.
The team/ folder holds the rest of our shared context: the full tenets, decision records, the API bar-raising and feature lifecycle processes, and our design proposals. For a significant feature or a breaking change, start with a design proposal in team/designs/ โ see its README for the template and process.
Development Environment
This is a monorepo containing the Python SDK, TypeScript SDK, MCP server, and documentation site. Each has its own toolchain:
| Area | Directory | Toolchain |
|------|-----------|-----------|
| Python SDK | strands-py/ | hatch |
| TypeScript SDK | strands-ts/ | npm workspace |
| MCP server | strands-mcp/ | hatch |
| Docs site | site/ | Astro (npm) |
Python SDK
The Python SDK uses hatchling as the build backend and hatch for development workflow management.
All hatch commands should be run from the strands-py/ subdirectory (where pyproject.toml lives):
cd strands-pySetting Up Your Development Environment
1. Entering virtual environment using hatch (recommended), then launch your IDE in the new shell.
hatch shell
2. Set up pre-commit hooks:
pre-commit install -t pre-commit -t commit-msgThis will automatically run formatters and conventional commit checks on your code before each commit.
3. Run code formatters manually:
hatch fmt --formatter4. Run linters:
hatch fmt --linter5. Run unit tests:
hatch testOr run them with coverage:
hatch test -c6. Run integration tests:
hatch run test-integPre-commit Hooks
We use pre-commit to automatically run quality checks before each commit. The hook will run hatch run format, hatch run lint, hatch run test, and hatch run cz check when you make a commit, ensuring code consistency.
The pre-commit hook is installed with:
pre-commit installYou can also run the hooks manually on all files:
pre-commit run --all-filesCode Formatting and Style Guidelines
We use the following tools to ensure code quality:
1. ruff - For formatting and linting
2. mypy - For static type checking
These tools are configured in the pyproject.toml file. Please ensure your code passes all linting and type checks before submitting a pull request:
Run all checks
hatch fmt --formatter
hatch fmt --linterIf you're using an IDE like VS Code or PyCharm, consider configuring it to use these tools automatically.
For additional details on styling, please see our dedicated Style Guide.
TypeScript SDK
The TypeScript SDK uses an npm workspace rooted at the repository root.
npm ci # install dependencies (from repo root)
npm run build # build
npm test # run unit tests
npm run lint # lint
npm run type-check # type checking#### Running Selective Integration Tests Locally
From the repository root, run only the integration tests relevant to your
changes (computed relative to main, including uncommitted edits):
npm run test:integ:selectiveThis uses Vitest's module graph to run only the integ-node andinteg-browser specs that depend on the source files you changed. If you
alter a structural file (package.json, package-lock.json, a strands-tstsconfig, vitest.config.ts, a shared integration fixture undertest/integ/__fixtures__/, or a TypeScript CI workflow), the full
integration suite runs automatically.
Documentation Site
The documentation site uses Astro with the Starlight theme.
cd site
npm install
npm run dev # local dev server at http://localhost:4321/
npm run build # production build
npm run typecheck # type checking
npm run typecheck:snippets # type check code examplesFor docs contribution guidelines, see site/CONTRIBUTING.md.
PR Size and Complexity
Every PR is labeled with a size/ and a complexity/ label. Both are
informational โ they help reviewers budget attention and neither blocks a merge.
You can see the same numbers before you push. From the repository root:
npm run complexity:setup # once, to install the analyzers
npm run complexity # report labels for your branch vs origin/mainPython contributors can use hatch instead, from strands-py/:
cd strands-py
hatch run complexitysize/ counts changed lines in source and prose, and *excludes tests,
lockfiles, and snapshots. Thorough tests should never push a PR into a bigger
bucket, so write as many as the change deserves.
complexity/* reports the cognitive complexity
of the most complex function your diff touches โ roughly, how hard the control
flow is to hold in your head. It scores only the functions you actually changed,
so an existing hotspot elsewhere in a file you edited will not count against
you. complexity/high (above 25) is a hint that a function may be worth
splitting, not a rule; sometimes a complex function is the honest solution.
A docs-only or test-only PR touches no SDK source and gets no complexity label.
The labels exist because review attention is the scarcest resource this
project has: they let maintainers triage which PRs need an unhurried senior
read, and they give you the same signal locally before a reviewer sees it. The
reasoning, the scoring model, and the practices that keep code under the
thresholds live in team/COMPLEXITY.md.
Using AI Tools
We love AI. We build with coding agents every day, and you're welcome to use them too โ they're a great way to move fast and explore a codebase.
That said, you are the author of your pull request, not your agent. Before you open a PR, make sure you understand the code well enough to explain why it works, defend the design choices, and maintain it if asked. If you couldn't walk a reviewer through it line by line, it's not ready yet.
A few things that help us help you:
- Keep changes small and incremental. A focused PR that does one thing is far easier for us to understand, guide, and merge than a large one that touches many areas. When in doubt, split it up.
- Open an issue first for anything significant, so we can align on the approach before you (or your agent) invest the time.
- Review every line your agent generates. Delete what you don't need, simplify what's over-engineered, and make sure tests actually exercise the behavior โ not just pass. Trim comments that narrate the agent's reasoning: a comment should state only what a reader cannot infer from the code.
High-quality PRs get reviewed faster and are far more likely to be accepted. Taking the time to understand and trim your changes is the single best thing you can do to get them merged.
Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
1. You are working against the latest source on the main branch.
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
For guidance on writing effective PR descriptions, see our PR Description Guidelines.
To send us a pull request, please:
1. Create a branch.
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
3. Format your code using hatch fmt --formatter.
4. Run linting checks with hatch fmt --linter.
5. Ensure local tests pass with hatch test and hatch run test-integ.
6. Commit to your branch using clear commit messages following the Conventional Commits specification.
7. Send us a pull request, answering any default questions in the pull request interface.
8. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
Code of Conduct
This project has adopted the Amazon Open Source Code of Conduct.
For more information see the Code of Conduct FAQ or contact
[email protected] with any additional questions or comments.
Security issue notifications
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our vulnerability reporting page. Please do not create a public github issue.
Licensing
See the LICENSE.APACHE and LICENSE.MIT files for our project's licensing. We will ask you to confirm the licensing of your contribution.
---
README
<div align="center">
<div>
<a href="https://strandsagents.com">
<img src="https://strandsagents.com/latest/assets/logo-github.svg" alt="Strands Agents" width="55px" height="105px">
</a>
</div>
<h1>
Strands Agents
</h1>
<h2>
A model-driven approach to building AI agents in just a few lines of code.
</h2>
<div align="center">
<a href="https://github.com/strands-agents/harness-sdk/graphs/commit-activity"><img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/strands-agents/harness-sdk"/></a>
<a href="https://github.com/strands-agents/harness-sdk/issues"><img alt="GitHub open issues" src="https://img.shields.io/github/issues/strands-agents/harness-sdk"/></a>
<a href="https://github.com/strands-agents/harness-sdk/pulls"><img alt="GitHub open pull requests" src="https://img.shields.io/github/issues-pr/strands-agents/harness-sdk"/></a>
<a href="https://github.com/strands-agents/harness-sdk/blob/main/LICENSE.APACHE"><img alt="License" src="https://img.shields.io/github/license/strands-agents/harness-sdk"/></a>
<a href="https://pypi.org/project/strands-agents/"><img alt="PyPI version" src="https://img.shields.io/pypi/v/strands-agents"/></a>
<a href="https://www.npmjs.com/package/@strands-agents/sdk"><img alt="npm version" src="https://img.shields.io/npm/v/%40strands-agents%2Fsdk"/></a>
<a href="https://python.org"><img alt="Python versions" src="https://img.shields.io/pypi/pyversions/strands-agents"/></a>
<a href="https://discord.gg/strands"><img alt="Strands Discord" src="https://img.shields.io/badge/Discord-Strands-5865F2?logo=discord&logoColor=white"/></a>
</div>
<p>
<a href="https://strandsagents.com/">Documentation</a>
โ <a href="https://github.com/strands-agents/samples">Samples</a>
โ <a href="https://github.com/strands-agents/tools">Tools</a>
โ <a href="https://github.com/strands-agents/harness-sdk/tree/main/strands-mcp">MCP Server</a>
</p>
</div>
Strands Agents is a simple yet powerful SDK that takes a model-driven approach to building and running AI agents. From simple conversational assistants to complex autonomous workflows, from local development to production deployment, Strands Agents scales with your needs.
This monorepo contains the Python SDK, TypeScript SDK, documentation site, and supporting packages:
| Directory | Description |
|-----------|-------------|
| strands-py/ | Python SDK: agent loop, model providers, tools (PyPI ยท releases) |
| strands-ts/ | TypeScript SDK: agent loop, model providers, tools (npm ยท releases) |
| site/ | Source for the strandsagents.com documentation site (Astro/Starlight) |
| team/ | Governance and cross-SDK process docs (tenets, decisions, PR & compatibility guidelines, and designs/ proposals) |
Why Strands
Build an agent harness. Control it end-to-end.
- Build your way. Any model, any cloud. Context management, execution limits, and observability built in before you write a line of config. Swap backends when you scale; your code stays the same.
- Model agnostic. First-class support for Amazon Bedrock, Anthropic, OpenAI, and Gemini, plus many more providers and custom ones.
- Stay in control. The agent loop traces every decision by default. Hooks let you intercept any step to log it, validate it, or redirect it.
- Deliver outcomes that work. Guardrails catch mistakes before they run. Steering handlers let agents correct themselves instead of failing silently.
MCP, streaming, multi-agent patterns, and structured output are all built in.
Quick Start
Both SDKs default to the Amazon Bedrock model provider, so you'll need AWS credentials configured and model access enabled for Claude Sonnet. The Quickstart Guide covers configuring other providers (Anthropic, OpenAI, Gemini, Ollama, and more).
Python
Requires Python 3.10+:
pip install strands-agents strands-agents-toolsfrom strands import Agent
from strands_tools import calculatoragent = Agent(tools=[calculator])
agent("What is the square root of 1764")
The Python SDK README covers tools, model providers, MCP, and bidirectional streaming.
TypeScript
Requires Node.js 20+:
npm install @strands-agents/sdkimport { Agent } from '@strands-agents/sdk'const agent = new Agent()
const result = await agent.invoke('What is the square root of 1764?')
console.log(result)
More in the TypeScript SDK README, including Zod-typed tools, structured output, and multi-agent patterns.
Documentation
For detailed guidance & examples, explore our documentation:
- User Guide
- Quick Start Guide
- Agent Loop
- Examples
- API Reference: Python ยท TypeScript
- Production & Deployment Guide
The docs themselves live in this monorepo under site/, and doc PRs are welcome alongside code changes.
Development
Git operations (commits, branches, PRs) are done from the repo root. Each package has its own toolchain:
Python SDK (strands-py/):
cd strands-py
pip install hatch
hatch test # run unit tests
hatch fmt # format & lintTypeScript SDK (strands-ts/):
npm ci # install from repo root
npm run build # build
npm test # run unit testsDocumentation site (site/):
cd site
npm install
npm run dev # local dev server at http://localhost:4321/Contributing โค๏ธ
We welcome contributions! See our Contributing Guide for details on:
- Reporting bugs & features
- Development setup
- Contributing via Pull Requests
- Code of Conduct
- Reporting of security issues
Stay in touch with the team
Come meet the Strands team and other users on Discord
License
This project is licensed under the Apache License 2.0 - see the LICENSE.APACHE file for details.
Security
See CONTRIBUTING for more information.
---
SECURITY
Security Policy
Supported Versions
| Version | Supported |
| ------- | ------------------ |
| 1.x.x | :white_check_mark: |
| < 1.0 | :x: |
Reporting Security Issues
Amazon Web Services (AWS) is dedicated to the responsible disclosure of security vulnerabilities.
We kindly ask that you do not open a public GitHub issue to report security concerns.
Instead, please submit the issue to the AWS Vulnerability Disclosure Program via HackerOne or send your report via email.
For more details, visit the AWS Vulnerability Reporting Page.
Thank you in advance for collaborating with us to help protect our customers.
---
--- METRICS ---
- Files Extracted: 4
- Estimated Token Budget: ~6997 tokens
- Recency Window: Active (< 180 days)
- Canonical Reference: https://codewiki.google/github.com/strands-agents/sdk-python