What Is Semantic Memory in AI Agents?
Semantic memory is long-term memory for general knowledge: facts, concepts and the relationships between them, held without a record of when or where they were learned. In AI agents, it is the store of facts an agent keeps about the world, its users and itself, such as a customer's preferred language or a product's return policy, which it retrieves into its working context when a task calls for them. It is distinct from episodic memory, which records specific past events, and from procedural memory, which holds how to act.
Updated
What is semantic memory?
The term comes from psychology. In "Episodic and Semantic Memory", his chapter in Organization of Memory (1972), Endel Tulving traced it to Quillian: "As far as I can tell, it was first used by Quillian (1966) in his doctoral dissertation." Tulving proposed separating it from memory for "temporally dated episodes or events," which he named episodic. He described semantic memory as "a mental thesaurus, organized knowledge a person possesses about words and other verbal symbols," and noted that "retrieval of information from the system leaves its contents unchanged."
CoALA (Cognitive Architectures for Language Agents, Sumers, Yao, Narasimhan and Griffiths) applies the term to LLM agents: "Semantic memory stores an agent's knowledge about the world and itself." CoALA treats retrieval-augmented generation as reading from a semantic memory of unstructured text, and notes that "language agents may also write new knowledge obtained from LLM reasoning into semantic memory." That write path is where agent semantic memory gets hard: facts are extracted by a model, overwritten and sometimes contradicted.
Two neighboring terms are easy to confuse with it. LangChain's memory documentation separates it from semantic search: "Semantic memory is a term from psychology, referring to storing facts and knowledge, while semantic search is a method for retrieving information based on meaning rather than exact matches." Nor is it semantic context: semantic memory is what an agent retained earlier, while semantic context is meaning derived from current events when a decision runs.
How semantic memory works
Write. A model extracts facts from conversations, documents or its own reflection, either before the agent responds or in a background job. LangChain's docs describe two shapes: a single "profile," which "is generally just a JSON document," or a "collection of documents that are continuously updated and extended over time."
Read. The agent retrieves relevant facts by key, filter or similarity and places them in the prompt.
A profile update is a read-modify-write. The docs advise that you "pass in the previous profile and ask the model to generate a new profile (or some JSON patch to apply to the old profile)":
# Illustrative background job that maintains a user profile
profile = store.get(("profiles",), user_id) # {"plan": "pro", "language": "de"}
updated = model.update_profile(profile.value, recent_messages)
store.put(("profiles",), user_id, updated) # overwrites the whole documentWhy semantic memory matters in real-time systems
For one agent and one user, semantic memory is low-risk: one writer, and a stale preference costs a slightly worse answer. Two things change when the memory is shared across agents, channels or sessions.
Concurrent updates overwrite each other. Suppose a chat session and a voice session for the same customer each run the profile job above. Both read the profile at the same version, each adds a different fact, and the second put erases the first. Nothing errors. Per-field updates, a version check on write, or storing each fact as its own record with a rule for which value supersedes which avoids the lost update.
Some "facts" are really state. "Customer is on the pro plan" was true when it was extracted. If billing downgraded the account an hour later, the memory is now wrong, and an agent that decides eligibility from it decides on a past state. Semantic memory suits knowledge that changes slowly. Anything a decision gates on, such as a plan, a balance or a limit, should be read from its source when the decision runs. That split between memory and current state is the subject of agent memory types and trade-offs.
FAQ
Related terms
Agentic memory lets an AI agent keep what it learns and recall it in later steps or sessions, across working, episodic, semantic and procedural memory.
Episodic memory in AI agents is a time-ordered record of the agent's own past events, actions and outcomes, retrieved to reuse experience in later decisions.
Procedural memory is an AI agent's knowledge of how to act: the model weights, code, instructions and skills that set its behavior. The term is from psychology.
Semantic context is the meaning-bearing layer of decision context — aggregations, vector similarity, LLM-derived signals — computed from the same events.
Multi-writer contention is two or more actors reading and writing the same mutable state in the same short window. It is not multi-tenancy or partitioning.
Context lag is the delay between a fact changing at its source and the system an automated decision reads from reflecting it. Also called stale context.
Memory supersession is how an AI agent's memory replaces facts that have changed, so the agent answers from the current value instead of an outdated one.
