Skip to main content

Claude plays Catan: Managing agent context with Sonnet 4.5

TL;DR

  • Claude API now offers new features for managing an AI agent's context, crucial for long-term interactions and complex tasks.
  • Context editing automatically clears stale information from the context window when token limits are approached, keeping the focus on relevant data.
  • A new memory tool enables the AI to store and consult information outside the immediate context window, facilitating the creation of persistent knowledge bases.

Takeaways

  • Claude API has introduced context editing and a memory tool to enhance AI agent context management.
  • Context editing automatically removes older, less relevant tool calls and their results from the agent's context window.
  • This automatic clearing occurs as the agent approaches its token limits, ensuring the context remains clean and focused.
  • The memory tool provides a mechanism for the AI to store and retrieve information that persists beyond the current context window.
  • These capabilities allow AI agents to build and consult a persistent knowledge base across extended interactions, like tracking opponent strategies in a game.
  • The example of an AI playing Catan demonstrates how these features enable long-term planning and processing of thousands of game events without context overload.
  • These new context management features are now available on the Claude Developer platform.

Vocabulary

Claude API — A set of services and protocols provided by a cloud platform that allows developers to build applications and interact with its infrastructure. agent's context — The relevant information an AI agent retains about a conversation or task to understand new inputs and generate coherent responses. context window — The specific portion of an AI model's input buffer where it processes current information, constrained by token limits. token limits — The maximum number of tokens (words or sub-word units) an AI model can process in its context window at any given time. tool calls — Instructions or requests made by an AI agent to external tools or functions to retrieve information or perform actions. memory tool — A mechanism that allows an AI agent to store and retrieve information outside its immediate context window, enabling long-term memory. knowledge base — A structured repository of information, facts, and rules that an AI system can consult for reasoning and decision-making.

Transcript

We're introducing new capabilities for managing your agent's context on the Claude API. Context editing automatically clears stale tool calls and results from within the context window when approaching token limits. And the memory tool enables Claude to store and consult information outside the context window. Let me show you these capabilities in action with something unexpected, a game of Catan. Catan is a strategy board game that requires planning over a long time horizon, sharp negotiation skills and careful observation. Watch as Claude plays against three opponents – Ace, Maven and Scout. Claude is building a knowledge base that persists across games with memory files about each opponent's strategies, like how Maven holds bricks or Ace has a stock pile of wood. As the game progresses, trades, moves, car draws and other events accumulate, eventually overwhelming the context. But context editing automatically removes older, less relevant information. After 75 minutes of play, Claude has processed thousands of game events, yet the context remains clean and focused. These features are now available on the Claude Developer platform.

Feedback / ReportSpotted an issue or have an improvement idea?