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

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.

The core loop, end to end

Everything in Mubit hangs off one loop: store → recall → act → record the real outcome → recall better next time. Here it is in five calls:

core_loop.py
import mubit
 
client = mubit.Client(endpoint="https://api.mubit.ai")
client.set_api_key("mbt_...")
client.set_run_id("onboarding-demo")
 
# 1. Store a lesson (any experience works — traces, facts, observations)
client.learned("Always check the customer's plan tier before quoting limits.")
 
# 2. Recall before acting — evidence comes back with ids
result = client.recall(query="What should I check before quoting a limit?")
evidence_ids = [e["id"] for e in result.get("evidence", [])]
 
# 3. Act on it (your agent does its thing)...
 
# 4. Close the loop with the REAL outcome — a test result, a gate,
#    a user confirmation — credited to the exact memories used.
client.record_outcome(
    reference_id=evidence_ids[0],
    outcome="success",
    signal=1.0,
    entry_ids=evidence_ids,
)
 
# 5. Next recall ranks what actually worked higher. That's the whole trick.

Step 4 is what separates Mubit from a vector store: outcomes attach to the specific memories that were used, so useful knowledge gains confidence and misleading knowledge decays. The full pattern — including what never to feed it — is in The outcome-attribution loop.

What to do next

mubit — python · support-agent