Graph Memory
Standard entity memory stores flat records — a list of names, types, and attributes. Graph memory upgrades this to a full knowledge graph where entities are connected by typed, directed relationships with temporal metadata. This lets agents answer questions like “Who on the frontend team works with Raj?” or “What projects depended on the billing API before it was deprecated?” — queries that require traversing relationships, not just keyword search.Quick Start
graph enabled, the agent automatically:
- Extracts entities and relationships from conversations
- Exposes graph tools (
query_graph,traverse_entity,add_relationship) to the agent - Injects relevant subgraph context into the system prompt before each run
Neo4j Backend
For production, use Neo4j as the graph store:Auto-Extraction from Conversations
When graph memory is enabled, the background extraction step (after each run) identifies entities and their relationships from the conversation:Graph Traversal and Search
The agent can query the graph through auto-exposed tools or you can query it programmatically:Agent Tools (Automatic)
When graph memory is enabled, three tools are automatically added:Programmatic Access
Temporal Awareness
Every node and edge in the graph carries temporal metadata:MEMBER_OF → Frontend Team edge is marked with invalidatedAt and a new MEMBER_OF → Platform Team edge is created. The old data is never deleted — see Temporal Awareness for details.
By default, buildContext() only injects currently-valid nodes and edges. To include historical data:
Configuration
| Property | Type | Default | Description |
|---|---|---|---|
store | GraphStore | required | Backend store (InMemoryGraphStore, Neo4jGraphStore) |
maxContextNodes | number | 15 | Max nodes injected into system prompt context |
maxDepth | number | 2 | Max traversal depth for context assembly |
edgeTypes | string[] | all | Filter which relationship types to include in context |
includeInvalidated | boolean | false | Include temporally invalidated nodes/edges in context |
extractRelationships | boolean | true | Auto-extract relationships from conversations |
minConfidence | number | 0.3 | Minimum edge confidence to include in context |
namespace | string | "global" | "global" | "user" | custom namespace for graph isolation |
Graph Store Implementations
| Store | Persistence | Best For |
|---|---|---|
InMemoryGraphStore | None (session only) | Development, testing |
Neo4jGraphStore | Durable | Production, large graphs, complex traversals |
GraphStore interface:
Cross-References
- Temporal Awareness — How facts change over time
- Composite Scoring — How graph nodes are ranked for context
- Memory Overview — Unified memory system
- Memory Stores — Entity memory (flat) and other store types