AI エージェントの記憶機能の仕組み(28 分読了)
この記事は、LLM の忘却問題を解決し対話の継続性を可能にする「エージェント・メモリー」システムの仕組みと、各ループで保持すべき情報の選別戦略について深く分析している。
キーポイント
LLM の忘却特性とメモリの必要性
言語モデルは応答完了直後に全ての文脈をリセットするため、対話の継続性や長期記憶を実現するには外部または内部のメモリシステムが不可欠である。
情報伝達の戦略的選別
単に全てのデータを蓄積するのではなく、次のループで本当に必要な情報のみをフィルタリングし、コンテキストウィンドウを効率的に運用する手法が議論される。
エージェント・メモリアーキテクチャ
情報を保持・検索・更新するための具体的なシステム設計や、異なるアプローチ(例:ベクトルデータベース、要約、構造化データ)の比較考察が含まれる。
影響分析・編集コメントを表示
影響分析
この記事は、LLM を単なるチャットボットから自律的なエージェントへと進化させるための基盤技術である「メモリ」の重要性を浮き彫りにしており、開発者がシステム設計において直面する核心的な課題への解決策を示唆している。実用レベルのエージェント構築においては、コンテキスト管理や情報選別のアルゴリズムが成否を分ける要素として認識されるべき重要な知見である。
編集コメント
エージェント開発において、単なるプロンプトエンジニアリングを超えた「記憶の設計」が次世代の重要な争点となっていることを示唆する良質な解説記事です。
01 前提
エージェントにとって「メモリ」が実際に意味するもの。
言語モデル単体では状態を持たない。プロンプトを入力すると、続きのテキストが返され、応答が終わった瞬間にモデルはあなたが存在したことを忘れる。重みの中に「過去の会話」というものは存在しない。
一方、*エージェント*とは、そのモデルを取り巻くオーケストレーションであり、「次にどの文脈を渡すか」を決定するループである。メモリとは、そのループの中で情報を次へ引き継ぐ部分だ。本稿で述べているすべては、同じ問いに対する異なる答えに過ぎない。「今回はプロンプトに何を盛り込むべきか?」という問いに対してだ。
状態を持たない LLM の呼び出し
各呼び出しでは、自分自身のプロンプトしか見えない。
すべてのターンはゼロから始まる。
メモリを持つエージェント
各呼び出しでは、プロンプト+引き継がれた文脈の両方を見る。
各ターンで ctx[] に追加していく。銀行(記憶領域)は成長する。
デモ
実際に試してみる
メモリをオンにする
3 つのメッセージを送信し、メモリを切り替えて、過去のターンを文脈に含める場合と含めない場合の両方で同じ会話が再生される様子を確認してください。
開始するにはメッセージを送信してください。
ターン 0 / 3
**「フラストレーションを感じるエージェントはすべてを忘れ、危険なエージェントは間違って記憶する。」
02 最も単純なメモリ
コンテキストウィンドウは動く歩道のようなものだ。
何か複雑な話を始める前に、存在する中で最も単純な種類のメモリを認めよう:それは、すべての転送で完全な会話記録をプロンプトに詰め込むだけだ。すべてが収まる限り、モデルは完璧な記憶保持能力を持つ。
問題は上限にあります。すべてのモデルには固定されたコンテキストウィンドウがあります。会話がこの範囲を超えると、何かを削除しなければなりません。素朴なポリシーは FIFO(先入れ先出し)です:最も古いターンから順に削除します。続けて入力していくとどうなるか見てみましょう。
コンテキストウィンドウ
0 / 120 トークン
FIFO はあり得る中で最も単純なポリシーですが、削除されたターンにユーザーの名前が含まれていた場合、これほど最悪のケースはありません。実際のシステムはより優れた手法を採用しています:要約、検索、階層的ページングなどです。これらについては後で詳しく説明します。
「コンテキストはデータベースではありません。クエリプランもインデックスもアクセス制御も TTL(Time To Live)も競合解決機構もありません。」
03 2 つのストア、1 つのエージェント
ワーキングメモリは考え、長期記憶は覚えています。
ある瞬間において、あなたのエージェントは非常に異なる 2 つのことを同時に処理しています。一方には、ライブの会話、直近のターン、保留中のツール呼び出し、モデルが現在推論しているあらゆるものがあります。他方には、これまで保存する価値があると判断したすべての情報が含まれます。
この 2 つの間でのハンドオフ(引き渡し)こそが、最も興味深い設計が行われる場所です。何をエンコードするか?いつ?どの粒度で?メッセージを境界線を超えてドラッグするか、ドラッグサポートがないデスクトップでは「encode →」をタップして、長期記憶にコミットします。
ライブ、変更可能、プロンプト内
- ユーザー:私は Refik Anadol Studio で働いています。
- エージェント:素敵ですね。ジェネレーティブアート、对吧?
- ユーザー:『ベルセルク』が大好きで、毎年読んでいます。
- ユーザー:近くのコーヒーショップを探せますか?
- ユーザー:ハイランドパークに住んでいます。
埋め込み、永続的、オンデマンド検索用
メッセージをここにドロップするか、「encode →」をクリックしてください。テキストはベクトル埋め込み(vector embedding)に圧縮されます。
実際のシステムでは、エージェント自身がこれを決定します。通常は「このターンを記憶する価値があるか?」といった質問で別のモデルにプロンプトを与えることで行われます。自己編集型メモリアーキテクチャはさらに一歩進み、エージェントがその長期ストレージをリアルタイムで*編集*できるようにします。セクション 7 ではこれらのアプローチを並列比較しています。
ライフサイクル、ストレージではない
書き込みの競合について。
メモリはライフサイクルの問題です:書き込み、経年変化、上書き、削除、忘却。同じ入力に対して3つの異なる方法で処理される様子を見守りましょう。
着信発言
ユーザーはイスタンブールに住んでいます。ユーザーは来月ベルリンへ引っ越します。ユーザーのクレジットカード番号は 1234-5678-9012-3456 です。
単純な追加方式では個人識別情報(PII)が漏洩し、矛盾が生じます。単純な上書き方式では時間的文脈が失われ、エージェントは「ユーザーは以前どこに住んでいましたか?」と問うことができません。ガバナンス方式では履歴を明示的に保持し、古い事実を*上書き済み*としてマークし、機密トークンをストアに格納する前に削除します。
04 意味的検索
エンベディングは意味を幾何学に変換します。
エンベディング(埋め込み)とは、ある特定の目的のために訓練されたニューラルネットワークにテキストを通すことで生成される数値のリスト、つまりベクトルです。その目的とは「類似する意味を持つものを互いに近くに配置すること」です。実際のエンベディングは通常数百から数千次元にわたりますが、OpenAI の現在のテキストエンベディングのデフォルトは 1,536 次元または 3,072 次元です。それらを可視化することは不可能なので、この簡易デモでは 2 次元へ投影しています。
以下のプロットには、トピックごとにクラスタリングされた架空のユーザーの記憶が含まれています。質問を入力してください。クエリは同じように埋め込まれ、プロット上に配置されます。コサイン類似度で測定された最も近い点が、エージェントが取得する対象となります。
Query
top-k
- dim_0 →↑ dim_1User likes Berserk and re…User reads One Piece mang…User watches anime in the…queryRetrieved (top-3)ranked by cosine similarity1User watches anime in the evenings.0.999
- 2User likes Berserk and reads it every year.0.996
- 3User reads One Piece manga weekly.0.992
preference
fact
skill
event
Query
ここで示されている 2 次元レイアウトは、あえて描かれた漫画的な表現です。実際の埋め込みモデルでは、これらのベクトルは数千の次元を持つ空間に配置され、多くの独立した「意味の軸」が互いに混雑することなく共存します。しかしコサイン類似度は次元数に関わらず同じように機能するため、このトリックはスケーラブルなのです。
05A taxonomy
4 つの記憶、1 つのエージェント。
認知科学は過去 1 世紀にわたり「記憶」を分類し続けてきました。現代のエージェントフレームワークも、これらの区別が実際に有用であるため、同じ用語を採用しています。各タイプには異なる形状、異なる書き込みルール、そして異なる検索戦略が存在します。
各カードをクリックすると、そのストアがどのように機能するかを示す簡易版を確認できます。
4 つをすべて組み合わせた場合
訪問者がミュージアムエージェントに近づき、こう言います。
「先ほど言及された Refik の作品について、もっと教えてください。」
- 01 エピソード記憶:ベクトル検索により、Refik の作品に関する以前のチャット履歴を検索
- 02 セマンティック記憶:RAG(Retrieval-Augmented Generation)がカタログから該当作品の完全な説明情報を取得
- 03 手続き的記憶:カタログに不足しているライブデータがある場合、artwork_detail ツールが起動
- 04 ワーキングメモリ:システムプロンプト、取得された事実、ツールの結果、そして新しいメッセージがアクティブなコンテキスト上に並び、LLM がそこから回答を生成
1 つのターンで 4 つの記憶領域。エージェントはユーザーにその隙間が見えないように、「記憶する」(エピソード)、"知っている"(セマンティック)、「実行できる」(手続き的)、そして「生きているスレッドを追跡する」(ワーキング)ことを実現します。
06 完全なパイプライン
検索ループを段階的に追う。
前節までのすべての要素がここで一体化します。RAG は、各ターンで生産環境のエージェントが実行する主要なループです:ユーザーのメッセージを受信し、エンコードし、類似した記憶を検索し、それらをプロンプトに組み込み、生成を行い、そしてユーザーが新しい情報を提示した場合のみ、何を記憶すべきかを判断します。
-
-
-
-
-
-
-
-
-
user message
今朝、エコー・マウンテンをハイキングしました。ハイランド・パーク周辺にも似たようなトレイルはありますか?
ループ内の各段階は、エンジニアリング予算を投入できる場所です。より優れた埋め込み表現(embeddings)、賢い検索、プロンプト圧縮、厳格なガバナンス——これらはすべて同じパイプラインの一部であり、単に特定のステップでより注意深く処理されているだけです。
2 つの生産環境での工夫
仮説的文書埋め込み
質問とその回答は異なる形状をしています。*質問*を直接エンコードすると、*回答*を含む文書を逃すことがよくあります。
HyDE は、LLM にまず仮説的な回答を生成させ、その回答を埋め込み(embed)、その後検索を行います。偽の回答は正確である必要はなく、検索対象となる形式に似ていれば十分です。
trace
user「ユーザーは通常週末どこに行きますか?」
llm「ユーザーは週末に峡谷でハイキングに行きます。」
embed[0.07, -0.55] ← 回答を埋め込み
search→ ユーザーは土曜日に峡谷でハイキングを行います。
07 読み取りパス(read path)
検索は単なる参照ではなく、パイプラインである。
本番環境での検索は、すべてのターンで実行される小さなパイプラインです。まずメモリが必要かどうかを判断し、クエリを書き換え、複数の検索器を並列で実行し、そのランキングを統合し、再ランク付けを行い、権限と時間的なフィルタを適用し、最後に生き残った結果をプロンプトにパックします。これらの段階のいずれかを省略すると、通常はシステムが破綻する原因となります。
need?→
rewrite→
dense→
sparse→
graph→
fuse→
rerank→
filter→
pack
必要性の検出(Need detection)
そもそもメモリストアにアクセスすべきか?
検索を呼び出すにはコストがかかります。モデルが冷たい状態(事前学習済みの知識のみで、外部記憶なし)で回答できる場合は、それをスキップしてください。
retrieve
セッション間の一貫性を求める場合
もし検索が必要であると判断された場合でも、単一の検索器を選ぶことはほとんどありません。密集埋め込み(dense embeddings)は言い換えや意図の理解に優れており、語彙ベース(BM25)は正確な ID や稀なトークンにおいて勝ります。知識グラフ(knowledge graph)は構造的な回答を提供します。これら 3 つをすべて実行し、RRF(Reciprocal Rank Fusion:逆順位融合)を用いてランキングを統合してください。
ハイブリッドパイプライン(Hybrid pipeline)
3 つの検索器、1 つの統合リスト。
密集埋め込み(Dense embeddings)
- 1.m5
- 2.m1
- 3.m6
- 4.m4
- 5.m7
語彙ベース(Sparse, BM25)
- 1.m5
- 2.m3
- 3.m6
- 4.m8
- 5.m1
グラフウォーク(Graph walk)
- 1.m1
- 2.m2
- 融合後 (RRF)、メモリはスパースグラフスコアを濃縮します。ユーザーはロサンゼルスのハイランドパークに住んでいます。2510.0479
ユーザーは土曜日に峡谷でハイキングを行います。11-0.0328
ユーザーはコード付きの簡潔な回答を好みます。33-0.0317
ユーザーはレフィク・アナドル・スタジオで勤務しています。-2-0.0161
ユーザーはかつてイスタンブールに住んでいました。--20.0161
ユーザーは『ベルセルク』を好み、毎年読んでいます。4--0.0156
フィルタリング
同じクエリでも、異なるステージでは結果が一致することは稀です。興味深いバグは後段に発生します:技術的には正しい検索器が、古くなったメモリや範囲の誤ったメモリを生成したり、単独では問題なくても他の取得行と矛盾したりするケースです。フィルタリングと再ランク付けは、そのような場合に存在します。
08
トレードオフ
6 つのアーキテクチャ、6 つのトレードオフ
多くのプロダクション環境のエージェントは、これらのいくつかを組み合わせています。意味的な想起のためのベクトルストア、構造化された事実のためのグラフ、置換と個人識別情報 (PII) を処理するガバナンス層などです。以下のマトリックスでは、アーキテクチャが直接提供するものと、メタデータまたはポリシー層を必要とするものを区別しています。
| アーキテクチャ | スケール | 構造 | 置換 | PII ゲート | 共有 | 監査 |
|---|---|---|---|---|---|---|
| シンプルなバッファ | ローリングサマリー | - | - | - | - | - |
| ベクトルストア | - | - | - | - | - | - |
| 知識グラフ | - | - | - | - | - | - |
| 階層的 (MemGPT) | ネイティブフィット | メタデータ/ポリシーが必要 | 固有ではない | |||
| 自己編集 (Letta) | - | - | - | - | - | - |
ベクトルストア
すべてのメモリを埋め込み、類似度に基づいて上位 k 件を取得します。
RAG シェイプのエージェントにおけるデフォルトです。§4 と §6 で見たすべてが該当します。
利点
- 実質的に無制限の容量
- キーワードだけでなく意味的な想起が可能
- 成熟したツールセット
欠点
- 検索の質は埋め込みモデルに依存します
- 追加のメタデータなしでは関係性や時間の概念はありません
- 書き込みが保護されていない場合、容易に汚染されます
Pinecone, Weaviate, pgvector で確認可能 · 現代の LLM アプリの多くで採用
アーキテクチャ
ベクトル空間
「メモリガバナンスこそが、単発のデモと本番環境のエージェントを分けるものです。」
09 エージェント間の共有
マルチエージェントのメモリはストアではなくグラフです。
単一のエージェントであれば、「私が何を覚えているか?」という問いに答えるだけで済みます。しかし、チームができた瞬間、問いは「どのエージェントが、誰の名において、どの事実を覚えており、他に誰がそれを読み取れるのか?」へと変わります。メモリは、スコープ、権限、伝播ルールを持つストアのグラフへと変貌します。
メモリのトポロジー
組織 · 実行手順 · ポリシー
共有プロジェクトメモリ:意思決定・アーキテクチャ
研究者(プライベート)
開発者(プライベート)
レビューア(プライベート)
プランナー(プライベート)
private = デフォルト
shared = 明示的な書き込み
エージェントをタップまたはホバーすると、そのアクセスパスが表示されます。
デフォルトは「簡単なこと」の逆であるべきです:デフォルトでプライベートメモリとし、共有メモリは明示的に書き込む必要があります。研究者エージェントが自分自身のためにメモした研究ノートが、プロジェクトチャンネルに自動的に掲載される必要はありません。クロススコープでの書き込みは、ポリシーを添付した意図的な行為であるべきです。
権限ラボ
この書き込みは許可されますか?
エージェントを選択し、何をどこに書き込みたいかを指定してください。トークで提示されたポリシーテーブルが判断します。
エージェントの役割:researcher_agent.write("research note", scope=project)
コンテンツの種類:研究ノート
ターゲットスコープ:プロジェクト
結果:ALLOW(許可)
デフォルトはプライベートメモリ、明示的な書き込みでプロジェクトへ
興味深い失敗モードはもはや「エージェントが忘れた」ことではありません。むしろ、「別の人の代わりに間違ったことを間違ったエージェントが覚えていた」といった現象です。6 つのパターンが繰り返し現れます:
失敗モード
共有メモリが害をなす 6 つの方法。
何が間違っているか
研究者用エージェントが「ユーザーはベジタリアンレシピを好む」という情報をプロジェクトメモリに保存しました。次のセッションでは、別のユーザーが突然ベジタリアンの提案を受け取ります。
予防策
すべての読み取り操作で tenant_id と user_id のフィルタを使用する。テナント間でのデフォルトは拒否とする。
AutoGen、CrewAI、LangGraph といったフレームワークはそれぞれ、配管(基盤)、チェックポイント、永続化、メッセージ伝達プリミティブを提供します。しかし、ガバナンスを決定するのはそれらではなく、あなた自身です。スコープ、ポリシー、取り込み、評価の責任は依然としてあなたにあります。
<svg xmlns="http://www.w3.org/2000/svg" width="24
原文を表示
01The premise
What "memory" actually means for an agent.
A language model on its own is stateless. You feed it a prompt, you get back a continuation, and the moment the response is finished the model forgets you ever existed. There is no “previous conversation” living inside the weights.
An *agent*, by contrast, is the orchestration around the model: a loop that decides what context to pass in *next*. Memory is the part of that loop that carries information forward. Everything in this essay is a different answer to the same question, what should we put in the prompt this time?
Stateless LLM call
Each call sees only its own prompt.
Every turn starts from nothing.
Agent with memory
Each call sees prompt + carried context.
Each turn appends to ctx[]. The bank grows.
Demo
Try it yourself
Memory on
Send three messages. Toggle memory to see the same conversation replayed with, and without, the prior turns in context.
Send a message to begin.
Turn 0 / 3
“A frustrating agent forgets everything. A dangerous one remembers wrong.”
02The simplest memory
The context window is a moving sidewalk.
Before we discuss anything fancy, let's acknowledge the simplest kind of memory there is: just keep stuffing the whole transcript back into the prompt every turn. As long as everything fits, the model has perfect recall.
The catch is the ceiling. Every model has a fixed context window. Once your conversation outgrows it, you have to drop something. The naive policy is FIFO: drop the oldest turn first. Watch what happens when you keep typing.
Context window
0 / 120 tokens
FIFO is the simplest possible policy. It's also the worst when the dropped turn happens to contain the user's name. Real systems do better, summarization, retrieval, hierarchical paging. We'll get to those.
“Context is not a database. No query plan, no index, no access control, no TTL, no conflict resolution.”
03Two stores, one agent
Working memory thinks. Long-term memory remembers.
At any given moment your agent is juggling two very different things. On one side: the live conversation, recent turns, pending tool calls, whatever the model is actively reasoning over. On the other: everything it has ever decided was worth keeping.
The handoff between them is where most of the interesting design happens. What gets encoded? When? At what granularity? Drag a message across the divide, or tap encode → on a desktop without drag support, to commit it to long-term memory.
Live, mutable, in-prompt
- userI work at Refik Anadol Studio.
- agentCool, generative art, right?
- userI love Berserk and read it every year.
- userCan you find a coffee shop nearby?
- userI live in Highland Park.
Embedded, persistent, retrieved on demand
Drop a message here, or click encode →. The text gets compressed into a vector embedding.
In a real system the agent decides this for itself, usually by prompting another model with a question like “is this turn worth remembering?”. Self-editing memory architectures push further, letting the agent *edit* its own long-term store on the fly. Section 7 compares those approaches side by side.
Lifecycle, not storage
When writes conflict.
Memory is a lifecycle problem: write, age, supersede, redact, forget. Watch the same input handled three different ways.
Incoming utterance
User lives in Istanbul. User is moving to Berlin next month. User's credit card number is 1234-5678-9012-3456.
Naive append leaks PII and produces contradictions. Naive overwrite loses temporal context, the agent can't answer “where did the user used to live?”. Governance preserves history explicitly, marks the old fact *superseded*, and redacts the sensitive token before it ever enters the store.
04Semantic search
Embeddings turn meaning into geometry.
An embedding is a vector, a list of numbers, produced by running text through a neural network trained for one purpose: put similar meanings near each other. Real embeddings usually live in hundreds to thousands of dimensions; OpenAI's current text embeddings default to 1,536 or 3,072 dimensions. Visualizing those is impossible, so this toy demo projects to two.
The plot below contains a fictional user's memories, clustered by topic. Type a question. The query gets embedded the same way and placed on the plot. The closest points, measured by cosine similarity , are what the agent would retrieve.
Query
top-k
- dim_0 →↑ dim_1User likes Berserk and re…User reads One Piece mang…User watches anime in the…queryRetrieved (top-3)ranked by cosine similarity1User watches anime in the evenings.0.999
- 2User likes Berserk and reads it every year.0.996
- 3User reads One Piece manga weekly.0.992
preference
fact
skill
event
Query
The 2-D layout here is a deliberate cartoon. Real embedding models place these vectors in spaces with thousands of dimensions, where many independent “axes of meaning” can coexist without crowding each other. Cosine similarity, though, works the same way regardless of dimension, which is why the trick scales.
05A taxonomy
Four memories, one agent.
Cognitive science has been carving up “memory” for a century. Modern agent frameworks borrow the same vocabulary because the distinctions are actually useful: each kind has a different shape, a different write rule, and a different retrieval strategy.
Click each card to see a toy version of how that store works.
All four together
A visitor walks up to the museum agent and says:
“Tell me more about that Refik piece you mentioned earlier.”
- 01Episodic · vector search finds the prior chat where the Refik piece came up
- 02Semantic · RAG pulls that piece's full description from the catalogue
- 03Procedural · an artwork_detail tool fires for any live data the catalogue lacks
- 04Working · system prompt + retrieved facts + tool result + the new message all sit in the active context, and the LLM answers from there
One turn, four stores. The agent *remembers* (episodic), *knows* (semantic), *can do* (procedural), and *follows* the live thread (working) without the user noticing any of the seams.
06The full pipeline
Step through a retrieval loop.
Everything from the previous sections clicks together here. RAG is the loop most production agents run on every turn: receive the user's message, encode it, find similar memories, splice them into the prompt, generate, and, only when the user introduced something new, decide what is worth remembering.
-
-
-
-
-
-
-
-
-
user message
I just hiked Echo Mountain this morning. Any other trails like that around Highland Park?
Each stage in the loop is a place where you can spend engineering budget. Better embeddings, smarter retrieval, prompt compression, stricter governance, they're all the same pipeline, just with more care taken at one step.
Two production tricks
Hypothetical Document Embeddings
A question and its answer are different shapes. Embedding the *question* directly often misses documents that contain the *answer*.
HyDE asks the LLM to produce a hypothetical answer first, embeds *that*, then searches. The fake answer doesn't need to be correct, just shaped like the retrieval target.
trace
user“Where does the user usually go on weekends?”
llm“The user goes hiking in the canyons on weekends.”
embed[0.07, -0.55] ← embeds the answer
search→ User goes hiking in the canyons on Saturdays.
07The read path
Retrieval is a pipeline, not a lookup.
Production retrieval is a small pipeline running on every turn: decide if you even need memory, rewrite the query, run several retrievers in parallel, merge their rankings, rerank, apply permission and temporal filters, then pack what survives into the prompt. Skipping any one of these stages is usually how things break.
need?→
rewrite→
dense→
sparse→
graph→
fuse→
rerank→
filter→
pack
Need detection
Should we hit the memory store at all?
Calling retrieval is not free. If the model can answer cold, skip it.
retrieve
asks for continuity across sessions
If retrieval *is* warranted, you almost never want to pick a single retriever. Dense embeddings are great for paraphrase and intent; lexical (BM25) wins on exact IDs and rare tokens; a knowledge graph contributes structural answers. Run all three and fuse the rankings with RRF.
Hybrid pipeline
Three retrievers, one fused list.
Dense (embeddings)
- 1.m5
- 2.m1
- 3.m6
- 4.m4
- 5.m7
Sparse (BM25)
- 1.m5
- 2.m3
- 3.m6
- 4.m8
- 5.m1
Graph walk
- 1.m1
- 2.m2
- After fusion (RRF)memorydensesparsegraphscoreUser lives in Highland Park, LA.2510.0479User goes hiking in the canyons on Saturdays.11-0.0328User prefers concise answers with code.33-0.0317User works at Refik Anadol Studio.-2-0.0161User used to live in Istanbul.--20.0161User likes Berserk and reads it yearly.4--0.0156FiltersSame query, different stages, same outcome rarely. The interesting bugs are downstream: a retriever that's technically correct produces a memory that's outdated, or scoped wrong, or fine on its own but contradicts another retrieved row. Filters and rerank exist for those cases.08Tradeoffs
Six architectures, six tradeoffs.
Most production agents end up combining several of these, a vector store for semantic recall, a graph for structured facts, a governance layer that handles supersession and PII. The matrix below separates what the architecture gives you directly from what needs a metadata or policy layer.ArchitectureScaleStructureSupersedesPII gateSharingAuditSimple bufferRolling summaryVector storeKnowledge graphHierarchical (MemGPT)Self-editing (Letta) native fit needs metadata / policy not inherent
Vector store
Embed every memory; retrieve top-k by similarity.The default for RAG-shaped agents. Everything you saw in §4 and §6.ProsEffectively unbounded capacity
- Semantic recall, not just keyword
- Mature tooling
Cons
- Retrieval quality depends on the embedding model
- No notion of relations or time without extra metadata
- Easy to poison if writes are unguarded
Seen inPinecone, Weaviate, pgvector · Most modern LLM apps
Architecture
vector space
“Memory governance is what separates a one-off demo from a production agent.”
09When agents share
Multi-agent memory is a graph, not a store.
A single agent only has to answer “what do *I* remember?”. As soon as you have a team, the question becomes: *which* agent remembers *which* fact, on *whose* behalf, and who else can read it. Memory turns into a graph of stores with scopes, permissions, and propagation rules.
Memory topology
organization · runbooks · policySHAREDproject memorydecisions · architectureResearcherprivateCoderprivateReviewerprivatePlannerprivateprivate = defaultshared = explicit write
Tap or hover an agent to see its access path.
The default should be the opposite of the easy thing: private memory by default, shared memory explicit. A research note the Researcher agent jots down for itself does not need to land in the project channel. Cross-scope writes should be a deliberate act, with a policy attached.
Permission lab
Will this write be allowed?
Pick an agent, what they want to write, and where it would land. The policy table from the talk decides.
Agent role
Content kind
Target scope
ALLOW
researcher_agent.write("research note", scope=project)
private memory default; explicit write to Project
The interesting failure modes aren't “the agent forgot” anymore. They're things like* the wrong agent remembered the wrong thing on someone else's behalf*. Six patterns show up over and over:
Failure modes
Six ways shared memory hurts.
What goes wrong
Researcher agent stored 'user prefers vegan recipes' in project memory. Next session, a different user gets vegan suggestions out of nowhere.
Prevention
tenant_id + user_id filters on every read. Default deny across tenants.
Frameworks like AutoGen, CrewAI, and LangGraph each give you the plumbing, checkpoints, persistence, message-passing primitives. None of them decide your governance for you. Scope, policy, ingestion, and evaluation are still yours.
<svg xmlns="http://www.w3.org/2000/svg" width="24
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み