---
title: "What is working memory in AI agents?"
description: "Working memory is what an AI agent holds in the context window during one task: what it contains, its limits, and its link to long-term storage."
canonical: https://past.dev/glossary/working-memory
last-updated: 2026-09-02
---
# Working memory

Source: https://past.dev/glossary/working-memory

Working memory is the information an agent holds inside the current context window while performing one task. It includes the instructions, the conversation so far, retrieved records, and tool results. Working memory is fast and complete while the task runs, and it is gone when the session ends or the window fills. Anything worth keeping must be written to long-term memory before that happens.

## What working memory holds

Working memory is bounded by the [context window](/glossary/context-window), the amount of text the model can attend to in one call, measured in tokens. Everything the agent can currently see competes for that space:

- **Instructions**: the system prompt and task definition.
- **Dialogue**: the conversation so far.
- **Recalled memory**: records retrieved from long-term storage for this task.
- **Tool results**: outputs from searches, lookups, and actions.
- **Intermediate reasoning**: drafts and partial conclusions the agent produces on the way to an answer.

## Why it matters for AI agents

Working memory is the only memory the model actually computes over. Long-term storage affects an answer only when the right records are recalled into the window. Selection therefore matters more than raw window size: an over-filled window degrades attention, a problem described as [context rot](/glossary/context-rot). Choosing what enters the window is the subject of [context engineering](/context-engineering).

Working memory is also temporary. What persists within one conversation is [session memory](/glossary/session-memory); when the session ends, all of it is discarded. Long-conversation suites such as [LoCoMo](/benchmarks/locomo) measure what happens when an answer depends on information that has already left the window. An external memory API such as [past.dev](/docs/memory-api/quickstart) keeps the full history outside the window and returns the records a query needs.

## Working memory in practice

A support agent works ticket 4821 from Acme Corp. Working memory holds the ticket text, the last three customer messages, the refund procedure recalled from procedural memory, and one invoice lookup result. That is enough to resolve the ticket, and none of it needs to stay in the window afterward.

When the ticket closes, the resolution is written to long-term memory with the date, September 1, and the window is cleared. The next ticket starts with an empty window. If Acme writes again in October, the September resolution is recalled into working memory only because it is relevant then.

## Related concepts

- **[Episodic memory](/glossary/episodic-memory)**: past events recalled into the window when a task needs them.
- **[Semantic memory](/glossary/semantic-memory)**: standing facts recalled into the window, such as the customer's plan.
- **[Procedural memory](/glossary/procedural-memory)**: stored task steps loaded for the current job.
- **[Long-term memory](/glossary/long-term-memory)**: everything kept outside the window between tasks.
- **[Context window](/glossary/context-window)**: the token limit that bounds working memory.

## Frequently asked questions

### What is working memory in an AI agent?

Working memory is everything the agent's model can see in the current context window: instructions, the conversation, retrieved records, and tool results. It exists only while the task runs.

### Is the context window the same as working memory?

The context window is the capacity limit, measured in tokens. Working memory is the information currently held within that limit. The window sets how much working memory an agent can have.

### What happens to working memory when a session ends?

It is discarded. Anything the agent should still know later has to be written to a long-term store before the session ends, and recalled from there next time.

## Related

- [Context window](https://past.dev/glossary/context-window)
- [Session memory](https://past.dev/glossary/session-memory)
- [Long-term memory](https://past.dev/glossary/long-term-memory)
- [Context engineering](https://past.dev/context-engineering)
- [Memory API quickstart](https://past.dev/docs/memory-api/quickstart)