Memory Systems in Agentic AI: Procedural, Semantic, and Episodic Memory
Large Language Models are good at understanding text and generating answers.
But there is an important problem.
By default, an LLM does not truly remember everything that happened before.
Imagine you talk to an AI assistant today and tell it:
I prefer short answers and I usually work with Python.
Tomorrow, you start a new conversation.
If the system has no memory, the assistant may know nothing about that previous conversation.
For a simple chatbot, this may be acceptable.
For an AI agent, it becomes a serious limitation.
An agent may need to remember:
- what it learned about the user
- what happened during previous tasks
- what actions worked before
- what instructions it should follow
- what mistakes it made
- what happened in previous conversations
This is why memory is becoming an important part of Agentic AI systems.
In this article, we will look at three useful types of memory:
Procedural memory
Semantic memory
Episodic memory
The names may sound complicated.
The ideas are actually quite simple.
First, What Is an AI Agent?
A normal LLM application may look like this:
1User
2 ↓
3Prompt
4 ↓
5LLM
6 ↓
7Answer
For example:
1User:
2Explain machine learning.
3
4LLM:
5Machine learning is a method that allows computers...
An AI agent usually does more.
It may:
- call APIs
- search databases
- use tools
- read documents
- make decisions
- perform several steps
- remember previous information
- continue tasks over time
A simplified agent may look like this:
1 User
2 ↓
3 Agent
4 ↓
5 ┌────────┼────────┐
6 ↓ ↓ ↓
7 LLM Tools Memory
8 ↓ ↓ ↓
9 └────────┼────────┘
10 ↓
11 Action
Memory gives the agent access to information from the past.
Without memory, every interaction can feel like meeting someone who forgets you immediately after the conversation ends.
Why Do Agents Need Memory?
Imagine you have an AI travel assistant.
On Monday, you tell it:
1I prefer window seats.
2
3I do not like very early flights.
4
5I usually travel with one checked bag.
On Tuesday, you ask:
1Find me a flight to Singapore.
A useful assistant should remember your preferences.
Now imagine another situation.
Last month, the assistant booked a flight for you.
The process was:
1Search flights
2
3Compare prices
4
5Check baggage
6
7Ask user for confirmation
8
9Book flight
When doing another booking, the agent may benefit from remembering how that previous task happened.
There is also information such as:
1Singapore is a country in Southeast Asia.
That is different from remembering something that happened to you personally.
These different kinds of information are why memory systems are often divided into categories.
A useful way to think about them is:
1Procedural Memory
2How should I do something?
3
4Semantic Memory
5What do I know?
6
7Episodic Memory
8What happened before?
Let us look at each one.
1. Semantic Memory
Semantic memory is memory about facts, knowledge, meanings, and information.
Think about facts you know.
For example:
1Dhaka is the capital of Bangladesh.
2
3Python is a programming language.
4
5The user prefers dark mode.
6
7The user's company uses Google Cloud.
8
9The project uses PostgreSQL.
These are pieces of information.
They are not stories about something that happened.
They are simply things the system knows.
That is semantic memory.
A Human Example
You probably know:
1Paris is the capital of France.
You may not remember when you first learned it.
You may not remember who taught you.
You simply know the fact.
That is similar to semantic memory.
Semantic Memory in an AI Agent
Suppose you build an AI assistant for an employee.
Over time, the agent learns:
1User's preferred programming language: Python
2
3User's team: Data Science
4
5Preferred cloud provider: Google Cloud
6
7Main database: BigQuery
8
9Preferred response style: Short explanations
The assistant can store these facts as semantic memory.
Later, the user says:
1Write an example for me.
Instead of choosing JavaScript, the agent may use Python because it remembers the user's preference.
Semantic Memory Does Not Need to Come Only From the User
Semantic memory can come from many places.
For example:
1Conversation
2
3Documents
4
5Databases
6
7Tool results
8
9User profile
10
11Previous agent runs
Suppose an agent discovers:
1Project Alpha uses PostgreSQL.
That fact may be useful for many future tasks.
The system could save it.
Later, the user asks:
1Write a query for Project Alpha.
The agent already knows which database the project uses.
How Semantic Memory Might Be Stored
A simple memory record might look conceptually like this:
1Fact:
2User prefers Python.
3
4Category:
5Programming preference
6
7Confidence:
8High
9
10Created:
11August 2026
Another might be:
1Fact:
2Project Alpha uses PostgreSQL.
3
4Category:
5Project infrastructure
6
7Confidence:
8High
These facts could be stored in:
1SQL database
2
3Document database
4
5Vector database
6
7Key value store
8
9Dedicated memory service
The exact storage system is less important than the idea.
The goal is to save useful facts and retrieve them when needed.
Semantic Memory Can Change
Some facts are permanent.
Others change.
Suppose the agent stores:
1User works on Project Alpha.
Six months later:
1User moved to Project Beta.
Now the old memory may be incorrect.
A good memory system needs to handle this.
It may update the fact:
1Old:
2Current project = Alpha
3
4New:
5Current project = Beta
This is why real memory systems often need information such as:
1Creation time
2
3Last update time
4
5Confidence
6
7Source
8
9Expiration time
Memory is not only about saving information.
It is also about deciding whether that information is still useful.
2. Episodic Memory
Episodic memory is memory about events and experiences.
Instead of remembering a fact, the agent remembers something that happened.
For example:
1Yesterday, the user asked the agent to analyze a CSV file.
2
3The agent found missing values.
4
5The user decided not to remove those rows.
6
7The user asked the agent to use median values instead.
That is an episode.
It describes an event.
A Human Example
Think about the difference between these two memories.
Semantic memory:
1Tokyo is the capital of Japan.
Episodic memory:
1I visited Tokyo in 2024 and stayed near Shinjuku.
The first is a fact.
The second is something that happened.
This distinction is very useful for AI agents.
Episodic Memory in an Agent
Imagine a coding agent.
Yesterday, it tried to fix a bug.
It performed these steps:
1Read error logs
2
3Inspected database connection
4
5Changed retry logic
6
7Ran tests
8
9Tests failed
10
11Reverted the change
12
13Found the actual issue in configuration
That whole experience could become an episodic memory.
Later, another similar error happens.
The agent can retrieve that previous episode.
It may realize:
1A similar error happened before.
2
3The retry logic was not the problem.
4
5The configuration was the real cause.
This can help the agent make a better decision.
Episodic Memory Is Like an Agent's History
You can think of episodic memory as a collection of stories.
Each story might contain:
1What happened?
2
3When did it happen?
4
5Who was involved?
6
7What was the goal?
8
9What actions were taken?
10
11What was the result?
12
13What was learned?
For example:
1Episode:
2
3Goal:
4Deploy model to production.
5
6Action:
7Agent created a deployment.
8
9Problem:
10Health check failed.
11
12Cause:
13Wrong port configuration.
14
15Solution:
16Changed application port from 8000 to 8080.
17
18Result:
19Deployment succeeded.
This memory may later help with another deployment.
Why Episodic Memory Is Powerful for Agents
Agents often perform multi step tasks.
Some tasks succeed.
Some fail.
If every new task starts from zero, the agent cannot learn much from its previous experiences.
Episodic memory makes something closer to this possible:
1Previous experience
2 ↓
3Retrieve similar episode
4 ↓
5Understand what happened
6 ↓
7Use that knowledge
8 ↓
9Make a better decision
This is especially useful for:
- coding agents
- research agents
- customer support agents
- personal assistants
- business workflow agents
- autonomous systems
Episodic Memory Can Be Summarized
There is another challenge.
Suppose an agent has completed 100,000 tasks.
You probably do not want to store every single token from every task forever.
That can become expensive.
Instead, the system might create a shorter memory.
Original interaction:
125,000 tokens
Stored episode:
1Goal:
2Fix payment API issue.
3
4Cause:
5Expired API credential.
6
7Action:
8Generated a new credential and updated the service.
9
10Result:
11Payment service recovered.
12
13Important lesson:
14Check credential expiration before changing application code.
Now the agent keeps the useful part of the experience without keeping every detail.
3. Procedural Memory
Procedural memory is about how to do something.
Think about instructions, processes, rules, skills, and workflows.
For example:
1When deploying the service:
2
31. Run tests.
4
52. Build the container.
6
73. Push the container.
8
94. Deploy to staging.
10
115. Run smoke tests.
12
136. Deploy to production.
This is procedural memory.
It tells the agent how something should be done.
A Human Example
You know how to ride a bicycle.
You do not normally think:
1Move left foot.
2
3Now move right foot.
4
5Turn handlebar three degrees.
6
7Maintain balance.
You have learned a procedure.
Another simpler example is making tea.
1Boil water.
2
3Add tea.
4
5Wait.
6
7Add milk.
8
9Serve.
That is knowledge about how to perform a task.
Procedural Memory in an AI Agent
Imagine an AI agent working inside a software company.
The company has a rule:
1Never deploy directly to production.
2
3First deploy to staging.
4
5Run automated tests.
6
7Get approval.
8
9Then deploy to production.
The agent needs to remember this process.
That is procedural memory.
Another example:
1When reviewing a pull request:
2
3Read the requirements.
4
5Check the implementation.
6
7Run tests.
8
9Check security issues.
10
11Check performance issues.
12
13Write review comments.
Again, this is a procedure.
Where Procedural Memory Comes From
Procedural memory may come from:
1System prompts
2
3Company rules
4
5Agent instructions
6
7Workflow definitions
8
9Previous successful procedures
10
11Human feedback
12
13Standard operating procedures
Sometimes developers directly write these instructions.
For example:
1When a user asks for a refund:
2
3Verify the order.
4
5Check refund eligibility.
6
7Ask for confirmation.
8
9Call the refund API.
10
11Send confirmation.
The agent follows this procedure every time.
Procedural Memory Can Also Improve Over Time
Imagine an agent initially uses this process:
1Search all documents.
2
3Read every result.
4
5Generate answer.
Later, the team discovers a better process:
1Search documents.
2
3Rank results.
4
5Read the top five.
6
7Check whether enough evidence exists.
8
9Generate answer.
The procedure has improved.
The new version can replace the previous version.
This is similar to improving a skill.
The Difference Between the Three Types
Let us use one simple example.
Imagine an AI assistant helps you order food.
Semantic Memory
The agent remembers:
1The user likes spicy food.
2
3The user prefers Thai food.
4
5The user's favorite restaurant is Restaurant A.
These are facts.
Episodic Memory
The agent remembers:
1Last Friday, the user ordered Pad Thai from Restaurant A.
2
3The delivery arrived 40 minutes late.
4
5The user complained about the delay.
This is an event.
Procedural Memory
The agent remembers:
1When ordering food:
2
3Check whether the restaurant is open.
4
5Check delivery time.
6
7Show the price.
8
9Ask for confirmation.
10
11Place the order.
This is a process.
A simple way to remember them is:
1Semantic = What I know
2
3Episodic = What happened
4
5Procedural = How I do it
How They Work Together
The real power comes when an agent uses all three.
Imagine you tell your assistant:
1Book a hotel for my next trip to Singapore.
The agent may use semantic memory:
1User prefers hotels near public transport.
2
3User's usual budget is $150 per night.
4
5User prefers quiet rooms.
Then it may use episodic memory:
1During the previous Singapore trip, the user stayed near Orchard Road.
2
3The user complained that the area was too busy.
Then it may use procedural memory:
1Search hotels.
2
3Filter by budget.
4
5Check location.
6
7Check reviews.
8
9Compare options.
10
11Ask user before booking.
Now the agent has:
1Facts
2+
3Experience
4+
5Process
That creates a much more useful assistant.
A Simple Agent Memory Architecture
A simplified architecture might look like this:
1 User Request
2 ↓
3 Agent
4 ↓
5 Memory Retrieval
6 ↓
7 ┌───────────────┼───────────────┐
8 ↓ ↓ ↓
9 Semantic Episodic Procedural
10 Memory Memory Memory
11 ↓ ↓ ↓
12 └───────────────┼───────────────┘
13 ↓
14 LLM
15 ↓
16 Decision
17 ↓
18 Action
19 ↓
20 Memory Creation
The interesting part is that memory works in both directions.
Before the agent acts:
1Retrieve memory
After the agent acts:
1Create or update memory
This creates a loop.
The Agent Memory Loop
A useful mental model is:
1Observe
2 ↓
3Retrieve
4 ↓
5Think
6 ↓
7Act
8 ↓
9Learn
10 ↓
11Store
12 ↓
13Observe again
Suppose the user says:
1Do not schedule meetings before 10 AM.
The agent may extract:
1User meeting preference:
2After 10 AM
That becomes semantic memory.
Later, the user says:
1Schedule a meeting with Sarah tomorrow.
The agent retrieves the preference and avoids early morning times.
After the meeting is scheduled, it might create an episodic memory:
1Scheduled meeting with Sarah for Tuesday at 11 AM.
The system now remembers both the preference and the event.
Should We Store Everything?
No.
This is one of the hardest problems in agent memory.
Imagine the user says:
1Thanks.
Should that become a permanent memory?
Probably not.
Imagine the user says:
1I am moving to Singapore next month.
That may be much more useful.
A memory system therefore needs to decide:
1Is this information important?
2
3Will it be useful later?
4
5Is it temporary?
6
7Is it already stored?
8
9Does it conflict with another memory?
Saving every message creates too much noise.
Saving nothing makes the agent forgetful.
The goal is to store useful information.
Memory Importance
One approach is to give memories an importance score.
For example:
1User prefers Python.
2
3Importance: 0.9
1User said thanks.
2
3Importance: 0.1
The system may only save memories above a certain level.
The exact scoring method depends on the application.
Memory Confidence
Not every piece of information is equally reliable.
Suppose a user says:
1I think our database might be PostgreSQL.
The agent should not treat this exactly the same as:
1Our production database is PostgreSQL.
The first statement is uncertain.
A memory record could include:
1Fact:
2Production database may be PostgreSQL.
3
4Confidence:
5Low
Later, the agent receives stronger evidence:
1Production database is PostgreSQL.
Now confidence can increase.
Memory Freshness
Some information becomes less useful over time.
Suppose the agent remembers:
1User is currently working on Project A.
Two years later, this may no longer be correct.
Memory systems can use time when ranking memories.
For example:
1Relevance
2+
3Similarity
4+
5Importance
6+
7Freshness
A newer relevant memory may be preferred over an older one.
Memory Retrieval
Storing memory is only half the problem.
The agent also needs to find the right memory later.
Imagine the system stores 100,000 memories.
The agent cannot put all 100,000 into the prompt.
It needs to retrieve a small number of useful memories.
Suppose the user asks:
1What database should I use for Project Alpha?
The memory system might search for memories related to:
1Project Alpha
2
3database
4
5infrastructure
Then it may retrieve:
1Project Alpha uses PostgreSQL.
The LLM receives that information with the user's question.
1Relevant Memory:
2
3Project Alpha uses PostgreSQL.
4
5User:
6
7What database should I use for Project Alpha?
Now the model can give a better answer.
Vector Search and Memory
Semantic search is commonly useful for memory retrieval.
Suppose a stored memory says:
1The user usually writes backend services in Python.
Later, the user asks:
1Which language should we use for this API?
The words are different.
But the meaning is related.
A vector search system can help find memories based on meaning instead of exact word matching.
A simplified flow looks like:
1Memory
2 ↓
3Embedding
4 ↓
5Vector Database
Later:
1User Request
2 ↓
3Embedding
4 ↓
5Similarity Search
6 ↓
7Relevant Memories
Those memories can then be added to the context sent to the LLM.
Memory Is Different From Conversation History
This is an important difference.
Conversation history may contain everything:
1User message
2
3Assistant answer
4
5User message
6
7Assistant answer
8
9User message
10
11Assistant answer
Memory usually contains selected useful information.
For example, a conversation may contain 10,000 tokens.
The memory system may extract:
1User prefers Python.
2
3User is working on Project Alpha.
4
5Project Alpha uses PostgreSQL.
Instead of sending the entire conversation every time, the system retrieves only relevant memories.
This can reduce context size and make the agent more focused.
Memory Is Also Different From RAG
Memory systems and Retrieval Augmented Generation can look similar.
Both may use:
1Embeddings
2
3Vector search
4
5Retrieval
6
7Context injection
But their purpose is often different.
RAG usually retrieves external knowledge.
For example:
1Company documentation
2
3Research papers
4
5Product manuals
6
7Policies
Memory usually represents things the agent learned through interactions or previous experiences.
For example:
1User preferences
2
3Previous decisions
4
5Past agent actions
6
7Previous failures
8
9Learned facts
A real agent can use both.
1 Agent
2 ↓
3 ┌──────────┴──────────┐
4 ↓ ↓
5 RAG Memory
6 ↓ ↓
7 Documents and User facts,
8 external knowledge experiences,
9 procedures
Short Term Memory and Long Term Memory
You may also hear the terms:
Short term memory
and
Long term memory
These describe how long information is available.
They are different from semantic, episodic, and procedural memory.
For example:
Semantic memory can be long term.
1User prefers Python.
Episodic memory can also be long term.
1User deployed Project Alpha last month.
Short term memory may contain information needed only during the current task.
1Current file being edited:
2payment.py
After the task ends, the system may discard it.
So you can think about memory in two different dimensions.
1What kind of information is it?
2
3Semantic
4Episodic
5Procedural
And:
1How long should we keep it?
2
3Short term
4Long term
A Realistic Example
Imagine we build an AI software engineering agent.
The user asks:
1Deploy the payment service.
The agent retrieves procedural memory:
1Deployment procedure:
2
3Run tests.
4
5Build container.
6
7Deploy to staging.
8
9Run smoke tests.
10
11Get approval.
12
13Deploy to production.
It retrieves semantic memory:
1Payment service runs on Google Cloud.
2
3Repository is payment service.
4
5Production region is us central1.
It retrieves episodic memory:
1Last deployment failed because PORT was set incorrectly.
2
3Correct application port is 8080.
Now the agent has everything it needs.
1Procedural
2How should I deploy?
3
4Semantic
5What do I know about this service?
6
7Episodic
8What happened during previous deployments?
The agent runs the deployment.
Afterward, it may save another episode:
1Deployment completed successfully.
2
3Version 2.4.1 deployed.
4
5All smoke tests passed.
The memory system keeps growing.
Future tasks can use those experiences.
Memory Can Also Create Problems
Memory sounds very useful.
But badly designed memory can make an agent worse.
There are several common problems.
Problem 1: Wrong Memories
Suppose the system incorrectly stores:
1User prefers Java.
But the user actually prefers Python.
The agent may continue making bad decisions because it trusts the incorrect memory.
Memory systems therefore need ways to update and delete information.
Problem 2: Old Memories
Suppose:
12025:
2Project uses MySQL.
3
42026:
5Project migrated to PostgreSQL.
If the agent retrieves the older memory, it may give the wrong answer.
Memory needs versioning, timestamps, or freshness rules.
Problem 3: Too Many Memories
Imagine storing every small interaction.
1Memory 1
2
3Memory 2
4
5Memory 3
6
7...
8
9Memory 5,000,000
Retrieval becomes harder.
More memory does not automatically mean better intelligence.
Memory quality matters more than memory quantity.
Problem 4: Duplicate Memories
Imagine the system stores:
1User likes Python.
2
3User prefers Python.
4
5Python is user's preferred language.
6
7User generally chooses Python.
These are almost the same memory.
Duplicates waste storage and can influence retrieval unfairly.
Good systems usually need some form of duplicate detection.
Problem 5: Privacy
Memory can contain personal information.
That means memory systems should have clear rules around:
1What can be stored?
2
3How long can it be stored?
4
5Can the user delete it?
6
7Who can access it?
8
9Should sensitive information be stored at all?
Memory is powerful, so it should be handled carefully.
A Good Memory System Needs More Than a Database
It is tempting to think:
I will create a vector database. Now my agent has memory.
That is only one piece.
A useful memory system usually needs several steps.
1Conversation
2 ↓
3Memory Extraction
4 ↓
5Importance Check
6 ↓
7Duplicate Check
8 ↓
9Memory Storage
10 ↓
11Memory Retrieval
12 ↓
13Ranking
14 ↓
15LLM Context
You also need decisions about:
1When to create memory
2
3What to store
4
5When to update memory
6
7When to remove memory
8
9How to rank memories
10
11How many memories to retrieve
The database itself does not solve these problems.
A Simple Mental Model
If you remember only one part of this article, remember this:
1Semantic Memory
2What do I know?
3
4Episodic Memory
5What happened?
6
7Procedural Memory
8How do I do it?
You can also think about a human employee.
A good employee knows facts about the company.
That is semantic memory.
They remember what happened during previous projects.
That is episodic memory.
They know how company processes should be followed.
That is procedural memory.
An AI agent becomes more useful when it can work with similar types of information.
Putting Everything Together
A mature agent memory system might look conceptually like this:
1 User
2 ↓
3 AI Agent
4 ↓
5 Understand Task
6 ↓
7 Retrieve Memory
8 ↓
9 ┌──────────────┼──────────────┐
10 ↓ ↓ ↓
11 Semantic Episodic Procedural
12 Memory Memory Memory
13 ↓ ↓ ↓
14 └──────────────┼──────────────┘
15 ↓
16 LLM Reasoning
17 ↓
18 Use Tools
19 ↓
20 Action
21 ↓
22 Observe Result
23 ↓
24 Extract Learning
25 ↓
26 Update Memories
This creates a system that does more than simply answer prompts.
It can use past information to make future decisions.
Final Takeaway
LLMs are powerful, but an agent becomes much more useful when it can remember.
The three memory types provide a simple way to organize what the agent remembers.
Semantic memory stores facts and knowledge.
1User prefers Python.
Episodic memory stores experiences and events.
1Last deployment failed because the application port was incorrect.
Procedural memory stores instructions and processes.
1Before production deployment, run tests and deploy to staging.
Together, they answer three important questions:
1What do I know?
2
3What happened before?
4
5How should I do this?
That is the core idea behind memory in Agentic AI.
The goal is not to make an agent remember everything.
The goal is to help it remember the right information, at the right time, for the right task.