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.
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
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.
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.
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.
mubit.learn.init() auto-instruments your existing anthropic / openai / litellm / google-genai calls. Lessons inject before the call, reflection runs on session end.
Call remember, recall, get_context, archive, dereference yourself when you want explicit control over sessions, agents, and metadata.
Plug Mubit into the framework's own memory interface. CrewAI, LangGraph, LangChain, LlamaIndex, ADK, Agno, Vercel AI SDK, MCP.
Drop-in: mubit.learn
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:
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
- Get the mental model in Concepts — the memory model, retrieval semantics, and the learning loop.
- Pick a pattern that matches your problem — handoffs, shared team memory, bi-temporal facts, context assembly.
- Inspect the full helper surface in SDK helpers —
remember,recall,get_context,archive,dereference. - Add multi-agent coordination with register_agent + handoff + feedback.
- Use temporal queries to filter by when events happened, not when they were ingested.
- Plug into your framework via Framework integrations.
- Browse the full control surface at Control HTTP reference.