Skip to contentমূল লেখায় যান

Topic 03 · Agent memoryটপিক 03 · Agent memory

Episodic Memory

Episodic memory is the agent's diary. It records what happened in earlier tasks, so the agent can use a past experience when a similar task comes back. For a tester, it raises two questions: does the agent recall the right past event, and does it invent events that never happened?

6 min read6 মিনিটে পড়া যায় · 7 sections7টি সেকশন · 4 sources4টি সোর্স · updated Nov 2026আপডেট: Nov 2026

An agent reads its diaryএজেন্ট তার ডায়েরি পড়ে

Watch a past fix get scored and pulled into a new prompt.একটা পুরোনো ফিক্স স্কোর পায় আর নতুন প্রম্পটে ঢোকে, তা দেখুন।

2 min2 মিনিট7 steps7টি ধাপ
  • Episodes in logলগে এপিসোড0
  • Monday ageসোমবারের বয়স3 d
writeলেখাrecallমনে করাtesterটেস্টারcheckout.spec.tscheckout.spec.tsEpisode logএপিসোড লগepisodes · 0এপিসোড · 0Agentএজেন্টpromptপ্রম্পটin prompt · 0 / 1প্রম্পটে · 0 / 1score = relevance + recency + importanceস্কোর = relevance + recency + importanceMon · fixed waitসোম · fixed waitfailed ✗ব্যর্থ ✗Mon · network waitসোম · network waitnot yetএখনো নাWed · other fileবুধ · অন্য filenot yetএখনো নাrelevancerelevancerecencyrecencyimportanceimportanceexample numbersনমুনা সংখ্যা

You’ll learnআপনি শিখবেন

  • What an episode log storesepisode log কী রাখে
  • The three parts of a retrieval scoreretrieval স্কোরের তিনটা অংশ
  • How the best episode enters the promptসেরা এপিসোড কীভাবে প্রম্পটে ঢোকে
  • Why recency can make an old episode loserecency কেন পুরোনো এপিসোডকে হারায়

In plain words

In an agent, episodic memory stores experience from earlier decision cycles Source 1সোর্স 1. The agent can write a new experience from its working memory into episodic memory. CoALA calls this a form of learning Source 1সোর্স 1.

Episodic memory is different from semantic memory. Semantic memory holds facts. Episodic memory holds experiences Source 4সোর্স 4. "The user prefers tabs" is a fact. "Yesterday the user asked for a fix in login.ts, and the first patch failed the tests" is an experience.

The 7 names in this module follow the infographic "7 Types of Agent Memory". Research papers group memory in other ways. For example, CoALA describes a working memory and three long-term memories: episodic, semantic, and procedural Source 1সোর্স 1.

সহজ English

Episodic memory is where an agent keeps what happened to it in earlier steps Source 1সোর্স 1. The agent can copy a new experience from its short-term notes into this memory. The CoALA paper calls this a way to learn Source 1সোর্স 1.

It is not the same as semantic memory. Semantic memory keeps facts. Episodic memory keeps experiences Source 4সোর্স 4. "The user likes tabs" is a fact. "Yesterday the first fix for login.ts failed the tests" is an experience.

The 7 names in this module come from the infographic "7 Types of Agent Memory". Research papers sort memory in other ways. CoALA, for example, has a working memory and three long-term memories: episodic, semantic, and procedural Source 1সোর্স 1.

বাংলা ব্যাখ্যা

Agent-এর episodic memory আগের decision cycle-গুলোর অভিজ্ঞতা জমা রাখে Source 1সোর্স 1। agent তার working memory থেকে নতুন অভিজ্ঞতা episodic memory-তে লিখে রাখতে পারে। CoALA এটাকে শেখার একটা উপায় বলে Source 1সোর্স 1।

Episodic memory আর semantic memory এক নয়। semantic memory তথ্য রাখে, episodic memory অভিজ্ঞতা রাখে Source 4সোর্স 4। "user tab পছন্দ করেন" একটা তথ্য। "গতকাল login.ts-এর প্রথম fix টেস্টে fail করেছিল" একটা অভিজ্ঞতা।

এই module-এর ৭টা নাম "7 Types of Agent Memory" infographic থেকে নেওয়া। research paper-গুলো memory-কে অন্যভাবে ভাগ করে। যেমন CoALA-তে আছে একটা working memory আর তিনটা long-term memory: episodic, semantic আর procedural Source 1সোর্স 1।

Where it comes from

The term comes from human psychology. There, episodic memory is the ability to remember events that you lived, at a particular time and place Source 2সোর্স 2. It was defined in 1972. It supplements semantic memory, and both are forms of declarative memory Source 2সোর্স 2. The original description asks for three things about an event: what, where, and when Source 2সোর্স 2. APA notes that later work revised this to include self-awareness and a subjective conscious experience Source 2সোর্স 2.

AI research took the term over. In CoALA, episodic memory is one of the long-term memories of a language agent. It stores the agent's experience from earlier decision cycles Source 1সোর্স 1. LangChain uses the same split. It writes facts to semantic memory and experiences to episodic memory, and it credits CoALA for this idea Source 4সোর্স 4.

The "what, where, when" rule is a good guide for agents too. Tutorial's own view: a useful episode record says what the agent did, in which task or file, and when.

সহজ English

The word comes from psychology. For people, episodic memory is how you remember things that happened to you, at a certain time and place Source 2সোর্স 2. It was defined in 1972. It sits next to semantic memory, and both are kinds of declarative memory Source 2সোর্স 2. The first definition needs three parts of an event: what, where, and when Source 2সোর্স 2. APA notes that later work revised this to include self-awareness and a subjective conscious experience Source 2সোর্স 2.

AI researchers borrowed the word. In CoALA, episodic memory is a long-term memory of an agent. It keeps what the agent went through in earlier steps Source 1সোর্স 1. LangChain splits memory the same way: facts go to semantic memory, experiences go to episodic memory. LangChain says the idea comes from CoALA Source 4সোর্স 4.

Tutorial's own view: "what, where, when" also works for agents. A good record says what the agent did, in which task or file, and when.

বাংলা ব্যাখ্যা

শব্দটা এসেছে মানুষের মনোবিজ্ঞান থেকে। সেখানে episodic memory মানে নিজের জীবনে ঘটা ঘটনা, নির্দিষ্ট সময় আর জায়গাসহ, মনে রাখার ক্ষমতা Source 2সোর্স 2। এর সংজ্ঞা দেওয়া হয় ১৯৭২ সালে। এটা semantic memory-র পাশাপাশি থাকে, আর দুটোই declarative memory-র ধরন Source 2সোর্স 2। মূল সংজ্ঞায় একটা ঘটনার তিনটা দিক লাগে: কী, কোথায়, কখন Source 2সোর্স 2। APA জানায় যে পরবর্তী কাজে এটা সংশোধন করে self-awareness আর ব্যক্তিগত সচেতন অভিজ্ঞতাও যোগ করা হয়েছে Source 2সোর্স 2।

AI গবেষণা এই শব্দটা নিয়েছে। CoALA-তে episodic memory হলো language agent-এর একটা long-term memory। এটা আগের decision cycle-এর অভিজ্ঞতা রাখে Source 1সোর্স 1। LangChain-ও একইভাবে ভাগ করে: তথ্য যায় semantic memory-তে, অভিজ্ঞতা যায় episodic memory-তে। LangChain বলে, এই ধারণা CoALA থেকে এসেছে Source 4সোর্স 4।

Tutorial-এর নিজের মত: "কী, কোথায়, কখন" নিয়মটা agent-এর জন্যও কাজে লাগে। ভালো একটা রেকর্ডে থাকে agent কী করেছে, কোন task বা file-এ, আর কখন।

How an agent gets it

A memory stream. The Generative Agents study gives each agent a long-term memory module. It records a full list of the agent's experiences in natural language Source 3সোর্স 3. The paper calls this list the memory stream.

Retrieval by score. The memory stream gets long, so the agent cannot read all of it each time. A retrieval model combines three scores to pick the records that the agent needs now Source 3সোর্স 3:

new event ──> memory stream (all experiences, in natural language)
                   │
current situation ─┤
                   ▼
        score each memory: relevance + recency + importance
                   │
                   ▼
        best memories ──> prompt ──> agent acts

Reflection. The agent also turns many memories into higher-level conclusions over time. These conclusions can be about itself and about others Source 3সোর্স 3.

Few-shot examples. In practice, teams often build episodic memory as few-shot examples in the prompt. The agent learns from past sequences how to do a task correctly Source 4সোর্স 4. The hard part is to select the examples that are most relevant to the user's input Source 4সোর্স 4.

সহজ English

A diary of events. In the Generative Agents study, each agent has a long-term memory. It writes down everything the agent goes through, in plain sentences Source 3সোর্স 3. The paper calls this list the memory stream.

Picking the right pages. The diary gets long, so the agent cannot read all of it each time. It gives each memory a score from three parts and uses the best ones Source 3সোর্স 3:

Reflection. Over time, the agent sums up many memories into bigger conclusions about itself and others Source 3সোর্স 3.

Examples in the prompt. In real products, episodic memory is often a few past examples put into the prompt. The agent learns from them how to do the task right Source 4সোর্স 4. The hard part is to choose the examples that fit the user's request best Source 4সোর্স 4.

বাংলা ব্যাখ্যা

Memory stream. Generative Agents গবেষণায় প্রতিটা agent-এর একটা long-term memory module আছে। এটা agent-এর সব অভিজ্ঞতার একটা পূর্ণ তালিকা সাধারণ ভাষায় লিখে রাখে Source 3সোর্স 3। paper-টা এই তালিকাকে memory stream বলে।

Score দিয়ে retrieval. memory stream লম্বা হয়ে যায়, তাই agent প্রতিবার সবটা পড়তে পারে না। একটা retrieval model তিনটা score মিলিয়ে এখন দরকারি record-গুলো বেছে নেয় Source 3সোর্স 3:

  • Relevance: memory-টা এখনকার পরিস্থিতির সাথে কতটা মেলে।
  • Recency: শেষবার memory-টা retrieve করার পর যত সময় যায়, score তত exponential হারে কমে Source 3সোর্স 3।
  • Importance: একটা integer score। গবেষণায় এটা language model-এর কাছে চাওয়া হয় Source 3সোর্স 3।

Reflection. সময়ের সাথে agent অনেক memory মিলিয়ে নিজের আর অন্যদের সম্পর্কে বড় সিদ্ধান্তে পৌঁছায় Source 3সোর্স 3।

Few-shot example. বাস্তবে episodic memory প্রায়ই prompt-এ few-shot example হিসেবে থাকে। agent আগের ধাপগুলো থেকে শেখে, কীভাবে task ঠিকভাবে করতে হয় Source 4সোর্স 4। কঠিন কাজ হলো user-এর input অনুযায়ী সবচেয়ে মানানসই example বেছে নেওয়া Source 4সোর্স 4।

A real-life example

This example is the tutorial's own illustration. It is not a description of a real product.

A team uses a coding assistant that keeps an episode log. On Monday, the assistant fixes a flaky test in checkout.spec.ts. Its first fix adds a fixed wait, and the test still fails in CI. Its second fix waits for a network response, and the test passes. The assistant writes both attempts to its episode log, with the file and the date.

On Thursday, a different test in cart.spec.ts becomes flaky. The assistant scores its past episodes against the new task. The Monday episode is relevant and recent, so it goes into the prompt. The assistant now skips the fixed wait and tries the network wait first.

This is the mechanism of the section above: write an experience, then retrieve it by score Source 3সোর্স 3. It also shows the few-shot pattern: a past sequence teaches the agent how to do the task Source 4সোর্স 4.

সহজ English

This example is made up by the tutorial. It does not describe a real product.

A team uses a coding assistant that keeps a log of past work. On Monday, it fixes a flaky test in checkout.spec.ts. The first try adds a fixed wait, and the test still fails in CI. The second try waits for a network response, and the test passes. The assistant saves both tries in its log, with the file and the date.

On Thursday, another test in cart.spec.ts turns flaky. The assistant scores its old episodes against the new job. The Monday episode fits and is recent, so it goes into the prompt. This time the assistant tries the network wait first.

This is what the section above describes: save an experience, then pick it again by score Source 3সোর্স 3. It is also the few-shot idea: a past run shows the agent how to do the job Source 4সোর্স 4.

বাংলা ব্যাখ্যা

এই উদাহরণটা tutorial-এর নিজের বানানো। এটা কোনো বাস্তব product-এর বর্ণনা নয়।

একটা টিম এমন একটা coding assistant ব্যবহার করে, যেটা আগের কাজের একটা episode log রাখে। সোমবার assistant checkout.spec.ts-এর একটা flaky টেস্ট ঠিক করে। প্রথম চেষ্টায় সে একটা fixed wait যোগ করে, কিন্তু CI-তে টেস্ট তবুও fail করে। দ্বিতীয় চেষ্টায় সে network response-এর জন্য অপেক্ষা করে, আর টেস্ট pass করে। assistant দুটো চেষ্টাই file আর তারিখসহ log-এ লিখে রাখে।

বৃহস্পতিবার cart.spec.ts-এর আরেকটা টেস্ট flaky হয়। assistant নতুন task-এর সাথে মিলিয়ে পুরোনো episode-গুলোকে score দেয়। সোমবারের episode মানানসই আর সাম্প্রতিক, তাই সেটা prompt-এ যায়। এবার assistant প্রথমেই network wait চেষ্টা করে।

আগের অংশের পদ্ধতিটাই এখানে কাজ করছে: অভিজ্ঞতা লিখে রাখা, তারপর score দিয়ে আবার খুঁজে আনা Source 3সোর্স 3। এটা few-shot ধারণাও দেখায়: আগের একটা ধাপের ক্রম agent-কে task করতে শেখায় Source 4সোর্স 4।

Common mistakes

The Generative Agents study reports its most common errors. The agent failed to retrieve relevant memories. It also fabricated embellishments to its memory Source 3সোর্স 3. The paper notes it was rare for agents to fabricate knowledge completely; the problem was mostly embellishment of real memories Source 3সোর্স 3. The study is a simulation of agents in a sandbox game, not a product. The same risks still apply to any agent that recalls past episodes.

  • The right memory is not retrieved. The record exists, but the agent does not find it Source 3সোর্স 3. The agent then repeats an old mistake.
  • Invented details. At times, the agents hallucinated extra details about what they knew Source 3সোর্স 3. A user can trust a false "last time we did X" because it sounds like a real memory.
  • The wrong examples in the prompt. With few-shot memory, the challenge is to select the most relevant examples for the input Source 4সোর্স 4. A poor match teaches the agent the wrong pattern.
  • Facts and experiences in one store. LangChain keeps facts in semantic memory and experiences in episodic memory Source 4সোর্স 4. Tutorial's own view: if a team mixes them, an old one-time event can look like a general rule.

সহজ English

The Generative Agents study lists its most common errors. The agent did not find memories it needed. It also added made-up details to its memories Source 3সোর্স 3. The paper notes it was rare for agents to make up knowledge completely; the problem was mostly embellishing real memories Source 3সোর্স 3. The study is a game simulation, not a product. But any agent that remembers past events can have the same problems.

  • It does not find the memory. The record is there, but the agent misses it Source 3সোর্স 3. So it makes the old mistake again.
  • It makes things up. Sometimes the agents added false details to what they knew Source 3সোর্স 3. A false "last time we did X" sounds real, so people believe it.
  • It picks the wrong examples. With examples in the prompt, the hard part is to choose ones that fit the input Source 4সোর্স 4. A bad choice teaches the wrong pattern.
  • Facts and events are mixed. LangChain keeps facts in semantic memory and experiences in episodic memory Source 4সোর্স 4. Tutorial's own view: if you mix them, one old event can look like a rule.

বাংলা ব্যাখ্যা

Generative Agents গবেষণা তার সবচেয়ে সাধারণ ভুলগুলো জানায়। agent দরকারি memory খুঁজে পায়নি। আবার সে নিজের memory-তে বানানো বাড়তি details যোগ করেছে Source 3সোর্স 3। গবেষণা বলছে, agent-এর সম্পূর্ণ বানিয়ে ফেলা বিরল ছিল; সমস্যা ছিল বেশির ভাগ ক্ষেত্রে আসল memory-তে বাড়তি অলংকরণ Source 3সোর্স 3। গবেষণাটা একটা sandbox game-এর simulation, কোনো product নয়। তবুও যে agent আগের episode মনে করে, তার ক্ষেত্রে একই ঝুঁকি থাকে।

  • সঠিক memory খুঁজে না পাওয়া। record আছে, কিন্তু agent সেটা পায় না Source 3সোর্স 3। ফলে সে পুরোনো ভুলটাই আবার করে।
  • বানানো details। মাঝে মাঝে agent-রা নিজেদের জানা বিষয়ে বাড়তি details hallucinate করেছে Source 3সোর্স 3। "গতবার আমরা X করেছিলাম" ধরনের মিথ্যা কথা আসল memory-র মতো শোনায়, তাই আপনি সহজে বিশ্বাস করতে পারেন।
  • prompt-এ ভুল example। few-shot memory-তে চ্যালেঞ্জ হলো input-এর সাথে সবচেয়ে মানানসই example বাছা Source 4সোর্স 4। খারাপ মিল agent-কে ভুল pattern শেখায়।
  • তথ্য আর অভিজ্ঞতা এক জায়গায়। LangChain তথ্য রাখে semantic memory-তে আর অভিজ্ঞতা রাখে episodic memory-তে Source 4সোর্স 4। Tutorial-এর নিজের মত: দুটো মিশিয়ে ফেললে একবারের একটা পুরোনো ঘটনা সাধারণ নিয়মের মতো দেখাতে পারে।

What a tester can check

You test episodic memory like a witness: ask about the past, then compare the answer with the record.

Tutorial advice

These test ideas are the tutorial's own advice.

  • Ask about last time. Let the agent do a task. In a later session, ask what it did last time. Compare the answer with the log.
  • Ask about an event that never happened. Check that the agent says it has no such memory and does not invent one.
  • Old against new. Store two past episodes that both match a task, one old and one recent. Check which one the agent uses, and ask the team which one it should use.
  • Look at the examples. For a given input, log the few-shot examples that the agent puts into the prompt. Check that they fit the input.
  • Check what, where, when. Read some episode records. Check that each one says what happened, in which task or file, and when.

সহজ English

Test episodic memory like a witness: ask about the past, then compare the answer with the records.

These test ideas are the tutorial's own advice.

  • Ask about last time. Let the agent do a task. Later, ask what it did last time. Compare the answer with the log.
  • Ask about something that never happened. Check that the agent says it does not remember it and does not make it up.
  • Old against new. Save two past events that both fit a task, one old and one recent. See which one the agent uses, and ask the team which one it should use.
  • Look at the examples. For one input, log the examples the agent puts in the prompt. Check that they fit.
  • Check what, where, when. Read some saved events. Check that each one says what happened, in which task or file, and when.

বাংলা ব্যাখ্যা

Episodic memory টেস্ট করুন একজন সাক্ষীকে প্রশ্ন করার মতো: অতীত নিয়ে জিজ্ঞেস করুন, তারপর উত্তরটা record-এর সাথে মিলিয়ে দেখুন।

এই টেস্টের ধারণাগুলো tutorial-এর নিজস্ব পরামর্শ।

  • গতবারের কথা জিজ্ঞেস করুন। agent-কে একটা task করতে দিন। পরের session-এ জিজ্ঞেস করুন, গতবার সে কী করেছিল। উত্তরটা log-এর সাথে মিলিয়ে দেখুন।
  • এমন ঘটনার কথা জিজ্ঞেস করুন, যা ঘটেনি। দেখুন agent বলে কিনা যে তার এমন কোনো memory নেই, আর সে কিছু বানিয়ে বলে কিনা।
  • পুরোনো বনাম নতুন। একই task-এর সাথে মেলে এমন দুটো episode রাখুন, একটা পুরোনো, একটা সাম্প্রতিক। agent কোনটা ব্যবহার করে দেখুন, আর কোনটা ব্যবহার করা উচিত, তা টিমকে জিজ্ঞেস করুন।
  • example-গুলো দেখুন। একটা input-এর জন্য agent prompt-এ কোন few-shot example দেয়, তা log করুন। সেগুলো input-এর সাথে মেলে কিনা যাচাই করুন।
  • কী, কোথায়, কখন যাচাই করুন। কয়েকটা episode record পড়ুন। প্রতিটায় কী ঘটেছে, কোন task বা file-এ, আর কখন, তা আছে কিনা দেখুন।

Key words

TermMeaning
Episodic memoryThe agent's store of experiences from earlier decision cycles. In psychology: memory of events you lived, at a time and place.
Declarative memoryThe psychology group that holds both episodic and semantic memory.
Memory streamThe Generative Agents list of all of an agent's experiences, in natural language.
Relevance, recency, importanceThe three scores that the Generative Agents retrieval model combines to pick memories.
ReflectionTurning many memories into higher-level conclusions.
Few-shot examplesPast examples in the prompt. A common way to build episodic memory in practice.
Hallucinated memoryA detail that the agent adds to its memory but that never happened.

Reels on this topicএই টপিকের রিলস

Short videos from other creators, picked for this topic. They are not part of this page's fact-checked text. Nothing loads from YouTube until you press Play.অন্য ক্রিয়েটরদের বানানো ছোট ভিডিও, এই টপিকের জন্য বাছাই করা। এগুলো এই পেজের ফ্যাক্ট-চেক করা লেখার অংশ নয়। চালান বাটন চাপার আগে YouTube থেকে কিছুই লোড হয় না।

  1. [1]
    Cognitive Architectures for Language Agents (CoALA), Sumers, Yao, Narasimhan, Griffiths

    arXiv 2309.02427 (TMLR) · accessed 2026-10-28দেখা হয়েছে: 2026-10-28

  2. [2]
    episodic memory

    APA Dictionary of Psychology · accessed 2026-10-28দেখা হয়েছে: 2026-10-28

  3. [3]
    Generative Agents: Interactive Simulacra of Human Behavior, Park et al.

    arXiv 2304.03442 (UIST 2023) · accessed 2026-10-28দেখা হয়েছে: 2026-10-28

  4. [4]
    Memory overview

    LangChain (LangGraph docs) · accessed 2026-10-28দেখা হয়েছে: 2026-10-28