Strands Agents tutorial: managing agent context

Learn context management with Strands Agents, including memory pointers, a 50% summary ratio, four retained messages and limits on tool calls.

Player not loading? Watch on YouTube

Elizabeth Fuentes Leone explains how large tool responses can overwhelm an AI agent's context. Using an application that repeatedly retrieves logs, she argues that a larger context window alone does not solve the problem: models can miss information in the middle of long inputs.

The talk uses Strands Agents, described as an open source, model-agnostic framework, to demonstrate four approaches: externalize data, select relevant information, compress history and isolate context across agents. Conversation managers can retain recent messages or summarize older exchanges. Her summarization example sets a 50% summary ratio and preserves the last four messages.

For large log responses, she stores the data outside the conversation and keeps a memory pointer ID for later retrieval. She also explains how agents in a swarm can share pointers through invocation state rather than pass the full data between them. A separate discussion covers recent conversation history, vector databases for longer-term memory and graphs for relationships.

The examples cap individual tools at three calls to curb repeated invocation. For slow MCP tools or external APIs, she presents asynchronous handles with separate job-start and status-check tools. She closes by warning against stuffing context with unnecessary data and summarizing away details an agent still needs.