Docs K  Search
Docs/Build/SDKs
SDKs

SDKs & Libraries

Official client libraries for Python and TypeScript with type safety, auto-retries, and async support.

Python SDK

Python SDK, Python 3.8+. GitHub · PyPI

Install
pip install hebbrix

Features

  • Type Safety: Full TypeScript types and Python type hints
  • Auto Retries: Exponential backoff for transient errors
  • Async Support: Native async/await for non-blocking ops

Quick Start

Python
import asyncio
from hebbrix import MemoryClient

async def main():
    # The Python SDK is async-first. Pair it with `async with` so the
    # underlying HTTP client is closed cleanly.
    async with MemoryClient(api_key="mem_sk_...") as client:
        # Create a collection
        collection = await client.collections.create(name="My Agent")

        # Store a memory
        memory = await client.memories.create(
            collection_id=collection["id"],
            content="User prefers dark mode",
            importance=0.7,
        )

        # 6-layer hybrid search
        results = await client.search(
            query="user preferences",
            collection_id=collection["id"],
            limit=5,
        )

asyncio.run(main())

Installation Options

All Package Managers
# Using pip
pip install hebbrix

# Using poetry
poetry add hebbrix

# Using pipenv
pipenv install hebbrix

Async Usage

Python
import asyncio
from hebbrix import MemoryClient

async def main():
    async with MemoryClient(api_key="mem_sk_...") as client:
        # Parallel requests: the client shares a single HTTP session
        # so concurrent calls reuse the connection pool.
        memory, results = await asyncio.gather(
            client.memories.get("mem_abc"),
            client.search(query="preferences", limit=10),
        )

asyncio.run(main())

Error Handling

Python
import asyncio
from hebbrix import MemoryClient
from hebbrix import (
    HebbrixError, AuthenticationError,
    RateLimitError, ValidationError,
)

async def main():
    async with MemoryClient(api_key="mem_sk_...") as client:
        try:
            memory = await client.memories.create(
                collection_id="col_xyz",
                content="Test",
            )
        except AuthenticationError:
            print("Invalid API key")
        except RateLimitError as e:
            print(f"Rate limited; backend told us to slow down: {e}")
        except ValidationError as e:
            print(f"Request validation failed: {e}")
        except HebbrixError as e:
            print(f"Error: {e}")

asyncio.run(main())

Configuration

Python
from hebbrix import MemoryClient

# Constructor signature
client = MemoryClient(
    api_key="mem_sk_...",
    base_url="https://api.hebbrix.com",  # default
    timeout=120.0,                        # seconds
)

OpenAI Compatibility

Use Hebbrix as a drop-in replacement for OpenAI SDK:

Python (OpenAI SDK)
from openai import OpenAI

# Drop-in replacement for OpenAI
client = OpenAI(
    api_key="mem_sk_your_hebbrix_key",
    base_url="https://api.hebbrix.com/v1"
)

response = client.chat.completions.create(
    model="gpt-5-nano",
    messages=[{"role": "user", "content": "Hello!"}]
)
# Automatic memory injection!

Available Methods

FieldTypeDescription
client.auth-register, login, create_api_key, get_me
client.collections-create, list, get, update, delete
client.memories-create, list, list_page (cursor page + metadata), iter_all (async-iterate all pages), get, update, delete
client.search(...)-6-layer hybrid search (top-level method)
client.reason(...)-LLM-backed reasoning (top-level method)
client.search_resource-search, similar, reason (lower-level)
client.rl-train_memory_manager, train_answer_agent, get_metrics, evaluate
client.temporal-temporal-knowledge-graph access
client.procedural-procedural (skills) memory
client.working_memory-short-term context buffer
client.consolidation-memory consolidation jobs
client.world_model-world-model access
MemoryChat(api_key=...).send(...)-one-line chat integration (separate helper class)
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.