Strands Agents (Python): Comprehensive Guide
The Python Strands Agents SDK from the ground up: the agent loop, Agent options, model providers, tools, structured output, streaming, conversation management, state, sessions, limits and errors.
Checked against strands-agents 1.64.0 and strands-agents-tools 0.9.0 (2026-11-19). Every example on this page was run against the installed package with the Bedrock client replaced by an offline stub, so the code paths are real but the model replies are canned. See Testing without the cloud for the technique.
Topic pages go deeper on tools and MCP, hooks, interventions and interrupts, multi-agent systems and A2A and observability and evals.
Installation
Section titled “Installation”pip install "strands-agents==1.64.0"Python 3.10 or later. Model providers other than Bedrock, and some features, are optional extras:
| Extra | Adds |
|---|---|
anthropic | AnthropicModel (Anthropic API) |
openai | OpenAIModel, OpenAIResponsesModel |
gemini | GeminiModel |
litellm | LiteLLMModel |
ollama | OllamaModel |
mistral, llamaapi, writer, sagemaker | MistralModel, LlamaAPIModel, WriterModel, SageMakerAIModel |
a2a | A2AServer, A2AAgent |
otel | OTLP trace exporter |
bidi, bidi-openai, bidi-google, bidi-io, bidi-pyaudio, bidi-aec | BidiAgent for real-time voice and its models and audio devices (see Real-time voice) |
cedar | the Cedar policy intervention handler |
web-fetch | the vended web_fetch tool |
pip install "strands-agents[anthropic,openai,otel]==1.64.0"LlamaCppModel needs no extra (it talks HTTP to a llama.cpp server).
AWS credentials
Section titled “AWS credentials”Bedrock is the default provider. Strands uses the standard boto3 credential chain (environment variables, ~/.aws profiles, SSO, instance or task roles). Set a Region, and enable access to the models you plan to use in the Bedrock console:
aws configure # or: export AWS_PROFILE=...export AWS_REGION=us-west-2A first agent:
from strands import Agent, tool
@tooldef word_count(text: str) -> int: """Count the words in a piece of text.
Args: text: The text to count. """ return len(text.split())
agent = Agent( model="us.anthropic.claude-sonnet-5-5", # Bedrock cross-Region inference profile system_prompt="You are a concise assistant.", tools=[word_count],)
result = agent("How many words are in 'the quick brown fox'?")print(result.stop_reason) # end_turnprint(str(result)) # the final textBy default an agent prints the streamed response to stdout (PrintingCallbackHandler). Pass callback_handler=None to silence it in servers and tests.
The agent loop
Section titled “The agent loop”Strands is model-driven: you give the agent a model, a system prompt and tools, and the model decides what to do. One call to the agent runs this loop:
- Append the user input to
agent.messages. - Call the model with the history, the system prompt and the tool specs.
- If the model asked for tools (
stop_reason == "tool_use"), run them (concurrently by default), append the results as a user message, and go back to step 2. - Otherwise stop and return an
AgentResult.
Each pass through steps 2–3 is an event loop cycle. There is no fixed iteration cap; bound a run with limits= (below) or with hooks. A diagram of the loop shows where hooks fire.
What the loop does around the edges:
- Tool errors do not end the run. An exception in a tool becomes a tool result with
status: "error", and the model sees the message and can recover. - Throttling is retried with exponential backoff (
ModelRetryStrategy, six attempts by default). - Context overflow (
ContextWindowOverflowExceptionfrom the provider) makes the conversation manager trim the history and the call is retried. max_tokensraisesMaxTokensReachedException; the partial message stays in the history, so you can raisemax_tokensor call the agent again.
AgentResult
Section titled “AgentResult”from strands import Agent
agent = Agent(model="us.anthropic.claude-sonnet-5-5", callback_handler=None)result = agent("Name three Yorkshire towns.")
print(result.stop_reason) # "end_turn"print(result.message["content"][0]["text"]) # the final assistant messageprint(result.metrics.latest_agent_invocation.usage) # tokens for this callprint(result.metrics.accumulated_usage) # tokens for every call this agent has madeprint(len(agent.messages)) # history kept on the agent| Field | Meaning |
|---|---|
stop_reason | end_turn, max_tokens, stop_sequence, guardrail_intervened, content_filtered, interrupt, cancelled, limit_turns, limit_total_tokens, limit_output_tokens, checkpoint, tool_use |
message | The last assistant message |
metrics | The agent’s EventLoopMetrics: usage, cycle count, per-tool metrics, traces. It is shared across calls, so accumulated_usage and cycle_count are totals for the agent’s lifetime; latest_agent_invocation holds this call’s usage and cycles |
structured_output | The validated Pydantic instance when you asked for one |
interrupts | Pending interrupts when stop_reason == "interrupt" |
state | Final request state |
str(result) returns the text of the final message (with a trailing newline), so str(agent(...)).strip() is the usual way to get a plain answer.
The Agent class
Section titled “The Agent class”The constructor takes keyword arguments. The ones you will use most:
| Argument | Purpose |
|---|---|
model | A Model instance, a Bedrock model ID string, or a ModelRouter. Defaults to BedrockModel() |
system_prompt | A string, or a list of system content blocks (for cache points) |
tools | @tool functions, tool modules, AgentTool objects, MCPClients and other tool providers, or other Agents |
name, description, agent_id | Identity; used when the agent becomes a tool, a swarm member or an A2A server, and as the session key |
messages | Initial history |
state | JSON-serialisable application state (not sent to the model) |
callback_handler | Receives streaming events; None silences output |
conversation_manager | How history is trimmed (default SlidingWindowConversationManager) |
session_manager | Persists messages and state |
structured_output_model | Default Pydantic output type for every call |
hooks, plugins, interventions | Lifecycle callbacks, bundled extensions, and policy handlers |
retry_strategy | ModelRetryStrategy(...), or None to disable retries |
tool_executor | ConcurrentToolExecutor() (default) or SequentialToolExecutor() |
trace_attributes | Extra OpenTelemetry span attributes |
aux_model | A cheaper model for side calls (summarisation, judges, classifiers) |
agent.tool_names lists the registered tools, agent.messages is the history (a list of Bedrock-style message dicts), and agent.state is the state store.
Ways to call an agent
Section titled “Ways to call an agent”import asyncio
from strands import Agent
agent = Agent(model="us.anthropic.claude-sonnet-5-5", callback_handler=None)
# Synchronous: blocks until the loop finishesresult = agent("Summarise the plot of Hamlet in one sentence.")
# Asynchronousasync def main() -> None: result = await agent.invoke_async("And Macbeth?") print(result)
# Streaming: an async iterator of events, ending with {"result": AgentResult} async for event in agent.stream_async("And King Lear?"): if "data" in event: print(event["data"], end="", flush=True) elif "result" in event: print("\nstop:", event["result"].stop_reason)
asyncio.run(main())The prompt can be a string, a list of content blocks (text, images, documents), a list of full messages, or None to continue from the existing history. A multimodal prompt:
from pathlib import Path
from strands import Agent
Path("chart.png").write_bytes(b"\x89PNG\r\n\x1a\n" + b"\x00" * 64) # stand-in image
agent = Agent(model="us.anthropic.claude-sonnet-5-5", callback_handler=None)result = agent([ {"text": "What does this chart show?"}, {"image": {"format": "png", "source": {"bytes": Path("chart.png").read_bytes()}}},])Documents use {"document": {"format": "pdf", "name": "report", "source": {"bytes": ...}}}.
An Agent handles one invocation at a time. A second concurrent call raises ConcurrencyException; create one agent per conversation (they are cheap) rather than sharing one across requests.
Model providers
Section titled “Model providers”Amazon Bedrock
Section titled “Amazon Bedrock”A string model becomes BedrockModel(model_id=...). Use BedrockModel directly for settings:
from strands import Agentfrom strands.models import BedrockModel, CacheConfig
model = BedrockModel( model_id="us.anthropic.claude-sonnet-5-5", region_name="eu-west-1", # or boto_session=boto3.Session(...) max_tokens=4096, temperature=0.2, cache_config=CacheConfig(strategy="auto"), # prompt caching for system prompt and tools context_window_limit=200_000, # used by proactive context management)
agent = Agent(model=model, callback_handler=None)model.update_config(temperature=0.0) # change settings between callsModel IDs. Claude models on Bedrock have IDs such as anthropic.claude-sonnet-5-5. Most are called through a cross-Region inference profile, which adds a geography prefix: us., eu., apac. or global. (for example us.anthropic.claude-haiku-5-5). Which prefixes exist depends on the model and Region; check the Bedrock model cards.
If you omit model, Strands uses its built-in default (global.anthropic.claude-sonnet-4-6 in this release) and logs a warning that the default can change. Set the model explicitly in anything you deploy.
Other BedrockModel options worth knowing:
| Option | Use |
|---|---|
guardrail_id, guardrail_version, guardrail_trace, guardrail_redact_input, guardrail_redact_output | Apply a Bedrock Guardrail to every call (see below) |
additional_request_fields | Model-specific fields, for example Claude extended thinking: {"thinking": {"type": "enabled", "budget_tokens": 4000}} |
stop_sequences, top_p | Sampling controls |
streaming=False | Use Converse instead of ConverseStream (for models without streaming tool use) |
boto_client_config | A botocore.config.Config (timeouts, retries, connection pool) |
api_key | A Bedrock API key instead of SigV4 credentials |
service_tier | Bedrock service tier |
The deprecated cache_prompt and cache_tools options still work but cache_config=CacheConfig(...) replaces them.
Bedrock Guardrails
Section titled “Bedrock Guardrails”from strands import Agentfrom strands.models import BedrockModel
model = BedrockModel( model_id="us.anthropic.claude-sonnet-5-5", guardrail_id="gr-abc123", guardrail_version="1", guardrail_trace="enabled", guardrail_redact_output=True, # replace blocked output in the history)agent = Agent(model=model, callback_handler=None)When the guardrail blocks, result.stop_reason is guardrail_intervened and, by default, the offending user input in agent.messages is replaced with a redaction message.
Anthropic, OpenAI and others
Section titled “Anthropic, OpenAI and others”Each provider is a Model class with its own client arguments and a params (or flat) config:
import os
from strands import Agentfrom strands.models.anthropic import AnthropicModelfrom strands.models.litellm import LiteLLMModelfrom strands.models.ollama import OllamaModelfrom strands.models.openai import OpenAIModel
claude = AnthropicModel( client_args={"api_key": os.environ.get("ANTHROPIC_API_KEY", "sk-ant-...")}, model_id="claude-sonnet-5-5", max_tokens=4096, params={"temperature": 0.2},)
gpt = OpenAIModel( client_args={"api_key": os.environ.get("OPENAI_API_KEY", "sk-...")}, model_id="gpt-6.1-sol", params={"max_completion_tokens": 2000},)
# Any OpenAI-compatible server (vLLM, LM Studio, a gateway) via base_urllocal_compatible = OpenAIModel( client_args={"api_key": "unused", "base_url": "http://localhost:8000/v1"}, model_id="my-model",)
anything = LiteLLMModel(model_id="mistral/mistral-medium-latest", params={"max_tokens": 1000})
llama = OllamaModel(host="http://localhost:11434", model_id="llama3.2", temperature=0.3)
agent = Agent(model=claude, callback_handler=None)| Class | Module | Constructor notes |
|---|---|---|
BedrockModel | strands.models | model_id, region_name or boto_session, flat config |
AnthropicModel | strands.models.anthropic | client_args (to anthropic.AsyncAnthropic), model_id, max_tokens (required), params |
OpenAIModel | strands.models.openai | Chat Completions. client_args or client=, model_id, params |
OpenAIResponsesModel | strands.models.openai_responses | Responses API; stateful=True keeps conversation state server-side |
GeminiModel | strands.models.gemini | client_args (to google.genai.Client), model_id, params |
LiteLLMModel | strands.models.litellm | model_id in LiteLLM’s provider/model form, params |
OllamaModel | strands.models.ollama | host (positional), model_id, temperature, max_tokens, options |
MistralModel | strands.models.mistral | api_key (or MISTRAL_API_KEY), model_id, max_tokens |
LlamaCppModel | strands.models.llamacpp | base_url of a llama.cpp server |
LlamaAPIModel, WriterModel, SageMakerAIModel | strands.models.llamaapi, .writer, .sagemaker | Provider-specific |
The Anthropic and OpenAI model IDs are the provider’s own (claude-sonnet-5-5, gpt-6.1-sol), not Bedrock IDs.
The remaining providers follow the same pattern. GeminiModel takes client_args for google.genai.Client and a params dict; MistralModel takes the key directly and flat settings; LlamaCppModel talks to a running llama.cpp server (started with llama-server -m model.gguf --port 8080) and has no model_id of its own; OpenAIResponsesModel uses the Responses API, where stateful=True keeps the conversation state on OpenAI’s side rather than resending the history:
import os
from strands import Agentfrom strands.models.gemini import GeminiModelfrom strands.models.llamacpp import LlamaCppModelfrom strands.models.mistral import MistralModelfrom strands.models.openai_responses import OpenAIResponsesModel
gemini = GeminiModel( client_args={"api_key": os.environ.get("GEMINI_API_KEY", "key")}, model_id="gemini-3.8-flash", params={"temperature": 0.3, "max_output_tokens": 2048},)
mistral = MistralModel( api_key=os.environ.get("MISTRAL_API_KEY", "key"), model_id="mistral-medium-latest", max_tokens=1024, temperature=0.3,)
local = LlamaCppModel(base_url="http://localhost:8080")
responses = OpenAIResponsesModel( client_args={"api_key": os.environ.get("OPENAI_API_KEY", "sk-...")}, model_id="gpt-6.1-sol", stateful=True,)
agent = Agent(model=gemini, callback_handler=None)OpenAI-compatible models on Bedrock
Section titled “OpenAI-compatible models on Bedrock”Bedrock serves some models (including OpenAI’s open-weight openai.gpt-oss-* models) through OpenAI-compatible endpoints. OpenAIModel and OpenAIResponsesModel can use them with bedrock_mantle_config, which sets the client’s base_url and mints a short-lived bearer token from your normal AWS credentials on every request, so you need no OpenAI key and long-running agents do not outlive a token:
from strands import Agentfrom strands.models.openai import OpenAIModel
model = OpenAIModel( model_id="openai.gpt-oss-120b", bedrock_mantle_config={"region": "us-west-2"},)agent = Agent(model=model, callback_handler=None)The config accepts endpoint, region, boto_session, credentials_provider and expiry. endpoint is "bedrock-mantle" by default; "bedrock-runtime" is the other endpoint family and the only one that accepts cross-Region inference profile IDs such as us.openai.*. Available models and Regions differ between the two, so check the Bedrock OpenAI-compatible APIs page. bedrock_mantle_config cannot be combined with a prebuilt client, and client_args must not contain api_key or base_url. It needs the openai extra, which installs the token generator.
Routing and fallback
Section titled “Routing and fallback”ModelRouter wraps several models. The default FallbackStrategy uses the first, and moves to the next when a call fails (after that model’s retries):
from strands import Agentfrom strands.models import BedrockModel, ModelRouterfrom strands.models.anthropic import AnthropicModel
router = ModelRouter([ BedrockModel(model_id="us.anthropic.claude-sonnet-5-5"), AnthropicModel(client_args={"api_key": "sk-ant-..."}, model_id="claude-sonnet-5-5", max_tokens=4096),])agent = Agent(model=router, callback_handler=None)Fallback is not strictly “first, then second”: a model that keeps failing sinks below healthier ones on later calls, and a success clears that model’s failure count.
ClassifierStrategy picks a model per call instead. It asks a classifier model (one that supports structured output) which candidate suits the latest request, so describe each candidate with RoutingCandidate. The names, descriptions and metadata are sent to the classifier, so keep secrets out of them:
from strands import Agentfrom strands.models import BedrockModel, ModelRouterfrom strands.models.routing import ClassifierStrategy, RoutingCandidate
router = ModelRouter( [ RoutingCandidate( BedrockModel(model_id="us.anthropic.claude-haiku-5-5"), name="fast", description="Cheap and quick; short factual answers and simple extraction.", ), RoutingCandidate( BedrockModel(model_id="us.anthropic.claude-sonnet-5-5"), name="deep", description="Slower; multi-step reasoning, long documents and code changes.", metadata={"context": "large"}, ), ], strategy=ClassifierStrategy(BedrockModel(model_id="us.anthropic.claude-haiku-5-5", temperature=0)),)agent = Agent(model=router, callback_handler=None)The classifier adds one model call per request. If it fails or times out (timeout=30.0 seconds by default), the router serves the first candidate; if the chosen candidate then fails, this strategy does not switch to another. A router has one strategy: use FallbackStrategy (the default) for failover and ClassifierStrategy for cost control. aux_model= on the agent is the simpler tool for cost: it moves Strands’ own side calls (context summarisation, memory extraction, judges) to a cheaper model while the main loop keeps model.
Writing a provider
Section titled “Writing a provider”A provider subclasses strands.models.Model and implements stream() (an async generator of Bedrock-style stream events), update_config(), get_config() and structured_output(). The scripted test model on the production page is a complete, minimal example; wrapping a new HTTP API follows the same shape, translating its chunks into messageStart, contentBlockStart/Delta/Stop, messageStop and metadata events.
Any function decorated with @tool is a tool. Its name is the function name, its description is the docstring, and the input schema comes from the type hints and the Args: section:
from typing import Literal
from strands import Agent, tool
@tooldef convert_temperature(value: float, to: Literal["C", "F"]) -> str: """Convert a temperature between Celsius and Fahrenheit.
Args: value: The temperature to convert. to: The unit to convert to. """ result = value * 9 / 5 + 32 if to == "F" else (value - 32) * 5 / 9 return f"{result:.1f}°{to}"
agent = Agent(model="us.anthropic.claude-sonnet-5-5", tools=[convert_temperature], callback_handler=None)print(agent.tool_names) # ['convert_temperature']print(convert_temperature(21, "F")) # still a normal function: 69.8°Fprint(agent.tool.convert_temperature(value=0, to="F")) # direct call, bypassing the modelTools can be async, can stream progress by yielding, can read the calling agent and per-request state through ToolContext, and can come from MCP servers or strands-agents-tools. All of that is on the tools and MCP page.
Structured output
Section titled “Structured output”Pass a Pydantic model as structured_output_model, on the agent (a default for every call) or per call. The validated instance is on result.structured_output:
from pydantic import BaseModel, Fieldfrom strands import Agent
class Invoice(BaseModel): """Fields extracted from an invoice."""
invoice_id: str total: float = Field(description="Total including VAT") currency: str = Field(description="ISO 4217 code, for example GBP")
agent = Agent(model="us.anthropic.claude-sonnet-5-5", callback_handler=None)result = agent("Extract: invoice INV-77, total £1,200.00 including VAT", structured_output_model=Invoice)invoice = result.structured_output # an Invoiceprint(invoice.invoice_id, invoice.total, invoice.currency)How it works: Strands adds a tool whose input schema is your model. The model can call other tools first; when it finishes without calling the output tool, Strands asks it once more, forcing that tool (structured_output_prompt= customises the request). Some providers enforce the schema natively instead. If no valid output arrives, StructuredOutputException is raised:
from pydantic import BaseModelfrom strands import Agentfrom strands.types.exceptions import StructuredOutputException
class Sentiment(BaseModel): label: str score: float
agent = Agent(model="us.anthropic.claude-sonnet-5-5", callback_handler=None)try: sentiment = agent("I love this product", structured_output_model=Sentiment).structured_outputexcept StructuredOutputException as exc: print("no structured output:", exc)Agent.structured_output(Model, prompt) from earlier releases still exists but is deprecated; use structured_output_model=.
Decision models
Section titled “Decision models”A decision model answers closed questions about some text: is this urgent, which team owns it, does this tool call need approval. It is a smaller primitive than an agent — no tools, no loop, one model call — and it is what the SDK’s own classifiers are built on. LLMDecisionModel adapts any Model; ask is async and takes the text plus a map of question identifiers to questions:
import asyncio
from strands import LLMDecisionModel, Uncertainfrom strands.models import BedrockModel
decision = LLMDecisionModel(model=BedrockModel(model_id="us.anthropic.claude-haiku-5-5"))
result = asyncio.run( decision.ask( "My card was charged twice for order 5512 and nobody has replied to my email.", { "team": { "question": "Which team should handle this?", "choices": ["billing", "technical", "sales"], "uncertainty": False, # force a choice: no uncertain answer }, "urgent": {"question": "Is the customer asking for urgent help?", "choices": "boolean"}, }, ))
for question_id, answer in result.answers.items(): if isinstance(answer, Uncertain): print(question_id, "uncertain:", answer.reason) else: print(question_id, answer) # 'billing', Trueprint(result.metadata.latency_ms, result.usage)Each question has a question and choices, which is either "boolean" or a list of strings. Answers come back keyed by the same identifiers: a bool for a boolean question, one of the choices otherwise, or an Uncertain when the model declines to commit. Uncertain is a truthy object, so narrow with isinstance(answer, Uncertain) rather than testing truthiness. Uncertainty is allowed by default; "uncertainty": False removes it from the choices offered to the model, and {"min_confidence": 0.8} sets a threshold for implementations that report confidence (LLMDecisionModel does not).
The question map must not be empty, choices must be unique and non-empty, and "uncertain" is reserved. Breaking those raises ValueError; a model that answers outside the choices or omits an answer raises StructuredOutputException. The user text is passed to the model as untrusted data, with instructions not to treat it as instructions, but the usual care still applies.
When you call a decision model from inside a hook, an intervention or a tool, pass the request’s context so its tokens are counted against that call:
result = await decision.ask(text, questions, invocation_context=event.invocation_context)The request’s limits never stop a decision, but the decision’s tokens are added to the request’s usage, so they count towards those limits for the rest of the call. Every ask opens a decision span (gen_ai.operation.name=decision, with the question ids and answers as span events), so decisions show up in traces alongside chat and execute_tool spans. DecisionModel is the base class if you want to back decisions with something other than a chat model; strands.decisions also exposes DecisionInput, Question, DecisionResult and DecisionMetadata for typing your own. The human-in-the-loop handler accepts a decision model directly as its risk classifier.
Streaming
Section titled “Streaming”There are two ways to receive events while the loop runs.
stream_async yields dictionaries. The useful keys:
| Key | When |
|---|---|
data | A text delta from the model (delta holds the raw delta) |
reasoningText | A reasoning (extended thinking) delta |
current_tool_use | The model is streaming a tool call (name, toolUseId, partial input) |
tool_stream_event | A streaming tool yielded progress |
message | A complete message was added (assistant turn or tool results) |
event | The raw provider stream event |
result | The final AgentResult (last event) |
init_event_loop, start, start_event_loop | Lifecycle markers |
import asyncio
from strands import Agent, tool
@tooldef lookup_stock(sku: str) -> int: """Return units in stock.
Args: sku: Product SKU. """ return 12
agent = Agent(model="us.anthropic.claude-sonnet-5-5", tools=[lookup_stock], callback_handler=None)
async def main() -> None: async for event in agent.stream_async("How many A-1 widgets are in stock?"): if "data" in event: print(event["data"], end="", flush=True) elif "current_tool_use" in event and event["current_tool_use"].get("name"): pass # a tool call is being streamed elif "message" in event and event["message"]["role"] == "user": print("\n[tool results returned]") elif "result" in event: print("\n[done]", event["result"].stop_reason)
asyncio.run(main())Callback handlers receive the same events as keyword arguments, for code that calls the agent synchronously:
from strands import Agent
def on_event(**kwargs) -> None: if "data" in kwargs: print(kwargs["data"], end="") if "current_tool_use" in kwargs and kwargs["current_tool_use"].get("name"): print(f"\n[calling {kwargs['current_tool_use']['name']}]")
agent = Agent(model="us.anthropic.claude-sonnet-5-5", callback_handler=on_event)agent("Tell me a short joke")strands.handlers.callback_handler has PrintingCallbackHandler (the default), null_callback_handler and CompositeCallbackHandler(*handlers).
For a web server, iterate stream_async and forward data events, as in the streaming recipe. Hooks are the better tool for side effects such as audit logs, because they fire whether or not anyone is consuming the stream.
Conversation management
Section titled “Conversation management”agent.messages grows with every turn. The conversation manager decides what to keep:
| Manager | Behaviour |
|---|---|
SlidingWindowConversationManager(window_size=40) | Default. After each cycle, drops the oldest messages beyond window_size, never splitting a tool call from its result. On a context overflow it first truncates oversized tool results (should_truncate_results=True), then trims |
SummarizingConversationManager(summary_ratio=0.3, preserve_recent_messages=10) | Does nothing until the context overflows, then replaces the oldest messages with a model-written summary. summarization_agent= or summarization_system_prompt= customise it |
NullConversationManager() | Never trims; overflow errors propagate |
from strands import Agentfrom strands.agent.conversation_manager import ( SlidingWindowConversationManager, SummarizingConversationManager,)
chat = Agent( model="us.anthropic.claude-sonnet-5-5", conversation_manager=SlidingWindowConversationManager(window_size=20, pin_first=1), callback_handler=None,)
support = Agent( model="us.anthropic.claude-sonnet-5-5", conversation_manager=SummarizingConversationManager(summary_ratio=0.4, preserve_recent_messages=8), aux_model="us.anthropic.claude-haiku-5-5", # summaries come from the cheaper model callback_handler=None,)pin_first=N keeps the first N messages (for example a document the user pasted at the start). proactive_compression=True makes either manager compress before the model call once 70% of the model’s context_window_limit is used ({"compression_threshold": 0.8} sets another ratio), instead of waiting for the provider to report an overflow.
The newer context_manager= argument replaces the conversation manager with a strategy pipeline: "auto" truncates large tool results and summarises at 85% utilisation, "agentic" gives the model tools to manage its own context, and False turns context management off. Set context_window_limit on the model when you use it, otherwise a 200,000-token default is assumed.
There are two kinds of state, and neither is shown to the model.
agent.state is durable, JSON-serialisable key-value data that lives with the agent and is saved by the session manager:
from strands import Agent
agent = Agent(model="us.anthropic.claude-sonnet-5-5", state={"tier": "gold"}, callback_handler=None)agent.state.set("cart", ["A-1", "B-2"])print(agent.state.get("cart"), agent.state.get("tier"))print(agent.state.get()) # the whole dictagent.state.delete("cart")Values must be JSON-serialisable; set raises ValueError otherwise.
invocation_state is per call: pass anything (including non-serialisable objects such as a database connection) and it reaches tools, hooks and sub-agents for that call only:
from strands import Agent, ToolContext, tool
@tool(context=True)def my_orders(tool_context: ToolContext) -> str: """List the current customer's orders.""" customer = tool_context.invocation_state["customer_id"] tier = tool_context.agent.state.get("tier") return f"{customer} ({tier}): ORD-1, ORD-2"
agent = Agent(model="us.anthropic.claude-sonnet-5-5", tools=[my_orders], state={"tier": "gold"}, callback_handler=None)agent("What have I ordered?", invocation_state={"customer_id": "C-456"})This is where user IDs, tenant IDs and credential handles belong: the model cannot see or change them.
Sessions
Section titled “Sessions”A session manager saves agent.messages, agent.state and the conversation manager’s state, and restores them when an agent with the same session ID is created, so a conversation survives process restarts.
from strands import Agentfrom strands.session import FileSessionManager
def make_agent(session_id: str) -> Agent: return Agent( model="us.anthropic.claude-sonnet-5-5", session_manager=FileSessionManager(session_id=session_id, storage_dir="./sessions"), callback_handler=None, )
make_agent("user-42")("My name is Priya.")later = make_agent("user-42") # a new process could do thisprint(len(later.messages)) # 2: the earlier turn was restored| Manager | Storage |
|---|---|
FileSessionManager(session_id, storage_dir=None) | One JSON file per message on local disk |
S3SessionManager(session_id, bucket, prefix="", region_name=None, boto_session=None) | The same layout in S3 |
SnapshotSessionManager(session_id, storage=...) | The whole agent as one versioned snapshot per save, through a Storage backend (LocalFileStorage, S3Storage, InMemoryStorage from strands.storage); supports immutable checkpoints with snapshot_trigger= |
AgentCoreMemorySessionManager (in bedrock-agentcore) | Amazon Bedrock AgentCore Memory, with long-term memory retrieval |
RepositorySessionManager(session_id, session_repository) | Your own SessionRepository (for example DynamoDB or Redis) |
from strands import Agentfrom strands.session import S3SessionManager, SnapshotSessionManagerfrom strands.storage import S3Storage
per_message = S3SessionManager(session_id="user-42", bucket="agent-sessions", prefix="support/")
snapshots = SnapshotSessionManager("user-42", storage=S3Storage("agent-sessions", prefix="snapshots/"))
agent = Agent(model="us.anthropic.claude-sonnet-5-5", session_manager=snapshots, callback_handler=None)agent("Hello")The message-log managers write one object per message; the snapshot manager writes the whole agent atomically and is the one Strands recommends for new agents. Session IDs and agent IDs must not contain path separators. Members of a Swarm or Graph cannot have their own session manager; give one to the swarm or graph instead.
Snapshots
Section titled “Snapshots”A Snapshot is the agent’s state as one JSON-compatible object. agent.take_snapshot() captures it and agent.load_snapshot() puts it back, with no storage involved — useful for a speculative branch you may want to undo, for moving an agent between processes, or for your own persistence:
import json
from strands import Agent, Snapshot
agent = Agent(model="us.anthropic.claude-sonnet-5-5", state={"tier": "gold"}, callback_handler=None)agent("My name is Priya.")
before = agent.take_snapshot(preset="session", app_data={"label": "after-greeting"})agent("Actually, forget everything I said.")
agent.load_snapshot(before) # the second turn is gone, state and history are as they wereprint(len(agent.messages)) # 2
saved = json.dumps(before.to_dict()) # store it wherever you likerestored = Snapshot.from_dict(json.loads(saved))agent.load_snapshot(restored)The fields are messages, state, conversation_manager_state, interrupt_state, system_prompt and model_state. preset="session" is the first four; include=[...] adds fields and exclude=[...] removes them, and an unknown name raises SnapshotException. app_data= holds anything of your own, stored verbatim. Loading restores only the fields the snapshot carries and leaves the rest alone, and it refuses a snapshot whose schema_version is not "1.0" or whose scope is not "agent". An agent with background tasks still in flight cannot load one.
SnapshotSessionManager uses the same objects, and snapshot_trigger= makes each one an immutable checkpoint you can rewind to:
import asyncio
from strands import Agentfrom strands.session import SnapshotSessionManagerfrom strands.storage import LocalFileStorage
sessions = SnapshotSessionManager( "user-42", storage=LocalFileStorage("./sessions"), snapshot_trigger=lambda *, agent_data, **kwargs: True, # checkpoint after every invocation)agent = Agent(model="us.anthropic.claude-sonnet-5-5", session_manager=sessions, callback_handler=None)agent("First question")agent("Second question")
checkpoints = asyncio.run(sessions.list_snapshot_ids(agent)) # oldest firstagent("Third question")asyncio.run(sessions.restore_snapshot(agent, snapshot_id=checkpoints[0]))print(len(agent.messages)) # back to the first exchangeThese four methods are async. save_snapshot(agent, is_latest=False) forces a checkpoint at any point, list_snapshot_ids pages with limit= and start_after=, restore_snapshot without an id restores the latest, and delete_session() removes the lot. save_latest_on= controls how often the latest snapshot is overwritten: "invocation" (the default), "message", or "trigger" for trigger-only saves. Guardrail redactions are flushed immediately whichever you choose.
AgentCore Memory
Section titled “AgentCore Memory”For managed short- and long-term memory on AWS, use the session manager in bedrock-agentcore:
# pip install "bedrock-agentcore==1.26.0"from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig, RetrievalConfigfrom bedrock_agentcore.memory.integrations.strands.session_manager import AgentCoreMemorySessionManagerfrom strands import Agent
config = AgentCoreMemoryConfig( memory_id="CustomerMemory-abc123", session_id="session-123", actor_id="customer-42", retrieval_config={"/facts/{actorId}/": RetrievalConfig(top_k=5, relevance_score=0.3)},)
agent = Agent( model="us.anthropic.claude-sonnet-5-5", session_manager=AgentCoreMemorySessionManager(config, region_name="us-west-2"),)Turns are written to AgentCore Memory as events; long-term records extracted by the memory’s strategies are retrieved and added to the context on each turn. Creating the memory resource itself is covered in the AgentCore guide.
Long-term memory
Section titled “Long-term memory”A session replays one conversation. A MemoryManager gives an agent memory that outlives conversations: a preference mentioned last week can be found today, in a different session. It is a plugin passed as memory_manager=, and it works with one or more stores.
What the manager adds to the agent:
- Injection (on by default). Before the model call for each new user message, the manager searches its stores with the message and appends the matches to the model input as a
<memory>block. The block is not written toagent.messages, so it never accumulates in the history or the session.injection=Falseturns it off, and aMemoryInjectionConfigcustomises the query, the formatting, the number of entries and the trigger ("userTurn"by default, or"everyTurn"for agents that should consult memory mid-task). - A
search_memorytool (on by default), so the model can search when injection did not find what it needs. - An
add_memorytool (off by default;add_tool_config=True), so the model can save facts as the user shares them. - Automatic extraction, configured on a store with
extraction=. A model reads recent turns and writes durable facts to the store, by default every five invocations (IntervalTrigger(turns=...)andInvocationTrigger()change that; the extractor costs a model call, andaux_model=can make it a cheaper one).
Stores are small objects with a name, a search() method and, if writable, an add() method:
| Store | Backing | Search |
|---|---|---|
FileMemoryStore (strands.vended_memory_stores.file_memory_store) | Markdown files, one per topic, under ./.strands/memory/<name>/ (any strands.storage backend, such as S3Storage, can replace the local disk) | Keyword overlap |
BedrockKnowledgeBaseStore (strands.vended_memory_stores.bedrock_knowledge_base) | An Amazon Bedrock Knowledge Base, optionally scoped per user | Semantic |
TestMemoryStore (strands.vended_memory_stores.test_memory_store) | A local JSON file, or in memory | Keyword overlap; for prototypes and tests |
| Your own | Anything implementing the MemoryStore protocol (strands.memory) | Yours |
Mem0 is available through the mem0-strands package, which provides a Mem0MemoryStore for the same manager.
from strands import Agentfrom strands.memory import MemoryManagerfrom strands.vended_memory_stores.file_memory_store import FileMemoryStore
store = FileMemoryStore(name="assistant-memory")memory = MemoryManager(stores=[store], add_tool_config=True)
# Conversation 1: the model saves a fact with add_memoryfirst = Agent(model="us.anthropic.claude-sonnet-5-5", memory_manager=memory, callback_handler=None)print(first.tool_names) # ['search_memory', 'add_memory']first("Remember that I prefer metric units.")
# Conversation 2, in a new agent (or a new process): the fact is injected before the model callsecond = Agent( model="us.anthropic.claude-sonnet-5-5", memory_manager=MemoryManager(stores=[FileMemoryStore(name="assistant-memory")]), callback_handler=None,)print(second("Which units do I prefer?"))With FileMemoryStore, the first line of an entry (a Markdown heading such as # User preferences) becomes the file name, and later facts under the same heading are appended to the same file. await memory.search("units") and await memory.add("...") use the same stores directly from your own code, for example to seed a store or to show a user what is remembered.
Memory is shared by everyone who uses the store, so give each user their own store name (or, for the Knowledge Base store, their own scope) and keep personal data out of stores you do not control. Retrieved text reaches the model verbatim; treat what the store holds as untrusted input if users can write to it.
Limits, cancellation and concurrency
Section titled “Limits, cancellation and concurrency”import threading
from strands import Agent
agent = Agent(model="us.anthropic.claude-sonnet-5-5", callback_handler=None)
# Budget caps for one call; the loop stops cleanly at the next turn boundaryresult = agent("Research this thoroughly", limits={"turns": 8, "total_tokens": 50_000})if result.stop_reason.startswith("limit_"): print("stopped early:", result.stop_reason)
# Cancellation from outside (client disconnect, timeout)stop = threading.Event()timer = threading.Timer(30, stop.set)timer.start()try: result = agent("Write a long report", cancel_signal=stop) # stop_reason == "cancelled" if it firedfinally: timer.cancel()agent.cancel() cancels the current call from another thread or task; cancel(message=...) makes that text the final assistant message, and cancel(after_current_tools=True) is the cooperative version — tools already requested in this turn finish, and the loop exits before the next model call (this is what the vended stop tool uses). A cancellation that interrupts the loop returns stop_reason == "cancelled"; a deferred one that never gets to apply, because the turn ended in plain text, is a no-op. Token limits are soft: a single large response can overshoot by one turn. Limits are per call, not cumulative.
idempotency_token= deduplicates retried requests: a second call with the same token while the first is running waits for and returns the first call’s result.
Errors
Section titled “Errors”Exceptions live in strands.types.exceptions:
| Exception | Raised when |
|---|---|
ModelThrottledException | The provider is still throttling after all retries |
ContextWindowOverflowException | The input does not fit and the conversation manager could not reduce it |
MaxTokensReachedException | The model hit max_tokens mid-response |
StructuredOutputException | No valid structured output was produced |
ConcurrencyException | A second call was made while one is running |
MCPClientInitializationError | An MCP server could not be started |
SessionException, SnapshotException | Session storage failed |
EventLoopException | Wraps other failures inside the loop |
import logging
from strands import Agentfrom strands.types.exceptions import ( ContextWindowOverflowException, MaxTokensReachedException, ModelThrottledException,)
log = logging.getLogger(__name__)agent = Agent(model="us.anthropic.claude-sonnet-5-5", callback_handler=None)
def answer(text: str) -> str: try: return str(agent(text)).strip() except ModelThrottledException: log.warning("still throttled after retries") raise except (ContextWindowOverflowException, MaxTokensReachedException) as exc: log.warning("context or output limit: %s", exc) raiseStrands already retries throttling, so do not wrap every call in a second retry loop; adjust retry_strategy=ModelRetryStrategy(max_attempts=..., initial_delay=..., max_delay=...) instead. Logging uses the strands logger: logging.getLogger("strands").setLevel(logging.DEBUG) shows requests and tool calls.
Real-time voice and text with BidiAgent
Section titled “Real-time voice and text with BidiAgent”Agent is request and response: one call in, one result out. BidiAgent (from strands.bidi) keeps a persistent connection to a real-time model, so audio or text can flow in while the model is still speaking. The user can interrupt (barge in), tools run while the conversation continues, and the connection is renewed before the provider’s session limit. Use it for voice assistants and live-captioned chat; use Agent for everything else, because it has more features (see the limits at the end of this section).
Install
Section titled “Install”The pieces are separate extras, so install what you use:
| Extra | Adds | Python |
|---|---|---|
bidi | The Bedrock client for BedrockNovaSonicModel (Amazon Nova Sonic) | 3.12 or later |
bidi-openai | OpenAIRealtimeModel (WebSocket) | 3.10 or later |
bidi-google | GoogleGeminiLiveModel | 3.10 or later |
bidi-io | ConsoleIO, a text console for trying an agent in a terminal | 3.10 or later |
bidi-pyaudio | AudioIO, microphone and speaker through PyAudio (needs the PortAudio system library) | 3.10 or later |
bidi-aec | Echo cancellation and noise suppression for AudioIO(audio_processor=True) | 3.10 or later |
bidi-all installs the lot. OpenAILiveModel (extra bidi-openai-live) is a second OpenAI provider that warns it is experimental.
pip install "strands-agents[bidi,bidi-pyaudio]==1.64.0"A voice agent
Section titled “A voice agent”BidiAgent takes the same tools, system_prompt, hooks, state, messages and session_manager as Agent, and a BidiModel instead of a text model. With no model, it uses Nova Sonic (amazon.nova-2-5-sonic). run() connects the model to input and output streams until the connection closes:
import asyncio
from strands import toolfrom strands.bidi import BidiAgentfrom strands.bidi.io import AudioIOfrom strands.bidi.models import BedrockNovaSonicModel
@tooldef get_weather(city: str) -> str: """Get the weather for a city.
Args: city: City name. """ return f"Rain in {city}"
model = BedrockNovaSonicModel(model_id="amazon.nova-2-5-sonic", voice="matthew")agent = BidiAgent( model=model, tools=[get_weather], system_prompt="You are a friendly voice assistant. Keep answers short.",)
async def main() -> None: audio_io = AudioIO() await agent.run(inputs=[audio_io.input()], outputs=[audio_io.output()])
asyncio.run(main())This needs AWS credentials with access to the model, a microphone and speakers, so it was checked for imports and constructor arguments only. AudioIO reads the sample rate and format from the model (model.get_audio_config(); 16 kHz mono PCM for Nova Sonic by default), clears its playback buffer when the user barges in, and takes device and buffer options. Other providers differ only in the model object:
| Model | Constructor |
|---|---|
BedrockNovaSonicModel | model_id (required), boto_session or region, audio, voice="matthew" |
GoogleGeminiLiveModel | model_id (required), client_args (for the Google GenAI client), audio, voice |
OpenAIRealtimeModel | model_id and transcription_model_id (both required; None turns off user transcription), api_key (or OPENAI_API_KEY), voice="alloy", timeout_s |
All three accept params (provider-specific request options) and connection, for example connection={"auto_restart": False}.
Driving the connection yourself
Section titled “Driving the connection yourself”run() suits a microphone. To feed the agent from a WebSocket, a test or your own UI, use the agent as an async context manager and call send() and receive(), or pass your own streams to run(). An input stream is an async callable returning the next input; an output stream is an async callable that takes each event. Either may define start(agent) and stop().
The example below runs offline. ScriptedLiveModel stands in for a real-time model (it asks for get_weather when it receives text, then reports the result), so it also shows what a BidiModel must implement: start, stop, send, receive, get_config and update_config.
import asynciofrom collections.abc import AsyncIterablefrom typing import Any
from strands import toolfrom strands.bidi import BidiAgentfrom strands.bidi.hooks import BidiAgentStopEventfrom strands.bidi.models import BidiModelfrom strands.bidi.types import ( BidiAgentInput, BidiConnectionStartEvent, BidiMessage, BidiOutputEvent, BidiResponseStartEvent, BidiResponseStopEvent, BidiTextDeltaEvent, BidiTextStartEvent, BidiTextStopEvent, BidiToolUseBlocksEvent,)from strands.hooks import BeforeToolCallEventfrom strands.types.tools import ToolResultBlock
@tooldef get_weather(city: str) -> str: """Get the weather for a city.
Args: city: City name. """ return f"Rain in {city}"
class ScriptedLiveModel(BidiModel): """Stands in for a real-time model: asks for get_weather, then reports the tool result."""
def __init__(self) -> None: self.config: dict[str, Any] = {"model_id": "scripted-live"} self.inbox: asyncio.Queue = asyncio.Queue()
def get_config(self) -> dict[str, Any]: return self.config
def update_config(self, **model_config: Any) -> None: self.config.update(model_config)
async def start(self, system_prompt=None, tools=None, messages=None, **kwargs) -> None: pass
async def stop(self) -> None: pass
async def send(self, content) -> None: await self.inbox.put(content)
async def receive(self) -> AsyncIterable[BidiOutputEvent]: yield BidiConnectionStartEvent(connection_id="c1", model="scripted-live") while True: content = await self.inbox.get() if isinstance(content, BidiMessage) and isinstance(content.content[0], ToolResultBlock): text = f"It says: {content.content[0].content[0]['text']}" yield BidiTextStartEvent(content_id="t1") yield BidiTextDeltaEvent(delta=text, content_id="t1") yield BidiTextStopEvent(content_id="t1") yield BidiResponseStopEvent(response_id="r1") continue yield BidiResponseStartEvent(response_id="r1") yield BidiToolUseBlocksEvent( tool_uses=[{"toolUseId": "u1", "name": "get_weather", "input": {"city": "Leeds"}}] )
class OneQuestion: """An input stream: yields one question, then waits for ever."""
def __init__(self) -> None: self.asked = False
async def __call__(self) -> BidiAgentInput: if not self.asked: self.asked = True return "What's the weather in Leeds?" await asyncio.Event().wait() raise AssertionError("unreachable")
agent = BidiAgent(model=ScriptedLiveModel(), tools=[get_weather], system_prompt="Be brief.")
def log_tool(event: BeforeToolCallEvent) -> None: print("tool:", event.tool_use["name"], event.tool_use["input"], event.invocation_state.get("user_id"))
def on_stop(event: BidiAgentStopEvent) -> None: print("agent stopped; messages kept:", len(event.agent.messages))
agent.add_hook(log_tool)agent.add_hook(on_stop)
async def print_text(event: BidiOutputEvent) -> None: if event.get("type") == "bidi_text_delta": print("assistant:", event["delta"])
async def main() -> None: try: await asyncio.wait_for( agent.run(inputs=[OneQuestion()], outputs=[print_text], invocation_state={"user_id": "u-17"}), timeout=3, ) except asyncio.TimeoutError: pass # run() returns only when the connection closes; here we just stop waiting
asyncio.run(main())The same agent can be driven without run():
async def chat() -> None: async with agent: # start() on entry, stop() on exit await agent.send("What's the weather in Leeds?") async for event in agent.receive(): if event.get("type") == "bidi_text_delta": print(event["delta"], end="") elif event.get("type") == "bidi_response_stop": breaksend() accepts a string, a TextBlock or ImageBlock, their dict forms ({"text": ...}, {"image": {...}}), a list of those (one user message), and AudioDelta or {"audio_delta": {...}} for streamed audio, which is sent one chunk at a time and is not stored in the history.
Events and hooks
Section titled “Events and hooks”receive() yields typed events; each has a type:
type | Meaning |
|---|---|
bidi_connection_start, bidi_connection_stop | Connection opened; closed (reason user_request after cancel()) |
bidi_response_start, bidi_response_stop | One model response begins and ends |
bidi_audio_start, bidi_audio_delta, bidi_audio_stop | Output audio; a delta carries base64 audio, format, sample_rate, channels |
bidi_text_*, bidi_reasoning_* | Start, delta, stop for text and reasoning; the agent adds a completed bidi_text_block or bidi_reasoning_block |
bidi_transcript_* | Speech transcripts with a role of user or assistant, and a completed bidi_transcript_block |
bidi_barge_in | The user interrupted; stop playing queued audio |
bidi_tool_use_blocks | The model asked for one group of tool calls |
bidi_usage | Token counts since the last usage event (add them up; breakdowns may overlap) |
bidi_connection_warning, bidi_connection_restart | A renewal is coming; the connection was renewed (reason is scheduled or timeout, and turn_interrupted says whether a response was cut off) |
Tool execution also yields events (tool_result, and message when the results are recorded) that are plain dicts without a type key, which is why the examples use event.get("type").
Hooks are registered with add_hook() or hooks=[...] (hook providers only). The agent-loop tool events (BeforeToolCallEvent, AfterToolCallEvent) and MessageAddedEvent fire as usual, and strands.bidi.hooks adds BidiResponseStopEvent, BidiBargeInEvent, BidiBeforeConnectionRestartEvent, BidiAfterConnectionRestartEvent and BidiAgentStopEvent.
Connections renew themselves
Section titled “Connections renew themselves”Real-time providers close sessions after a fixed time. The agent restarts the model connection ahead of the limit, waiting briefly for the current turn to finish; how much context survives depends on the provider’s replay or resumption support. The default schedule comes from each model’s connection config: restart_after_s is 420 seconds for Nova Sonic, 540 for Gemini Live and 2700 for OpenAI Realtime in this release. Set connection={"restart_after_s": ..., "auto_restart": False} on the model to change that or to receive the timeout as an exception instead. A response in progress can be cut by a restart, so watch turn_interrupted and re-prompt if it matters.
What BidiAgent does not have
Section titled “What BidiAgent does not have”It shares tools, hooks, state and sessions with Agent, but not the rest: no structured_output_model, no limits= or cancel_signal= per call (agent.cancel() closes the connection once any running tool group finishes), no plugins=, interventions= or conversation manager, and event_loop_metrics raises NotImplementedError. Token usage arrives as bidi_usage events instead. For a session manager, SnapshotSessionManager(bidi_agent_save_latest_on=...) controls when the conversation is saved ("message" by default, or "stop").
Other features
Section titled “Other features”These exist in this release and are worth knowing about, but are newer and change more often than the core:
- Plugins and Agent Skills (
plugins=[AgentSkills(skills=["./skills"])]): see hooks and interrupts. The same page coversContextInjector,GoalLoop,ContextOffloaderand steering handlers. - Sandboxes (
sandbox=DockerSandbox(...)): route the vended shell and file tools into a container. See tools. - Long-term memory (
memory_manager=MemoryManager(stores=[...])): see above. - Real-time voice (
strands.bidi.BidiAgent): see above. - Background tools (
background_tasks=True): the model can start tools in the background and receive their results later. See tools. - Checkpointing (
checkpointing=True): the loop pauses at cycle boundaries withstop_reason == "checkpoint"and aresult.checkpoint, so a durable execution engine such as Temporal can persist progress and resume after a crash. The checkpoint types live instrands.experimental.checkpointand may change. - Concurrent invocations: by default a second call on a busy agent raises
ConcurrencyException.concurrent_invocation_mode=ConcurrentInvocationMode.UNSAFE_REENTRANT(fromstrands.types.agent) lifts the lock without making the agent safe to share; the documentation for the option gives no guarantees about what happens to the history.
Revision history
Section titled “Revision history”| Date | Version | Changes |
|---|---|---|
| 2026-11-13 | 1.64.0 | Added decision models (LLMDecisionModel, Question, Uncertain) and snapshots (take_snapshot, load_snapshot, checkpoint and rewind with SnapshotSessionManager). Documented cancel(message=..., after_current_tools=True) and moved background tools to the tools page. |
| 2026-10-24 | 1.64.0 | Audit against the installed packages. Added real-time voice (BidiAgent, models, I/O, events, hooks, limits), long-term memory (MemoryManager), OpenAI-compatible Bedrock endpoints (bedrock_mantle_config), ClassifierStrategy routing, Gemini, Mistral, llama.cpp and Responses API examples, and background tasks, checkpointing and concurrent-invocation options. Corrected the extras table (voice extras, Python 3.12 for Nova Sonic). |
| 2026-10-24 | 1.62.0 | New page in the standalone Strands guide, replacing the Strands page in the Amazon Bedrock guide. Adds the agent loop, AgentResult, provider table, routing, streaming events, conversation and context managers, snapshot sessions, limits and cancellation. All examples run against an offline Bedrock stub. |