
Working Memory in AI Agents
Working memory is the notepad of an AI program that carries out several work steps one after another: it holds the task, intermediate results, and the current status. Without this notepad, the program would forget what it's doing at every single step.
Some AI programs don’t just answer a single question — they carry out a longer task. They search the internet, do some calculations, write a file, and check the result. Such programs are called agents. However, an agent has a problem: the underlying AI doesn’t remember anything on its own. At every step, it is presented with a text and responds to it, without remembering the previous step. Working memory is the solution to this. It is a text area that holds the current state of the work and is resupplied anew at every step.
Why an agent fails without a notepad
Imagine someone who loses their memory every ten seconds. They can still solve complicated tasks — but only if they write down everything important on a note and keep reading that note again and again. This is exactly the situation an AI agent is in. Working memory is its note.
Without this note, typical errors occur. The agent searches for the same information three times because it no longer knows the result from before. Or it forgets, halfway through a booking, which date it was actually searching for. In tasks with twenty or more steps, the quality of the working memory determines whether the agent reaches its goal.
But there is also a hard technical limit. Every AI model can only process a limited amount of text per request, known as the context window. So the note cannot grow indefinitely. Anyone who writes everything down will eventually hit the limit — and the requests become more expensive, because costs rise with the amount of text.
What’s on the note and what disappears again
Typically, working memory contains four things: the user’s original task, a plan with the next steps, the results of steps already completed, and any errors that occurred. Before every new request, the agent assembles these parts into a text and sends it to the model. The model responds with the next action. Its result then moves back into working memory.
Because space is limited, constant tidying up is required. One common method is summarization: ten old steps are condensed into three sentences. Another method discards everything except the most recent steps. Instead, the agent moves important results into an external database and retrieves them only when needed.
A distinction helps here. Working memory is the short-term memory for exactly this one task and is deleted afterward. Long-term memory, on the other hand, permanently stores what an agent has learned about the user, such as their preferred programming language. A common mistake is confusing the two: an agent with good working memory still doesn’t need to remember anything at all tomorrow.
Where the topic comes up in products and news
Coding assistants like GitHub Copilot or Claude Code work exactly on this principle. Within a session, they keep track of which files they have already changed and which tests have failed. If such an assistant suddenly undoes earlier changes after a long stretch of work, the working memory has usually overflowed.
In the news, this topic often comes up indirectly. When a company announces a larger context window, it is almost always about longer agent runs. Terms like context engineering also fundamentally refer to the question of what should be on the note. Analysts see this as a decisive factor in whether agents will truly become useful in everyday work.
For you as a user, there is a practical takeaway. When a chat gets very long, the answers often get worse. In that case, a new chat with a short summary of the most important points helps. This way, you tidy up the working memory by hand.