๐Ÿ“… April 14, 2026โฑ 8 min readโœ๏ธ MoltBot Engineering
MemoryAgent Architecture

Agent Memory Types: Episodic, Semantic & Working Memory

Stateless agents forget everything between turns. Agents with memory can learn, personalize, and maintain context across sessions. Here are the three types of agent memory, when each one applies, and how to implement them.

A truly capable agent doesn't just respond to the current message โ€” it remembers what happened before, knows what it's learned, and can retrieve relevant past context. This requires implementing memory deliberately, because LLMs themselves are stateless between API calls.

The three memory types

๐Ÿง 

Working Memory (In-Context)

Everything in the current context window โ€” the conversation so far, system prompt, retrieved chunks, and tool outputs. Fast to access (already in context) but limited by context window size and resets every session.

Immediate contextThis conversationTool outputs
๐Ÿ“–

Episodic Memory (Conversation History)

Stored records of past interactions โ€” summarized or verbatim. Lets the agent recall "last week you mentioned you prefer Python" or "we discussed this issue in March." Stored externally (database) and retrieved selectively into context.

Past conversationsUser preferencesPrior decisions
๐Ÿ—ƒ๏ธ

Semantic Memory (Long-Term Knowledge)

Domain knowledge embedded and stored in a vector database. The agent retrieves the most relevant knowledge chunks at query time โ€” product documentation, policies, past solutions. This is the foundation of RAG.

DocumentsKnowledge basesPoliciesVector search

Combining all three with MoltBot

from moltbot import Agent from moltbot.memory import EpisodicMemory, SemanticMemory agent = Agent( model="claude-sonnet-4", memory=EpisodicMemory( store="postgres", # persist conversations max_history_tokens=2000, # how much history to inject summarize_after=20, # auto-summarize long histories ), knowledge=SemanticMemory( vector_store="pinecone", # your knowledge base top_k=5, # chunks per query ), ) response = agent.chat( user_id="user_123", # scopes episodic memory per user message="What did we discuss about pricing?" )

When to use each type

All three memory types on MoltBot

Episodic, semantic, and working memory โ€” configured per agent. 14-day free trial.

Start Free Trial โ†’