Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content
Overview

Quickstart

Make your first authenticated MuBit call in under 60 seconds. The terminal on the right runs the same code — a real round-trip against api.mubit.ai showing every payload the SDK returns. Switch the terminal between Python, Node, and Rust with the buttons in the title bar.

Get your API key

Sign in to the MuBit console and create a key from Settings → API keys. Keys look like mbt_<instance>_<key_id>_<secret> — three segments separated by underscores. The instance segment routes your call to the right region; the key id is safe to log; the secret is not.

.env
MUBIT_API_KEY="mbt_<instance>_<key_id>_<secret>"
MUBIT_ENDPOINT="https://api.mubit.ai"

The SDK reads both env vars on Client(). Set MUBIT_TRANSPORT="grpc" if you need lower latency from a backend service — see gRPC Transport.

Install

pip install mubit-sdk python-dotenv

Authenticate and make your first call

The script below stores a memory in one session and recalls it from a second session — proving cross-session memory works without any local cache. The right-hand terminal runs this exact flow.

v1_support.py
import os
from dotenv import load_dotenv
import mubit
 
load_dotenv()
client = mubit.Client(endpoint=os.environ["MUBIT_ENDPOINT"])
client.set_api_key(os.environ["MUBIT_API_KEY"])
 
client.remember(
    session_id="support:taylor:s1",
    agent_id="support-agent",
    user_id="taylor-1",
    content="Taylor prefers concise written updates on Friday afternoons; no phone calls.",
    intent="lesson",
    lesson_scope="global",
)
 
answer = client.recall(
    session_id="support:taylor:s2",
    agent_id="support-agent",
    user_id="taylor-1",
    query="how does Taylor like updates?",
    entry_types=["lesson"],
)
print(answer["final_answer"])

A successful recall returns roughly:

{
  "final_answer": "Taylor prefers to receive updates in a concise written format delivered on Friday afternoons, and explicitly dislikes receiving phone calls.",
  "confidence": 1.0,
  "mode": "agent_routed",
  "evidence": [
    { "id": "f7bfcb26-…", "score": 1.0, "content": "Taylor prefers concise written updates on Friday afternoons; no phone calls." }
  ]
}

Didn't work? See Troubleshooting. The two most common causes are a stale MUBIT_API_KEY and an HTTP/gRPC endpoint mismatch.

ℹ️Note

Cross-session footgun: facts (intent="fact") are session-local. To recall a memory in a different session keyed by user_id, store it as a lesson with lesson_scope="global" — that's why the example above uses intent="lesson". See SDK helpers for the full set.

Pick your path

Most readers want the drop-in. Switch only when you outgrow it.

Drop-in: mubit.learn

learn_quickstart.py
import os
import mubit.learn
import anthropic
 
mubit.learn.init(
    api_key=os.environ["MUBIT_API_KEY"],
    agent_id="code-reviewer",
    auto_reflect=True,
)
 
# Existing Anthropic call now learns: lessons inject pre-call, reflection runs on session end.
resp = anthropic.Anthropic().messages.create(
    model="claude-haiku-4-5-20251001",
    max_tokens=300,
    messages=[{"role": "user", "content": "Review this diff..."}],
)

mubit.learn.init() patches anthropic.Anthropic, openai.OpenAI, LiteLLM, and Google GenAI client classes in place. See LLM provider support for the full matrix and per-provider notes.

What to do next

mubit — python · support-agent