К содержанию
Статья ещё не опубликована на языке Russian. Показана версия на English.

Agent Memory Systems: Working State, Episodic History, and Semantic Knowledge

2 мин на чтение

Human teams do not re-read every company handbook and every past email from scratch before replying to a customer. They rely on distinct types of memory. Modeling agent memory cleanly prevents prompt bloat and stops contradictory facts from leaking across conversations.

Three Distinct Memory Layers

Memory TypeLifespanStorage PatternExamples
Working MemorySingle run / active taskIn-memory loop state + scratchpadTool outputs, pending draft, active filters
Episodic MemoryPer customer / threadRolling summaries + structured profile factsPreferred language, past orders, unresolved ticket
Semantic MemoryWorkspace-wideIndexed KB + hybrid vector/lexical searchProduct specs, refund policies, onboarding docs

Memory Hygiene: Expiration and Conflict Resolution

Unbounded memory accumulation degrades accuracy over time. Every memory write should carry:

  1. Source provenance (did the customer state this directly, or did a verified billing webhook confirm it?).
  2. Timestamp / TTL (delivery city from last week is useful; "I need it today" from 6 months ago is stale).
  3. Explicit overwrite semantics so verified transactional events supersede older inferred chat facts.
ts
export interface MemoryFact {
  key: string;
  value: string;
  source: "customer_message" | "verified_system_event" | "human_agent";
  observedAtIso: string;
  expiresAtIso?: string;
}

export function shouldReplaceFact(existing: MemoryFact, incoming: MemoryFact): boolean {
  const trustRank = { customer_message: 1, human_agent: 2, verified_system_event: 3 };
  if (trustRank[incoming.source] > trustRank[existing.source]) return true;
  return incoming.observedAtIso >= existing.observedAtIso;
}

Strict Multi-Tenant Memory Boundaries

Never share episodic customer memory across workspaces, and never mix unverified customer utterances into workspace-wide semantic knowledge without explicit review.

Next: stop infinite loops and cost spikes before they hit production in Preventing Runaway Agents.

Было ли это полезно?