Skip to main content

Strands Agents - Python SDK

A model-driven approach to building AI agents in just a few lines of code.

GitHub commit activity GitHub open issues GitHub open pull requests License PyPI version Python versions Strands Discord

DocumentationSamplesToolsMCP 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

Connect to 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")

The SDK works with both major versions of the mcp package through a built-in compatibility layer, so most code that uses MCPClient runs unchanged on either version. A fresh install resolves to mcp 2.x, and pinning mcp<2 keeps you on 1.x. See docs/MCP_VERSIONS.md for support status, the behavior differences on 2.x, and migration notes.

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:

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 Bedrock Nova Sonic (v1, v2)
  • Google Gemini Live
  • OpenAI Realtime API

Installation:

# Server-side only (no audio I/O dependencies)
pip install strands-agents[bidi]

# With all portable Bidi providers, text I/O, and audio processing
pip install strands-agents[bidi-all]

# For local microphone/speaker access, install PortAudio for your OS first, then:
pip install strands-agents[bidi-pyaudio]

Note: Bedrock Nova Sonic requires Python 3.12+ due to its experimental AWS SDK dependency.

Quick Example:

import asyncio
from strands.experimental.bidi import BidiAgent
from strands.experimental.bidi.models import BedrockNovaSonicModel
from strands.experimental.bidi.io import BidiAudioIO, BidiTextIO
from strands_tools import calculator, stop

async def main():
    # Create bidirectional agent with Nova Sonic v2
    model = BedrockNovaSonicModel()
    agent = BidiAgent(model=model, tools=[calculator, stop])

    # Setup audio and text I/O (local audio requires the bidi-pyaudio extra)
    audio_io = BidiAudioIO()
    text_io = BidiTextIO()

    # Run with real-time audio streaming
    # stop tool allows user to verbally stop agent execution
    await agent.run(
        inputs=[audio_io.input()],
        outputs=[audio_io.output(), text_io.output()]
    )

if __name__ == "__main__":
    asyncio.run(main())

Note: BidiTextIO is included with the bidi extra. BidiAudioIO requires the bidi-pyaudio extra and the PortAudio system library. For server-side deployments where audio I/O is handled by clients (browsers, mobile apps), install only strands-agents[bidi] and implement custom input/output handlers using the BidiInput and BidiOutput protocols.

Configuration Options:

from strands.experimental.bidi.models import BedrockNovaSonicModel

# Configure audio streams and Nova Sonic session parameters.
model = BedrockNovaSonicModel(
    audio={
        "input_rate": 16000,
        "output_rate": 16000,
        "voice": "matthew",
    },
    params={
        "turnDetectionConfiguration": {
            "endpointingSensitivity": "MEDIUM"
        },
        "inferenceConfiguration": {
            "maxTokens": 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:

Development

pip install hatch
hatch test        # run unit tests
hatch fmt         # format & lint

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 file for details.

Security

See CONTRIBUTING for more information.

Release files for strands-agents 1.55.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for strands-agents 1.55.1
File Size Uploaded
strands_agents-1.55.1.tar.gz 1.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for strands-agents 1.55.1
File Interpreter ABI Platform
strands_agents-1.55.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.4 MB

Release files / strands_agents-1.55.1.tar.gz

Download URL strands_agents-1.55.1.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
55dc609a9d7c75d61842304180456a815e60b34d00ce089c29362cedd274cd2a
BLAKE2b-256 checksum
How to use checksums
0d80f65af6df0300f1d09e5c0d0cc7ebb1e8183d3922829cec2c255c91188ec9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / strands_agents-1.55.1-py3-none-any.whl

Download URL strands_agents-1.55.1-py3-none-any.whl
Size 821.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b62a8ca6f34d14140789900e35205c0032fa4a92f6147c7f69a7fda149da7ab
BLAKE2b-256 checksum
How to use checksums
faa05d7dc1c6df4b4717d7be516c32e5c9383ef0676166fb06260b6d88c4c9ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release history Release notifications | RSS feed

1.56.0

2 release files

This release

1.55.1 This release

2 release files

1.54.0

2 release files

1.53.0

2 release files

1.52.0

2 release files

1.50.2

2 release files

1.50.1

2 release files

1.50.0

2 release files

1.48.0

2 release files

1.47.0

2 release files

1.45.0

2 release files

1.44.0

2 release files

1.43.0

2 release files

1.41.0

2 release files

1.40.0

2 release files

1.38.0

2 release files

1.37.0

2 release files

1.36.0

2 release files

1.34.0

2 release files

1.33.0

2 release files

1.32.0

2 release files

1.31.0

2 release files

1.30.0

2 release files

1.28.0

2 release files

1.27.0

2 release files

1.26.0

2 release files

1.24.0

2 release files

1.23.0

2 release files

1.22.0

2 release files

1.20.0

2 release files

1.18.0

2 release files

1.17.0

2 release files

1.16.0

2 release files

1.14.0

2 release files

1.13.0

2 release files

1.12.0

2 release files

1.10.0

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page