Skip to main content

cerebrio-py

Official Python SDK for Cerebrio — agentic AI knowledge infrastructure.

PyPI version Python versions License

Install

pip install cerebrio-py
# or with uv:
uv add cerebrio-py

Requires Python 3.12+.

Quickstart

from cerebrio import CerebrioClient
from cerebrio.contracts.dtos.common import EntityScope
from cerebrio.contracts.enums.common import EpistemicScope
from uuid import uuid4

# Authenticate with either a JWT or an API key (cb_<actor_short>_<secret>)
client = CerebrioClient(
    base_url="https://api.thecerebrio.ai",
    bearer_token="cb_xxxxxxxx_xxxxxxxxxxxxxxxx",
)

# Health probe (the only unauthenticated route)
print(client.health())  # {'status': 'healthy', 'checks': {'database': 'ok'}}

# Who am I?
me = client.actors.me()
print(me.actor_id, me.default_workspace_id, len(me.workspaces), "workspaces")

# Remember something
scope = EntityScope(scope=EpistemicScope.PRIVATE, actor_id=me.actor_id)
response = client.memory.remember(
    text="Marie Curie discovered radium in 1898.",
    scope=scope,
)
print(response.results[0].outcome)  # WriteOutcome.CREATED

# Recall semantically
from cerebrio.contracts.dtos.recall_request import SemanticRecallRequest
result = client.memory.recall(
    SemanticRecallRequest(scope=scope, query="who discovered radium?", limit=5)
)
for hit in result.entities:
    print(hit.id, hit.description)

Namespaces

The client exposes one sub-namespace per capability tree, mirroring https://api.thecerebrio.ai/core/docs:

Namespace Surface
client.memory remember, recall, upload, forget, maintain, promote
client.decisions trace, precedents
client.actors me, list, create, get, patch, audit, credentials, permissions, suspend, restore, deprovision, .api_keys (issue/list/revoke), .invitations (list/accept/decline)
client.governance .policies, .role_assignments, .relationships, list_authorized
client.orgs CRUD + .members (list/add/update_role/remove)
client.workspaces CRUD + .members
client.projects CRUD + .members
client.health() Liveness probe (unauthenticated)

Authentication

Every route except /health requires Authorization: Bearer <token>. Token can be:

  • a JWT issued by your IdP (Logto / Auth0 / etc. depending on your Cerebrio deployment)
  • a cerebrio API key in the format cb_<actor_short>_<secret> (issued via client.actors.api_keys.issue(...))
# Construct with a token:
client = CerebrioClient(base_url=..., bearer_token="<jwt-or-cb-key>")
# or use the api_key alias:
client = CerebrioClient(base_url=..., api_key="cb_xxx_yyy")

# Rotate at runtime:
client.set_bearer_token("<new-jwt>")

Compatibility

See COMPATIBILITY.md for the SDK ↔ server version matrix.

SDK Server (cerebrio-core) Status
0.1.0 v2.9.x (Phase 34 actor identity + Phase 35 space hierarchy) First release

What's coming in 0.2.0

Gated on cerebrio-core shipping v2.10.0 (Phase 36 — console launch surface):

  • client.memory.list_entities() / get_entity() / get_relationships()
  • client.decisions.list_traces() / get_trace()
  • client.actors.api_keys.revoke_admin() (admin-side key revoke)

Security disclosure

During the SDK sync audit we surfaced four authorization gaps in the server (not in this SDK):

Bug Severity Surface
BUG-067 P0 /governance/v1/* — token holders can rewrite RBAC/ReBAC
BUG-068 P0 /actors/v1/* (non-/me) — token holders can create/PATCH/suspend any actor
BUG-069 P0 /decisions/v1/trace — actor_id taken from body, audit-trail forgery
BUG-070 P1 /decisions/v1/precedents — cross-tenant precedent leak

These are server-side and tracked in cerebrio-sapience backlog. The SDK itself does not amplify them. Once the server fixes ship, SDK callers will receive 403 where appropriate — no SDK code change required.

Development

git clone https://github.com/avinash-singh-io/cerebrio-py.git
cd cerebrio-py
uv venv && uv pip install -e ".[dev]"
uv run pytest                       # 54 unit tests
uv run mypy --strict src/cerebrio   # type check
uv run ruff check src tests         # lint

Contributing

Bug reports and PRs welcome via GitHub Issues.

License

Apache-2.0.

Metadata

Release files for cerebrio-py 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cerebrio-py 0.2.0
File Size Uploaded Provenance Actions
cerebrio_py-0.2.0.tar.gz 56.8 kB With provenance Details for cerebrio_py-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cerebrio-py 0.2.0
File Interpreter ABI Platform Actions
cerebrio_py-0.2.0-py3-none-any.whl Python 3 none any Details for cerebrio_py-0.2.0-py3-none-any.whl

Total release size: 131.2 kB

Release files / cerebrio_py-0.2.0.tar.gz

Download URL cerebrio_py-0.2.0.tar.gz
Size 56.8 kB
Tags Source
SHA-256 checksum
How to use checksums
78380ccb330341e4d568de18fe1b957b10c24ae4f777de72f931c279bbdd66c9
BLAKE2b-256 checksum
How to use checksums
351f6ec7ceb5614b01758baf1f53a3deab97c43aac650abdd1af3c0a4f4a5c93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.

Transparency log

Release files / cerebrio_py-0.2.0-py3-none-any.whl

Download URL cerebrio_py-0.2.0-py3-none-any.whl
Size 74.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b6ed7fb8073c9f71ad70289afe412e8f4dac4945d07116bb037858b063a9a63
BLAKE2b-256 checksum
How to use checksums
e21bde6652ff27b7f1312e0588f0fde682d94dffd3123c340109b67b44e8d10c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.

Transparency log

Security for cerebrio-py 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cerebrio_py-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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