Skip to main content
Graph memory represents entities and relationships as nodes and edges. Enable it when connections between records matter; use entity memory for simpler per-user records.

Quick Start

This host factory explicitly supplies both key-value and graph storage. It makes no provider calls until the caller runs the Agent.
Use verified userId and tenantId values when running the Agent. The host owns backend scope and credentials. Drain Agent work before closing its storage and separately owned graph resources.

Neo4j Backend

Neo4jGraphStore is a persistent adapter; follow the graph-store setup for connection fields and optional dependencies. InMemoryGraphStore is suitable for local fixtures and loses state on close. Neither backend choice authenticates a caller.

Auto-Extraction from Conversations

With autoExtract: true, the memory layer can ask a model to extract entities and relationships. This adds provider work. It tags extracted records with user ownership; it skips extraction without a user ID. Extracted relationships are model-generated claims, so review them before using them as authoritative business data. The standalone store exposes addNode, addEdge, search, traverse, and related operations. This local example demonstrates a graph relationship without a model:
This is raw graph access. Its nodes are not tagged for graph-memory ownership and will not automatically appear in a user’s memory context. For an Agent’s graph-memory context, the implementation requires a matching _userId property and filters owned nodes/edges. Raw backend queries and unified MemoryManager.recall() are not interchangeable with that filtered path.

Temporal Awareness

Nodes and edges include validity metadata. traverse() accepts includeInvalid; set it intentionally when inspecting historical data. Applications own the meaning of a relationship change and any audit trail they require.

Configuration

The built-in memory-context traversal uses depth 2. There is no memory.graph.maxDepth field; maxDepth belongs to direct traversal options.

Graph Store Implementations

Choose InMemory or Neo4j based on persistence and query needs. Partition backend access for the application’s tenant model. Do not expose arbitrary graph queries or client-selected user identifiers as a substitute for host authorization.