Docs K  Search
Docs/Memory/Knowledge graph
Knowledge Graph

Knowledge Graph

Build interconnected knowledge with entities and relationships. The knowledge graph supports complex queries, reasoning, and discovery of hidden connections.

writespreferspowersapplies toAlexPythondark modeAtlas
Memory is a graph. Entities are extracted automatically and linked by relationship, so the agent reasons over how facts connect, not just what they say.

01. 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.

02. 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

03. Endpoints

04. 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 it

Create 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": {...}}

05. cURL Example

POST/v1/knowledge-graph/query
curl -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
}'

06. Common Entity Types

  • person
  • organization
  • location
  • concept
  • product
  • event
  • technology
  • custom
Ask the docs
reading · this page

Hi! I'm the Hebbrix docs assistant. Ask me anything about this page: setup, code examples, endpoints, pricing, or integrations.