What is working memory in an AI agent?
Working memory in an AI agent is the small set of information the agent is actively using and manipulating for the current reasoning step.
It contains what matters right now rather than everything the agent has seen or stored.
What working memory can contain
Working memory may include:
- the current goal
- the current subtask
- important constraints
- recent observations
- selected tool results
- intermediate calculations
- unresolved questions
- the next decision to make
Its contents can change quickly as the workflow progresses.
Example
Suppose an agent is comparing three cloud providers.
While evaluating cost, its working memory may contain:
- expected usage
- monthly budget
- pricing for Provider A
- pricing for Provider B
- pricing for Provider C
Later, while evaluating compliance, its working memory may instead contain:
- required certifications
- data residency rules
- security requirements
- each provider's compliance information
The broader task is the same, but the information actively being used has changed.
Working memory is highly focused
An agent should normally keep only the information needed for the immediate reasoning step.
If it is deciding whether to retry an API call, useful working memory might include:
- the latest error
- retry count
- retry policy
- timeout value
- previous attempt result
Unrelated conversation history does not need to be actively considered.
Working memory vs. short-term memory
Short-term memory retains recent information for a limited period, such as recent messages or earlier results in the same session.
Working memory is the smaller subset being actively used for the current decision.
For example, short-term memory may contain several recent messages and tool outputs, while working memory may use only one message, one tool result, and one constraint.
Working memory vs. long-term memory
Long-term memory stores information intended to remain useful across future sessions or tasks.
Working memory is temporary and supports immediate reasoning.
A long-term memory can be retrieved and placed into working memory when it becomes relevant.
For example:
Long-term memory: The user prefers Python examples.
Working memory: The current question, a relevant API response, and the Python code being analyzed.
Working memory vs. context
Context is all the information available to the model during a call.
Working memory is the part of that context that is actively relevant to the current reasoning operation.
The context may contain background instructions and conversation history, while the effective working memory may involve only a few important details.
Intermediate results often belong in working memory
Temporary reasoning artifacts may stay in working memory while the agent solves a problem.
Examples include:
- a running total
- eliminated options
- a current hypothesis
- partial calculations
- the latest observation
These may be useful for the current step but not worth storing permanently.
Working memory should remain small and relevant
Overloading working memory with unnecessary information can make it harder for the agent to identify what matters.
A good agent system therefore updates working memory as the task changes:
- bring in relevant information
- use it for the current decision
- keep useful intermediate results
- remove information that is no longer needed
- load the information required for the next step
In short
Working memory in an AI agent is the small, temporary set of information the agent is actively using to reason about the current step.
It is more focused than short-term memory, changes as the task progresses, and can draw information from context, state, recent observations, or long-term memory.
Learning Sequence
AI Agents Curriculum
Explore Related Questions
Deepen your understanding across related AI Agents topics.