Knowledge Graph
Knowledge Graph
Build interconnected knowledge with entities and relationships. The knowledge graph enables complex queries, reasoning, and discovery of hidden connections.
Key Concepts
Entities
Named objects like people, companies, concepts, or topics extracted from your data.
Relationships
Typed connections between entities like "works_at", "mentions", "related_to".
Traversal
Query across relationships to discover multi-hop connections and patterns.
Automatic Entity Extraction
When you add memories or documents, Hebbrix automatically:
- Extracts named entities (people, organizations, locations, concepts)
- Creates relationships between entities based on context
- Links entities to source memories for provenance tracking
- Merges duplicate entities intelligently
Endpoints
Code Examples
Explore Entities
Python
import requests
# GET /v1/knowledge-graph/entities — list entities with their inline
# relationships already attached (capped at 25 per entity).
r = requests.get(
"https://api.hebbrix.com/v1/knowledge-graph/entities",
headers={"Authorization": "Bearer <your-api-key>"},
params={"entity_type": "PERSON", "limit": 20},
)
data = r.json()
for entity in data["entities"]:
rels = entity.get("relationships", [])
print(f"{entity['name']} ({entity['type']}) — {len(rels)} relationships")
for rel in rels:
arrow = "-->" if rel["direction"] == "outgoing" else "<--"
print(f" {arrow} {rel['target']} [{rel['type']}]")Inspect a Single Entity
Python (Entity Details)
import requests
# GET /v1/knowledge-graph/entities/{entity_name}
# Entities are keyed by name (not UUID). The response bundles
# relationships AND the memory_ids that mention this entity.
r = requests.get(
"https://api.hebbrix.com/v1/knowledge-graph/entities/Acme%20Corp",
headers={"Authorization": "Bearer <your-api-key>"},
)
body = r.json()
print(body["details"]) # raw entity row from Neo4j
print(body["relationships"]) # full relationship list (no cap)
print(body["source_memories"]) # list of memory_ids that mention itCreate a Relationship
Python (Relationships)
import requests
# POST /v1/knowledge-graph/relationships — use the short field names
# (source / target / type). The legacy long names
# (source_entity / target_entity / relationship_type) are still accepted.
r = requests.post(
"https://api.hebbrix.com/v1/knowledge-graph/relationships",
headers={"Authorization": "Bearer <your-api-key>"},
json={
"source": "John Doe",
"target": "Acme Corp",
"type": "WORKS_AT",
},
)
print(r.json()) # {"status": "created", "relationship": {...}}cURL Example
POST
/v1/knowledge-graph/querycurl -X POST "https://api.hebbrix.com/v1/knowledge-graph/query" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"timestamp": "2026-03-30T00:00:00",
"relation_type": "MENTIONS",
"collection_id": "col_abc123",
"limit": 10
}'Common Entity Types
personorganizationlocationconceptproducteventtechnologycustom