Working memory
Short-lived, task-scoped memory the agent uses to track the current goal, plan, and intermediate results — analogous to a human scratchpad during a single problem.
Working memory lives for the duration of one task. It holds the current goal, the active plan, results from recent tool calls, and any hypotheses the agent is testing. Once the task ends, working memory is either compacted into episodic/semantic memory or discarded.
In LangGraph and similar frameworks, working memory is the graph state passed between nodes. In simpler agents, it is a JSON object updated each loop iteration. The key property: every step of the agent loop sees it without retrieval.
Getting working memory right is the difference between an agent that solves a 50-step task and one that loops at step 20. Most production failures trace back to working memory being too small (loses context) or too noisy (model gets confused).
Frequently asked
Where does working memory live?+
Usually in the agent state object (LangGraph, Agents SDK) or in the system prompt + recent tool results. Some frameworks let you persist it across loop iterations explicitly.