Scratchpad

intermediate
Memory TypesLast updated: 2025-01-15
Also known as: working memory, scratch space

What is Scratchpad?


A scratchpad is a temporary working memory space where agents can store and manipulate intermediate results, thoughts, or partial computations during task execution. Similar to how humans use scratch paper for multi-step calculations or planning, agent scratchpads provide a place to "think out loud," break down complex problems, and maintain state across multiple reasoning steps. This externalized working memory helps agents handle tasks that exceed what can be processed in a single step.


Scratchpads are often implemented as a designated section in the prompt or a structured component in the agent's state. The agent can write to the scratchpad during reasoning, recording intermediate conclusions, partial results, or notes to itself. These notes remain accessible for subsequent steps, allowing the agent to reference earlier reasoning or build upon previous work. Scratchpads are particularly important for multi-step reasoning, complex calculations, or tasks requiring tracking multiple pieces of information.


The concept is closely related to chain-of-thought prompting and ReAct patterns, where the agent's reasoning process is explicitly verbalized. By making the scratchpad contents visible, developers can better understand and debug agent reasoning. Some implementations treat scratchpad content as ephemeral (cleared after task completion), while others may archive scratchpad traces as episodic memories. Effective use of scratchpads enables agents to tackle more complex tasks by decomposing them into manageable steps with explicit intermediate state.


Related Terms