Home › Learn › AI Agents
AI Agents

What is In-context memory?

The conversation history passed to the model on every call — the agent's short-term memory, bounded by the context window (~200K tokens for current Claude models).

How it works

The model is stateless; it only 'remembers' what you resend each turn. That's why the loop appends every message — including tool results — verbatim. When you outgrow the window, you need external memory.

Example

In practiceOn each iteration the agent resends the full message list so the model sees prior tool results and its own earlier reasoning.

Why append the response verbatim?

The response carries the tool_use blocks the next request needs. Extract only the text and the loop breaks in ways that look like model error but are your bug.

Go deeper: Deploy Your First AI Agent

The complete, step-by-step guide — every command, config, and the reasoning behind it.

Get the guide