How Agents Use Scratchpads and Working Memory
Learn how AI agents use scratchpads and working memory to think through problems, track progress, and hold intermediate results across steps.
When an AI agent works through a complex problem, it needs somewhere to think, a place to jot down intermediate reasoning, partial results, and reminders of what it is trying to do. Scratchpads and working memory serve this purpose, giving the agent a space to externalize its thought process rather than holding everything implicitly. These mechanisms are quietly essential to capable agentic behavior, and understanding them illuminates how agents tackle problems too involved to solve in a single leap.
The Need for a Place to Think
A model asked to answer a hard question in one shot must do all its reasoning internally and produce the answer directly, which often leads to mistakes on multi-step problems. Giving the agent a scratchpad changes this. By writing out its reasoning step by step, the agent can work through a problem methodically, much as a person solves a math problem on paper rather than entirely in their head. Externalizing the thinking makes the steps explicit and reduces errors.
This space also lets the agent track things it must not forget. As a task unfolds, the agent accumulates partial results, observations from tools, and decisions it has made. Holding all of this implicitly is unreliable, so a scratchpad acts as a place to record what matters and refer back to it. The scratchpad becomes the agent's external memory for the task at hand, a working surface where the messy middle of problem-solving happens.
Scratchpads as Visible Reasoning
A scratchpad is most often realized as text the agent generates to reason before committing to an action or answer. The agent writes out its analysis, considers options, notes intermediate conclusions, and then decides what to do, all in a portion of its output set aside for thinking. This visible chain of reasoning improves results on complex tasks, because the act of working through the steps in writing guides the agent toward a more careful answer.
The scratchpad also carries forward, so reasoning from earlier steps remains available to inform later ones. When an agent in a loop records why it took an action, that note helps it interpret the result and decide the next step coherently rather than starting fresh each iteration. This continuity is part of what makes an agent feel deliberate rather than scattered. The scratchpad knits the individual steps into a connected line of thought that builds toward the goal.
Working Memory Across the Loop
Working memory is the broader notion of the information an agent actively holds while performing a task: the current goal, the steps taken so far, the results gathered, and the plan for what comes next. Unlike a permanent knowledge store, working memory is transient, relevant only to the task in progress and discarded or summarized once the task is done. It is the agent's sense of where it is in the work.
Managing working memory well is a balancing act. The agent needs enough of it to stay oriented and avoid repeating itself or losing the thread, but too much accumulated detail bloats the context and raises cost while burying the important parts in noise. Effective agents keep working memory focused, retaining what is relevant to the current state and compressing or dropping what is not. This is why summarizing earlier progress is a common technique, preserving the gist of what happened without carrying every detail forward indefinitely.
Keeping Working Memory Manageable
As tasks grow long, working memory threatens to overwhelm the available context, so agents need strategies to keep it manageable. Summarizing completed portions of the task condenses them into a compact form that still conveys what was accomplished. Pruning information that is no longer relevant clears space for what matters now. Some systems offload detail to an external store and pull pieces back into working memory only when needed, keeping the active context lean while preserving access to the full record.
The underlying principle is that working memory should hold what the agent needs to make its next decision well, no more and no less. A scratchpad gives the agent room to reason in the moment, and disciplined memory management ensures that reasoning stays coherent over a long task without drowning the agent in its own history. Together, these mechanisms let an agent think clearly through problems that unfold across many steps, which is exactly the kind of problem agents are built to solve.
Frequently Asked Questions
What is the difference between a scratchpad and working memory?
A scratchpad is the space where an agent writes out its reasoning for the current step, while working memory is the broader set of information it actively holds across the task, such as the goal, steps taken, and results so far. The scratchpad is where thinking happens; working memory is what the agent keeps in mind.
Why does writing out reasoning help an agent?
Externalizing the steps makes the agent's thinking explicit and methodical, much like solving a problem on paper, which reduces errors on complex multi-step tasks. The written reasoning also carries forward to inform later decisions in the loop.
How do agents keep working memory from growing too large?
By summarizing completed portions of the task, pruning irrelevant detail, and sometimes offloading information to an external store that can be recalled when needed. The aim is to retain only what is relevant to the next decision, keeping the context lean and focused.
