Built-in Modes
The SDK ships two built-in context management modes that
work out of the box. Both create a ContextManager with
tuned Offload strategies internally, so you don’t have to
assemble strategies, thresholds, and storage by hand.
For full control over the strategy pipeline, see Custom Strategies. For named shorthand configurations, see Strategy Presets.
Automatic context management
Section titled “Automatic context management”Pass
context_manager="auto"contextManager: "auto"
from strands import Agent
agent = Agent(context_manager="auto")import { Agent } from '@strands-agents/sdk'
const agent = new Agent({ contextManager: 'auto',})What it sets up
Section titled “What it sets up”Two strategies whose defaults scored highest across ContextBench evaluations:
- Truncate tool results (threshold: 1,500 tokens, preview: 750 tokens): intercepts large tool results at execution time, stores them in the stash, and keeps a truncated preview in context. Registers a retrieval tool so the agent can fetch full content on demand.
- Summarize on pressure (utilization: 85%): when the context window reaches 85% capacity, summarizes the oldest messages to free space, preserving the 4 most recent messages verbatim.
Agentic context management
Section titled “Agentic context management”Auto mode compresses on a fixed threshold the SDK controls.
Agentic mode hands that control to the model. Pass
context_manager="agentic"contextManager: "agentic"
from strands import Agent
agent = Agent(context_manager="agentic")import { Agent } from '@strands-agents/sdk'
const agent = new Agent({ contextManager: 'agentic',})The model is better positioned than a threshold to know which messages still matter. A coding agent can drop a stale file it already edited while pinning the failing test it is working toward. A threshold cannot tell the difference; it compresses by age. Agentic mode trades tokens for that judgment.
What it sets up
Section titled “What it sets up”Two things give the model the information and the levers to manage context.
Token-usage telemetry. Before each model call, the SDK appends a status block to the latest message reporting how much of the window is in use:
<context-status><used>50,000 / 200,000 tokens (25.0%)</used><remaining>~150,000 tokens</remaining></context-status>This is the signal the model acts on. It decides whether the window is full enough to compress, instead of waiting for a fixed cutoff.
Three tools the model can call, each a different lever with its own choices:
summarize_contextfolds older messages into a model-written summary. The model chooses how many recent messages to keep verbatim, how aggressively to summarize, and whether to target tool results, discussion, or both.truncate_contextdrops older messages outright when they no longer need preserving. The model again chooses how much recent history to keep and what kind of messages to target.pin_contextmarks messages that must survive compression: a user constraint, a key fact, the current task. Pinned messages are never evicted by either tool. The model can pin the current exchange, the last few messages, or specific ones.
Recent messages stay verbatim regardless, and the first user message is always preserved so the conversation stays valid. New tools may be added to agentic mode in future releases.
Behind the tools, agentic mode also configures a
ContextManager with truncation and summarization
strategies. The truncation threshold is higher than auto
mode (8,000 tokens versus 1,500), since the model is
already managing context and benefits from seeing more
tool output inline. Summarization only triggers on overflow
(100% utilization), acting as a safety net if the model lets
the window fill.
Choosing between auto and agentic
Section titled “Choosing between auto and agentic”Use "auto" for most agents. It manages context in the
background, with no model involvement and no extra tool
calls. Reach for "agentic" when you want the model itself
to decide what stays in context: it judges relevance per
message rather than compressing on a fixed threshold. The
tradeoff is the tokens the model spends reading telemetry
and calling the tools.
Disabling context management
Section titled “Disabling context management”To turn off all context management (no compression, no
offloading), pass false:
from strands import Agent
agent = Agent(context_manager=False)import { Agent } from '@strands-agents/sdk'
const agent = new Agent({ contextManager: false,})The agent runs without any context reduction. Overflow errors propagate directly. This is useful for short conversations or when you handle context externally.