A model-driven approach to building AI agents in just a few lines of code
Project description
Strands Agents
A model-driven approach to building AI agents in just a few lines of code.
Documentation ◆ Samples ◆ Python SDK ◆ Tools ◆ Agent Builder ◆ MCP Server
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.
Feature Overview
- Lightweight & Flexible: Simple agent loop that just works and is fully customizable
- Model Agnostic: Support for Amazon Bedrock, Anthropic, Gemini, LiteLLM, Llama, Ollama, OpenAI, Writer, and custom providers
- Advanced Capabilities: Multi-agent systems, autonomous agents, and streaming support
- Built-in MCP: Native support for Model Context Protocol (MCP) servers, enabling access to thousands of pre-built tools
Quick Start
# Install Strands Agents
pip install strands-agents strands-agents-tools
from strands import Agent
from strands_tools import calculator
agent = Agent(tools=[calculator])
agent("What is the square root of 1764")
Note: For the default Amazon Bedrock model provider, you'll need AWS credentials configured and model access enabled for Claude 4 Sonnet in the us-west-2 region. See the Quickstart Guide for details on configuring other model providers.
Installation
Ensure you have Python 3.10+ installed, then:
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows use: .venv\Scripts\activate
# Install Strands and tools
pip install strands-agents strands-agents-tools
Features at a Glance
Python-Based Tools
Easily build tools using Python decorators:
from strands import Agent, tool
@tool
def word_count(text: str) -> int:
"""Count words in text.
This docstring is used by the LLM to understand the tool's purpose.
"""
return len(text.split())
agent = Agent(tools=[word_count])
response = agent("How many words are in this sentence?")
Hot Reloading from Directory:
Enable automatic tool loading and reloading from the ./tools/ directory:
from strands import Agent
# Agent will watch ./tools/ directory for changes
agent = Agent(load_tools_from_directory=True)
response = agent("Use any tools you find in the tools directory")
MCP Support
Seamlessly integrate Model Context Protocol (MCP) servers:
from strands import Agent
from strands.tools.mcp import MCPClient
from mcp import stdio_client, StdioServerParameters
aws_docs_client = MCPClient(
lambda: stdio_client(StdioServerParameters(command="uvx", args=["awslabs.aws-documentation-mcp-server@latest"]))
)
with aws_docs_client:
agent = Agent(tools=aws_docs_client.list_tools_sync())
response = agent("Tell me about Amazon Bedrock and how to use it with Python")
Multiple Model Providers
Support for various model providers:
from strands import Agent
from strands.models import BedrockModel
from strands.models.ollama import OllamaModel
from strands.models.llamaapi import LlamaAPIModel
from strands.models.gemini import GeminiModel
from strands.models.llamacpp import LlamaCppModel
# Bedrock
bedrock_model = BedrockModel(
model_id="us.amazon.nova-pro-v1:0",
temperature=0.3,
streaming=True, # Enable/disable streaming
)
agent = Agent(model=bedrock_model)
agent("Tell me about Agentic AI")
# Google Gemini
gemini_model = GeminiModel(
client_args={
"api_key": "your_gemini_api_key",
},
model_id="gemini-2.5-flash",
params={"temperature": 0.7}
)
agent = Agent(model=gemini_model)
agent("Tell me about Agentic AI")
# Ollama
ollama_model = OllamaModel(
host="http://localhost:11434",
model_id="llama3"
)
agent = Agent(model=ollama_model)
agent("Tell me about Agentic AI")
# Llama API
llama_model = LlamaAPIModel(
model_id="Llama-4-Maverick-17B-128E-Instruct-FP8",
)
agent = Agent(model=llama_model)
response = agent("Tell me about Agentic AI")
Built-in providers:
- Amazon Bedrock
- Anthropic
- Gemini
- Cohere
- LiteLLM
- llama.cpp
- LlamaAPI
- MistralAI
- Ollama
- OpenAI
- SageMaker
- Writer
Custom providers can be implemented using Custom Providers
Example tools
Strands offers an optional strands-agents-tools package with pre-built tools for quick experimentation:
from strands import Agent
from strands_tools import calculator
agent = Agent(tools=[calculator])
agent("What is the square root of 1764")
It's also available on GitHub via strands-agents/tools.
Bidirectional Streaming
⚠️ Experimental Feature: Bidirectional streaming is currently in experimental status. APIs may change in future releases as we refine the feature based on user feedback and evolving model capabilities.
Build real-time voice and audio conversations with persistent streaming connections. Unlike traditional request-response patterns, bidirectional streaming maintains long-running conversations where users can interrupt, provide continuous input, and receive real-time audio responses. Get started with your first BidiAgent by following the Quickstart guide.
Supported Model Providers:
- Amazon Nova Sonic (v1, v2)
- Google Gemini Live
- OpenAI Realtime API
Quick Example:
import asyncio
from strands.experimental.bidi import BidiAgent
from strands.experimental.bidi.models import BidiNovaSonicModel
from strands.experimental.bidi.io import BidiAudioIO, BidiTextIO
from strands.experimental.bidi.tools import stop_conversation
from strands_tools import calculator
async def main():
# Create bidirectional agent with Nova Sonic v2
model = BidiNovaSonicModel()
agent = BidiAgent(model=model, tools=[calculator, stop_conversation])
# Setup audio and text I/O
audio_io = BidiAudioIO()
text_io = BidiTextIO()
# Run with real-time audio streaming
# Say "stop conversation" to gracefully end the conversation
await agent.run(
inputs=[audio_io.input()],
outputs=[audio_io.output(), text_io.output()]
)
if __name__ == "__main__":
asyncio.run(main())
Configuration Options:
from strands.experimental.bidi.models import BidiNovaSonicModel
# Configure audio settings and turn detection (v2 only)
model = BidiNovaSonicModel(
provider_config={
"audio": {
"input_rate": 16000,
"output_rate": 16000,
"voice": "matthew"
},
"turn_detection": {
"endpointingSensitivity": "MEDIUM" # HIGH, MEDIUM, or LOW
},
"inference": {
"max_tokens": 2048,
"temperature": 0.7
}
}
)
# Configure I/O devices
audio_io = BidiAudioIO(
input_device_index=0, # Specific microphone
output_device_index=1, # Specific speaker
input_buffer_size=10,
output_buffer_size=10
)
# Text input mode (type messages instead of speaking)
text_io = BidiTextIO()
await agent.run(
inputs=[text_io.input()], # Use text input
outputs=[audio_io.output(), text_io.output()]
)
# Multi-modal: Both audio and text input
await agent.run(
inputs=[audio_io.input(), text_io.input()], # Speak OR type
outputs=[audio_io.output(), text_io.output()]
)
Documentation
For detailed guidance & examples, explore our documentation:
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
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Security
See CONTRIBUTING for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strands_agents-1.25.0.tar.gz.
File metadata
- Download URL: strands_agents-1.25.0.tar.gz
- Upload date:
- Size: 697.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
831a91d38d82f2051efb3d2ad013b4d6d2bbdad2353421796371a7e94503bc59
|
|
| MD5 |
ad86e0ba5dc411d1beb62365829643a2
|
|
| BLAKE2b-256 |
89301b437b74d1854c9704fa3a59390bddf71c158425a76088c8b94f620756ea
|
Provenance
The following attestation bundles were made for strands_agents-1.25.0.tar.gz:
Publisher:
pypi-publish-on-release.yml on strands-agents/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strands_agents-1.25.0.tar.gz -
Subject digest:
831a91d38d82f2051efb3d2ad013b4d6d2bbdad2353421796371a7e94503bc59 - Sigstore transparency entry: 920033056
- Sigstore integration time:
-
Permalink:
strands-agents/sdk-python@4f1a8b391b85a0e9479bd8ce380fe0b61dd09d7c -
Branch / Tag:
refs/tags/v1.25.0 - Owner: https://github.com/strands-agents
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish-on-release.yml@4f1a8b391b85a0e9479bd8ce380fe0b61dd09d7c -
Trigger Event:
release
-
Statement type:
File details
Details for the file strands_agents-1.25.0-py3-none-any.whl.
File metadata
- Download URL: strands_agents-1.25.0-py3-none-any.whl
- Upload date:
- Size: 345.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16b3a6331c8a1a8a79a249202c591a9cd2d777893371bcd8c12e458ada23587c
|
|
| MD5 |
51cb380502e1c17064b820a3f82ab901
|
|
| BLAKE2b-256 |
0552f07b14af7d71c467999ebb7f6c5ccc681cbd579a3993def21dd9b3507564
|
Provenance
The following attestation bundles were made for strands_agents-1.25.0-py3-none-any.whl:
Publisher:
pypi-publish-on-release.yml on strands-agents/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strands_agents-1.25.0-py3-none-any.whl -
Subject digest:
16b3a6331c8a1a8a79a249202c591a9cd2d777893371bcd8c12e458ada23587c - Sigstore transparency entry: 920033060
- Sigstore integration time:
-
Permalink:
strands-agents/sdk-python@4f1a8b391b85a0e9479bd8ce380fe0b61dd09d7c -
Branch / Tag:
refs/tags/v1.25.0 - Owner: https://github.com/strands-agents
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish-on-release.yml@4f1a8b391b85a0e9479bd8ce380fe0b61dd09d7c -
Trigger Event:
release
-
Statement type: