Working memory
Working memory is information temporarily retained and available for immediate use during an ongoing task or interaction.
AI Agents in Action, Second Edition
Short-term memory is the recent interaction history of the current session that remains directly in the model's context window.
- How it is used
- Provides an active workspace for recent conversation and context during agent response generation.
- How deep it goes
- Defines the buffer and contrasts memory types, then outlines context-window and storage decisions without implementing a working-memory system.
- Examples
- Uses a conversation thread and a shared blackboard as possible agent workspaces.
- What you can do after
- Evaluate context-window trade-offs and choose when to summarize or remove older turns.
Read how AI Agents in Action, Second Edition explains working memory →
Build a Multi-Agent System (from Scratch)
Working memory is transient memory that retains an agent's progress during its current task execution.
- How it is used
- Maintains an LLM agent’s progress during one task execution so it can determine what to do next.
- How deep it goes
- Defines context-window-limited state and traces rollout injection and appending across stepwise chat interactions.
- Examples
- Injects prior-step rollout into a system message, then appends the completed step’s experience.
- What you can do after
- Operate a stepwise agent loop by carrying its rollout between interactions and discarding it when task execution ends.
Read how Build a Multi-Agent System (from Scratch) explains working memory →
Building Reliable AI Systems
An agent memory that temporarily retains information, typically for the duration of a single session.
- How it is used
- Maintains session context for conversations and multistep agent workflows without repeated user input.
- How deep it goes
- Explains temporary storage with lists and dictionaries, then compares full buffers with periodic summaries for longer conversations.
- Examples
- Uses flight preferences, support troubleshooting, order tracking, and conversation summarization to illustrate retained context.
- What you can do after
- Apply it using a Python list and choose between a full buffer and periodic summarization.
Read how Building Reliable AI Systems explains working memory →
Context Engineering
Short-term memory is information about the current user-agent session, including prior turns and agent actions, that ends with the session.
- How it is used
- Maintains conversational continuity by supplying session history to otherwise stateless agent calls.
- How deep it goes
- Explains session replay and curation, then sketches a custom session policy while leaving implementation plumbing aside.
- Examples
- Uses an evening-flight preference and a session that combines recent turns with a running summary.
- What you can do after
- Evaluate session-curation approaches, including turn trimming and summary-based compression.
Natural Language Processing in Action, Second Edition
Short-term memory is a temporary store for information that remains available over a limited span of processing.
- How it is used
- Structures recurrent-network memory by separating recently processed tokens from information retained over longer spans.
- How deep it goes
- Explains hidden and cell states plus four LSTM gates and their update equations.
- Examples
- Uses LSTM gate equations, hidden-state vectors, cell-state vectors, and a gate-architecture figure.
- What you can do after
- Understand how LSTMs retain recent token information and regulate its update and output.
Read how Natural Language Processing in Action, Second Edition explains working memory →
The Art of AI Product Development
Agent memory held within the model's current prompt context and available for immediate processing.
- How it is used
- Supports continuity across conversations and multistep agent workflows by carrying relevant information in the current prompt.
- How deep it goes
- Explains stored content, prompt representations, and context trade-offs, but stops short of implementation details.
- Examples
- Uses chatbot continuity, trend research, roadmap synthesis, conversations, task outcomes, and retrieved data as examples.
- What you can do after
- Operate agent workflows by selecting useful context while managing latency, token count, and potential inaccuracies.
Read how The Art of AI Product Development explains working memory →
Domain-Specific Small Language Models
Conversation memory that keeps recent interactions within a session so they can be reused immediately.
- How it is used
- Enriches prompts for chatbots, RAG systems, and agents with relevant context from the ongoing session.
- How deep it goes
- Defines session-scoped history and demonstrates selecting recent interactions, while broader memory features are described without implementation detail.
- Examples
- Uses a Memoripy workflow that combines recent history and retrieved interactions to generate a response.
- What you can do after
- Apply Memoripy to include recent session interactions in response generation.
Read how Domain-Specific Small Language Models explains working memory →
Inside AI
Working memory is the component of an expert system that stores input data and intermediate facts produced during reasoning.
- How it is used
- Coordinates input facts and deductions between the knowledge base and inference engine in rule-based expert systems.
- How deep it goes
- Explains stored inputs, generated facts, rule cycles, and the no-trigger stopping condition without implementation details.
- Examples
- Uses gardening expertise and MYCIN’s bacterial-diagnosis inputs to illustrate expert-system reasoning.
- What you can do after
- Evaluate how facts move through a rule-based expert system during inference.
Introduction to Generative AI, Second Edition
Short-term memory is an agent capability for retaining relevant intermediate information from the current task or interaction.
- How it is used
- Supports agents in tracking relevant results across chained tool calls and previous interactions.
- How deep it goes
- Explains selective retention and application-dependent context choices, but stops short of implementation detail.
- Examples
- Uses chained searches, retained final results, discarded documents, and LangGraph state as examples.
- What you can do after
- Evaluate which intermediate results an agent should retain or discard during multistep tasks.
Read how Introduction to Generative AI, Second Edition explains working memory →
Designing AI Agents
The limited information temporarily available to an agent or model while it performs a task.
- How it is used
- Defines the agent’s immediately available context for current instructions, evidence, and tool results.
- How deep it goes
- Distinguishes volatile active context from durable task state and external memory, relating placement to access cost and validity checks.
- Examples
- Uses current instructions, evidence, and tool results as active context, contrasted with goals, artifacts, and pending decisions in task state.
- What you can do after
- Apply context-window management by keeping frequently needed state close and retrieving durable history when its token cost is justified.
AI Governance
Temporary agent state holding information for the current task, such as sub-goals, partial outputs, and tool results.
- How it is used
- Supports an agent’s current task by temporarily holding intermediate state.
- How deep it goes
- Defines working memory and lists its contents without detailing an implementation.
- Examples
- Lists sub-goals, partial outputs, and tool results as temporary contents.
Also covered in
- AI Agents and Applications
- Build an AI Agent (From Scratch)
- AI Agents in Action
- The Art of Code
- The Coder CafeIn early access (MEAP)
- AI-Powered Search
- Spring AI in Action
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- context windowA context window is a bounded span of sequence elements or contextual information that a model or processing operation can consider together.
- contextContext is the relevant information, state, or circumstances surrounding an input, decision, or activity that influence its interpretation or behavior.
- dialogueDialogue is an ordered exchange of related messages across successive turns between participants or an interactive system and its users.
Related concepts
- memorykind of · Memory is a storage capability or mechanism for retaining information or computational state for later access or use.
- context windowequivalent to · A context window is a bounded span of sequence elements or contextual information that a model or processing operation can consider together.
- statecontrasts with · State is information describing the condition or configuration of a system or computation at a particular time that may influence its behavior or subsequent transitions.
- cognitive loadused by · Cognitive load is the mental effort required to process information, retain it in working memory, or perform a task.
- program comprehensionused by · Program comprehension is the process of understanding a program’s structure, behavior, purpose, dependencies, and design.
- cognitionkind of · Cognition is the set of processes by which an agent acquires, processes, represents, and uses information.
Questions about working memory
What is working memory?
Working memory is information temporarily retained and available for immediate use during an ongoing task or interaction.
Which Manning books explain working memory?
AI Agents in Action, Second Edition, Build a Multi-Agent System (from Scratch), Building Reliable AI Systems, Context Engineering, Natural Language Processing in Action, Second Edition, The Art of AI Product Development, Domain-Specific Small Language Models, Inside AI and 3 more.
What should I know before learning working memory?
Manning books that teach working memory usually introduce language model, context window, context and dialogue first.
What is the difference between working memory and state?
Working memory is information temporarily retained and available for immediate use during an ongoing task or interaction. State is information describing the condition or configuration of a system or computation at a particular time that may influence its behavior or subsequent transitions.
What is working memory a kind of?
Working memory is a kind of memory. Memory is a storage capability or mechanism for retaining information or computational state for later access or use.
What is working memory also called?
Working memory is also called short-term memory.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.










