← Agents, Tools & MCP
09 · Agents, Tools & MCP · Topic 06

What are Memory and State in an AI Agent?

State tracks what is happening in the current task, while memory can preserve useful information across steps or interactions.

What is it?

Memory and state are ways an AI agent keeps track of information while it works and across interactions.

State = current task information. Memory = information retained or retrieved beyond the immediate step. Context Window = what the model can currently see.

Think of it like...

State is the notes currently open on your desk. Memory is a notebook or filing cabinet. Context is the information physically available on the desk right now.

How it works

1 · Task Starts Create State Record the goal and current task information.
2 · Agent Acts Update State Take a step and record its result.
3 · Store Useful Information Preserve selected facts Save information likely to help later.
4 · Retrieve Memory Continue Bring relevant memory into the current context.

Real-world examples

Everyday · Trip planning

State holds the current itinerary; memory recalls a preferred hotel area.

AI product · Support agent

State holds the open case; memory retrieves prior customer history.

What it is NOT

Memory ≠ Context Window

Memory is stored for later; context is visible now.

Memory ≠ State

Memory can persist; state tracks current progress.

Memory ≠ Model Parameters

Memory is external information; parameters are learned values.

Remember this

State tracks the current task, while memory preserves information that may be useful later.

Video

No video is available for this topic yet.

↑