Skip to main content

Memory Stores

Each memory subsystem is a separate store class that handles a specific type of information.

Summaries

Long-term conversation memory. When session history overflows, the overflow messages are summarized by an LLM and stored.
memory: {
  storage,
  summaries: {
    maxCount: 10,     // max summaries per session (default: 10)
    maxTokens: 2000,  // token budget for context injection (default: 2000)
  },
}

User Facts

Extracts and stores discrete facts about users: preferences, background, interests.
memory: {
  storage,
  userFacts: {
    maxFacts: 100,    // max facts per user (default: 100)
  },
}
Example extracted facts:
  • “Prefers dark mode”
  • “Lives in Mumbai”
  • “Works on logistics software”
The memory system automatically extracts facts from conversations:
// Conversation:
// User: "I'm based in Mumbai and usually work late, so schedule meetings after 6 PM IST."

// Extracted facts:
// - "Based in Mumbai"
// - "Prefers meetings after 6 PM IST"
// - "Works late hours"

// The agent sees in its next run:
// "User Facts:
//  - Based in Mumbai
//  - Prefers meetings after 6 PM IST
//  - Works late hours"
User facts are deduplicated automatically — if the user says “I’m in Mumbai” twice, only one fact is stored.

User Profile

Structured user data — name, role, company, timezone, language, custom fields.
memory: {
  storage,
  userProfile: {
    customFields: ["department", "subscription_tier"],
  },
}
Injected as structured context:
About this user:
- Name: Akash Sengar
- Role: Product Manager
- Company: Xhipment
- Timezone: Asia/Kolkata

Entity Memory

Tracks companies, people, projects, and products mentioned in conversations.
memory: {
  storage,
  entities: {
    namespace: "global",  // "global" | "user" | custom string
  },
}
Provides tools: search_entities, create_entity. Entities are automatically extracted from conversations:
// Conversation:
// User: "We need to update the Xhipment dashboard. Talk to Raj from the frontend team."

// Extracted entities:
// - Xhipment (type: "product", attributes: { category: "dashboard" })
// - Raj (type: "person", attributes: { team: "frontend" })

// Agent can search entities using the auto-exposed tool:
// search_entities({ query: "frontend" })
// → [{ name: "Raj", type: "person", attributes: { team: "frontend" } }]

Decision Log

Audit trail of agent decisions — what was decided, why, and what happened.
memory: {
  storage,
  decisions: {
    maxContextDecisions: 5,  // recent decisions in context (default: 5)
  },
}
Provides tools: log_decision, record_outcome, search_decisions. Decisions are logged with context for audit trails:
// The agent automatically logs decisions using the log_decision tool:
// log_decision({
//   decision: "Approved refund of $45.99 for order #12345",
//   reasoning: "Order was delayed by 7 days, exceeding the 5-day SLA",
//   context: "Customer reported non-delivery on Dec 22",
// })

// Later, search past decisions:
// search_decisions({ query: "refund policy" })
// → [{ decision: "Approved refund of $45.99...", reasoning: "..." }]

// Record outcomes to track decision quality:
// record_outcome({
//   decisionId: "dec-abc123",
//   outcome: "success",
//   notes: "Customer confirmed receipt of refund",
// })

Learned Knowledge

Vector-backed insights from conversations. Requires a VectorStore.
import { QdrantVectorStore, OpenAIEmbedding } from "@radaros/core";

memory: {
  storage,
  learnings: {
    vectorStore: new QdrantVectorStore({
      url: "http://localhost:6333",
      embedding: new OpenAIEmbedding(),
    }),
    collection: "radaros_learnings",  // default
    topK: 3,                          // results injected into context
  },
}
Both auto-injects relevant learnings into context AND exposes save_learning / search_learnings tools.

How Learnings Work

// Setup with vector store
const agent = new Agent({
  name: "support-agent",
  model: openai("gpt-4o"),
  memory: {
    storage,
    learnings: {
      vectorStore: new QdrantVectorStore({
        url: "http://localhost:6333",
        embedding: new OpenAIEmbedding(),
      }),
      topK: 3, // Inject top 3 most relevant learnings
    },
  },
});

// During a conversation, the agent discovers a useful pattern:
// Agent uses save_learning tool:
// save_learning({
//   content: "For delayed international shipments, check customs hold status
//             before issuing refunds. 80% of 'lost' packages are stuck in customs.",
//   tags: ["shipping", "customs", "refund"],
// })

// In a FUTURE conversation about a different delayed shipment:
// The vector store finds this learning is relevant
// and injects it into the system prompt:
// "Relevant Learnings:
//  - For delayed international shipments, check customs hold status
//    before issuing refunds. 80% of 'lost' packages are stuck in customs."
The agent now proactively checks customs status before approving refunds — even though it learned this from a completely different conversation.

Graph Memory

Knowledge graph with entity-relationship tracking. Unlike flat entity memory, graph memory builds a traversable graph of nodes and edges with temporal metadata.
import { InMemoryGraphStore } from "@radaros/core";

memory: {
  storage,
  graph: {
    store: new InMemoryGraphStore(),
    autoExtract: true,     // extract entities + relationships from conversations
    maxContextNodes: 10,   // max nodes in context string
  },
}
See Graph Memory for full documentation.

Procedure Memory

Records and reuses successful multi-step tool-call workflows.
memory: {
  storage,
  procedures: true,     // or { maxProcedures: 100 }
}
See Procedural Memory for full documentation.

Temporal Awareness

All fact-based stores (User Facts, Entity Memory) now support temporal fields:
  • validFrom — when the fact became valid
  • invalidatedAt — when a newer fact superseded it
The LLM extraction prompts detect contradictions and mark old facts as superseded rather than keeping duplicates. See Temporal Awareness for full documentation.

All Auto-Exposed Tools

When memory stores are enabled, these tools become available to the agent:
StoreToolsDescription
Entity Memorysearch_entities, create_entitySearch and create entity records
Decision Loglog_decision, record_outcome, search_decisionsLog decisions and track outcomes
Learningssave_learning, search_learningsSave and retrieve vector-backed insights
Graph Memoryquery_graph, traverse_entity, add_relationshipQuery and traverse the knowledge graph
Proceduresrecall_procedureFind matching multi-step workflows
These tools are automatically added to the agent’s tool set — no manual registration needed.