Skip to main content
You’ll need a Nebula API key before starting. Get one at trynebula.ai

Prerequisites

  • A Nebula account at trynebula.ai
  • An existing Nebula collection with some stored memories (see Quick Start to create one)
  • Python: Python 3.10+ with pip install nebula-client
  • JavaScript/TypeScript: Node.js 18+ with npm install @nebula-ai/sdk

Install

pip install nebula-client

Walkthrough

1

Initialize the client

from nebula import Nebula

client = Nebula(api_key="YOUR_API_KEY")
2

Export a snapshot from an existing collection

Download the full graph state of a collection. After this, your local copy is canonical.
snapshot = client.export_snapshot(collection_id="YOUR_COLLECTION_ID")
After export, the local snapshot is the canonical copy. Nebula does not retain a server-side copy.
3

Ingest new events

Send your snapshot and new events to Nebula. It processes them and returns a patch describing what changed.
patch = client.compute({
    "collection_id": "YOUR_COLLECTION_ID",
    "context": snapshot,
    "events": [
        {"content": "Had a meeting with Alice about the Q2 roadmap"},
        {"content": "Reviewed PR #42 for the auth module"},
    ],
})

# patch contains put_entities, delete_entities, put_relationships, etc.
Apply the returned patch to your local snapshot to keep it up to date.
4

Search memory

Query your memory through Nebula’s traversal engine. Your snapshot is sent, scored, and results are returned. Nothing is stored server-side.
results = client.query_snapshot(
    snapshot=snapshot,
    query="What do I know about Alice?",
    limit=10,
)

for entity in results.get("entities", []):
    print(f"{entity['name']}: {entity['description']}")

Next Steps