Skip to main content

Hebbrix Python SDK

PyPI version Python versions License

Official Python SDK for the Hebbrix api - the only memory API with Reinforcement Learning.

🚀 Features

  • Core API Coverage - Typed resources for memories, search, and ProofLoop
  • Reinforcement Learning - Train AI agents to optimize memory operations
  • Temporal Knowledge Graphs - Track facts over time with bi-temporal model
  • Procedural Memory - Store and execute learned skills
  • Working Memory - Short-term context buffer for conversations
  • Memory Consolidation - Automatic compression of episodic memories
  • ProofLoop - Learn from outcomes with automatic, verifiable evidence receipts
  • Sync + Async - Equivalent core memory and ProofLoop workflows
  • Type Hints - Complete type annotations
  • Clean API - Pythonic, intuitive interface

📦 Installation

pip install hebbrix

🔥 Quick Start

import asyncio
from hebbrix import MemoryClient

async def main():
    # Initialize client
    client = MemoryClient(api_key="mem_sk_your_api_key")

    # Create a collection
    collection = await client.collections.create(
        name="My AI Agent",
        description="Personal memory for my chatbot"
    )

    # Store a memory
    memory = await client.memories.create(
        collection_id=collection["id"],
        user_id="customer-7",
        agent_id="support-agent",
        content="User prefers dark mode and loves Python",
        importance=0.9,
        wait_for_index=True,
    )

    # wait_for_index=True polls the returned memory status through the SDK.
    # It returns only when searchable=true, raises on terminal failure, and
    # raises TimeoutError if the caller's readiness deadline expires.

    # Batch contract: a successful synchronous return means every accepted item
    # is searchable. A bounded server timeout raises explicitly and is safe to
    # retry with the same idempotency key; it is never a successful 202.
    batch = await client.memories.create_batch(
        [{"content": "First fact"}, {"content": "Second fact"}],
        collection_id=collection["id"],
        wait_for_index=True,
        idempotency_key="import-42",
    )
    # For wait_for_index=False receipts:
    # batch = await client.memories.wait_batch_until_searchable(batch)

    # Search memories
    results = await client.search(
        query="What programming language does user like?",
        collection_id=collection["id"],
        limit=5
    )

    print(results)

    # Close client
    await client.close()

asyncio.run(main())

Blocking applications can use the same create/search/ProofLoop fields:

from hebbrix import SyncMemoryClient

with SyncMemoryClient(api_key="mem_sk_your_api_key") as client:
    collection = client.collections.create(name="My Agent")
    client.memories.create(
        collection_id=collection["id"],
        user_id="customer-7",
        content="User prefers concise answers",
        wait_for_index=True,
    )
    results = client.search(
        "How should answers be formatted?",
        collection_id=collection["id"],
        user_id="customer-7",
    )

ProofLoop: search → decision → outcome → proof

search = await client.search_with_proof(
    "What should the agent do next?",
    collection_id="collection-42",
    user_id="customer-7",
)
decision = await client.proofloop.decide(
    policy_key="agent.next_action",
    candidates=[{"action_key": "act"}, {"action_key": "ask"}],
    collection_id="collection-42",
    user_id="customer-7",
    proof_context=search["proof_context"],
)
await client.proofloop.record_outcome(
    decision["decision_id"], success=True, idempotency_key="run-123-result"
)
proof = await client.proofloop.proof(decision["decision_id"])

📚 Complete Documentation

Visit https://docs.hebbrix.com for full documentation.

🔗 Links

📄 License

MIT License - see LICENSE for details


Built with ❤️ by the Hebbrix team

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hebbrix-2.3.2.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hebbrix-2.3.2-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file hebbrix-2.3.2.tar.gz.

File metadata

  • Download URL: hebbrix-2.3.2.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hebbrix-2.3.2.tar.gz
Algorithm Hash digest
SHA256 38ecac741d649e0cb8c8e9f34ff6b62bc00a153422921505a56db17a8a707fc5
MD5 87337f818646edb8b83ce8e0cf6d5a45
BLAKE2b-256 83d963a20b2abb1a9dc596b198c3a330e645cf0d4f8c79c349ddfd6b83336356

See more details on using hashes here.

Provenance

The following attestation bundles were made for hebbrix-2.3.2.tar.gz:

Publisher: release.yml on Hebbrix/hebbrix-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hebbrix-2.3.2-py3-none-any.whl.

File metadata

  • Download URL: hebbrix-2.3.2-py3-none-any.whl
  • Upload date:
  • Size: 28.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hebbrix-2.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fc7e8d27065049970601784f47e6352915606507e38fa2d6bc927177ad2fc4a7
MD5 0ef933217e96409d891615ebd4be751b
BLAKE2b-256 2f73d0984ed764d9f27fc7802cf338fd2f2b5b21241e78002061a25528ea076a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hebbrix-2.3.2-py3-none-any.whl:

Publisher: release.yml on Hebbrix/hebbrix-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.4.1

2 files

2.4.0

2 files

This release

2.3.2 This release

2 files

2.3.1

2 files

2.3.0

2 files

2.2.0

2 files

2.1.1

2 files

2.1.0

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page