Sdk Python
A model-driven approach to building AI agents in just a few lines of code.
Last verified:
What is Sdk Python?
Sdk Python is the Strands Agents SDK, an open-source Python framework for building, managing, evaluating, and deploying AI-powered agents using a model-driven approach. It enables production-ready AI agents in just a few lines of code with tool invocation, multi-agent collaboration, conversation memory, and observability.
Sdk Python pricing
Pricing model: Freemium
Strands Agents SDK is completely free and open source under the Apache License 2.0. There is no paid tier for the SDK itself. The framework has 25 million downloads and is available via pip install strands-agents for Python or npm install @strands-agents/sdk for TypeScript. You only pay for the underlying model provider costs (e.g., Amazon Bedrock, OpenAI, Anthropic API usage) and infrastructure costs for deployment (e.g., AWS Lambda, Fargate, EKS). The strands-agents-tools community package with 30+ built-in tools is also free.
Sdk Python pros
- Open source with Apache 2.0 license - completely free to use
- Model-driven approach cuts setup from 40 lines to just 3 lines of code
- Supports 10+ model providers including Bedrock, OpenAI, Anthropic, Gemini, Ollama, LiteLLM
- 30+ built-in tools available via strands-agents-tools community package
- Built-in observability with OpenTelemetry integration traces every decision by default
- Lifecycle hooks allow intercepting any step to log, validate, or redirect agent behavior
- Multi-agent patterns include Swarm, Graph, workflows, and Agent-as-Tool
- Human-in-the-loop interrupts enable approval workflows before sensitive actions
- Structured output with Pydantic models ensures type-safe, validated responses
- Conversation managers (sliding window, summarizing) keep long conversations in bounds
- AWS-native integration with AgentCore Runtime, Bedrock Guardrails, and OpenTelemetry
- Deploy anywhere: Lambda, Fargate, EKS, Docker, Terraform, Kubernetes
- Steering handlers achieved 100% agent accuracy in benchmarks vs 82.5% for prompts
- Bidirectional voice support for real-time voice conversations
- No vendor lock-in - swap backends when scaling while code stays the same
- Progressive complexity - start simple and add features like context management as needed
- Active community with Discord server for real-time help and connecting with the Strands team
Sdk Python cons
- Newer framework with smaller community compared to LangChain or LangGraph
- TypeScript SDK lacks Ollama and LiteLLM support that Python has
- TypeScript SDK missing bidirectional streaming and agent steering features
- Default uses Amazon Bedrock requiring AWS credentials and Bedrock access configuration
- Production readiness not automatic - requires external governance, audit trails, and hardening
- Can hit Bedrock capacity limits/throttling at scale without built-in retry logic
- Enterprise policy and hardened audit trails must be layered externally
- Risk of model choosing destructive tools too early without proper guardrails
- May repeat retrieval tools until cost spikes without explicit rate limiting
Frequently asked questions about Sdk Python
What is Strands Agents SDK?
Strands Agents SDK is an open-source SDK developed by AWS that takes a model-driven approach to building and running AI agents in just a few lines of code. It empowers developers to quickly build, manage, evaluate, and deploy AI-powered agents with tools, multi-agent patterns, and any model provider. The SDK is available in both Python (requiring Python 3.10+) and TypeScript (requiring Node.js 20+).
How do I install Strands Agents SDK?
For Python, ensure Python 3.10+ is installed, create a virtual environment, then run 'pip install strands-agents'. You can also install the development packages 'pip install strands-agents-tools' for 30+ built-in tools and 'pip install strands-agents-builder' for an agent that helps build your own Strands agents and tools. For TypeScript, run 'npm install @strands-agents/sdk'.
What model providers does Strands support?
Strands supports Amazon Bedrock (default with Claude Sonnet 4), OpenAI, OpenAI Responses API, Anthropic, Google/Gemini, Ollama (Python only), LiteLLM (Python only), Llama API, Mistral, Writer, Cohere, CLOVA Studio, FireworksAI, SageMaker, and custom providers. You can specify a model by passing a string model ID directly or creating a model provider instance with specific configurations.
How do I create custom tools for my agent?
Use the @tool decorator to create custom function tools. Define a function with a docstring describing what it does, add the @tool decorator, and pass it to the Agent constructor in the tools list. The tool will have a name, description, and input schema that the model can use to determine when to call it. For TypeScript, use the tool() function with Zod schema for input validation.
What is the agent loop and how does it work?
The agent loop is the core mechanism where the model generates a response, tool calls are extracted from the response, tools are executed with the provided arguments, results are fed back to the model, and the process repeats until the task is complete. Every agent invocation returns an AgentResult object with comprehensive observability data including traces and metrics.
How do I add observability to my agent?
Strands provides built-in observability with OpenTelemetry integration by default. Every agent invocation traces every decision. You can access in-memory traces and metrics directly from the AgentResult, or export them using OpenTelemetry to observability platforms. You can also add lifecycle hooks like BeforeToolCallEvent and AfterToolCallEvent to log tool calls, and set trace_attributes for custom tagging.
What are hooks and how do I use them?
Hooks are callback functions that intercept any step in the agent's lifecycle. You can use hooks to log behavior, validate tool calls, redirect agent behavior, or implement guardrails. Examples include BeforeToolCallEvent to validate or cancel tool calls before execution, AfterToolCallEvent to log results, and interrupt() to pause for human approval. Hooks are passed as a list to the Agent constructor.
How do I implement multi-agent systems?
Strands supports multiple multi-agent patterns including Swarms (for parallel agent execution), Graphs (for orchestration with loops), Workflows (sequential agent workflows), and Agent-as-Tool (one agent as a tool for another). Python also supports Agent-to-Agent (A2A) protocol. These patterns are available in both Python and TypeScript SDKs.
How do I handle conversation memory and context?
Strands provides three conversation managers: NullConversationManager (no memory), SlidingWindowConversationManager (keeps last N messages), and SummarizingConversationManager (summarizes conversation history). You pass the conversation manager to the Agent constructor. For persistent memory across sessions, use FileSessionManager, S3SessionManager, or RepositorySessionManager.
How do I deploy my agent to production?
Strands agents are just Python or TypeScript code, so you can deploy them anywhere. Deployment options include AWS Lambda, AWS Fargate, Amazon EKS, Docker containers, Kubernetes, Amazon EC2, and Amazon App Runner. The SDK integrates natively with AWS Bedrock AgentCore Runtime for serverless agent deployment. You can also use Terraform for infrastructure as code.