Memory Types

xMem supports several memory types to cover all your LLM and agent use cases:

  • User Memory: Long-term memory scoped to a user, persists across sessions.
  • Session Memory: Short-term memory for a user session, ideal for context windows.
  • Agent Memory: Long-term memory for an agent or assistant, keeps agent responses consistent.
  • Dual Memory: Store memories for both user and agent in a single operation for personalized, bidirectional context.

Example: Dual Memory

const messages = [
  { role: class="text-amber-300">'user', content: class="text-amber-300">"I'm travelling to San Francisco" },
  { role: class="text-amber-300">'assistant', content: class="text-amber-300">"That's great! I'm going to Dubai next month." },
];
orchestrator.addMemory(messages, { user_id: class="text-amber-300">'user1', agent_id: class="text-amber-300">'agent1' });

Tip: You can retrieve memories by user, agent, or both, and filter by session, metadata, or categories.