Auto-extracted knowledge graph with entity relationships and graph-powered retrieval.
Graph Memory
CortexDB automatically builds a knowledge graph from ingested episodes. Entities and relationships are extracted asynchronously, enabling retrieval that surfaces connected context that keyword and semantic search alone would miss.
How It Works
- Episodes are ingested via
rememberoringest_episode - Entities and relationships are extracted asynchronously
- The knowledge graph is updated with new connections
- During
recall, related episodes are surfaced through entity connections
Query the Graph
# Get entity with all relationships
entity = client.entity(
entity_id="ent_001",
tenant_id="my-app",
)
print(f"{entity.name} ({entity.entity_type})")
print(f"First seen: {entity.first_seen}")
print(f"Episode count: {entity.episode_count}")
for rel in entity.relationships:
print(f" --{rel.relationship}--> {rel.target_entity_id}")
Graph-Powered Recall
Graph traversal is automatically included when you use recall. When a query mentions entities that exist in the graph, CortexDB expands to neighboring entities and their associated episodes.
This is how CortexDB answers questions like "What does Alice work on?" even if Alice's name does not appear in the same episodes as her projects -- the graph connects them.
Manual Links
You can also create explicit relationships using the link method:
result = client.link(
source_entity_id="ent_payments",
target_entity_id="ent_cockroachdb",
relationship="uses",
fact="Migration completed March 2026",
tenant_id="my-app",
)
See Knowledge Graph for more on how connected context works in CortexDB.