Agentic Layers · Memory SDK

The execution memory primitive.

Write a lesson when a run finishes. Retrieve the relevant ones before the next call. The primitive underneath self-learning agents, self-improving environments, and adaptive tool routers.

      
import mubit
mubit.init(agent_id="my-agent") # reads MUBIT_API_KEY from env
context = mubit.recall(query="user wants JSON") # before each call
mubit.remember(content="tool X failed on type Y", intent="lesson") # after each run
In practice / 01

What you build with it.

01 · SELF-LEARNING AGENTS

Agents that get sharper with every run.

Every run writes back what worked, what didn't, and the context that shaped it. The next run retrieves the relevant lessons before calling the model. No retraining, no prompt rewrites.

02 · SELF-IMPROVING ENVIRONMENTS

Interfaces that adapt to how they're used.

An IDE, a CRM, a support console — when actions inside it write lessons back to memory, the environment learns what users actually want. The next session opens with the right defaults, the right shortcuts, the right surfaced fields.

(°□°) (╯°□°)╯ ┳━┳ ┻━┻
"it works on my machine"

03 · TRACEABLE DECISIONS

Every decision shows what shaped it.

Every call records the lessons it retrieved, the input, and the output in one record. Open any past run and see exactly which lessons drove the result.

A primitive, not a product.

Two functions — write and retrieve — over a managed memory store. Intelligence, Actions, and Gateway are all composed on top of it. You can compose it too.

Install. Point at your agent. Done.

Two calls: retrieve relevant lessons before the model runs, write what the run learned after. No vector database — embeddings, storage, and ranking are managed.

memory.py
import os

import mubit

# Persistent memory for an agent.
mubit.init(
  api_key=os.environ["MUBIT_API_KEY"],
  agent_id="my-agent",
)

# Read relevant lessons
context = mubit.recall(
  query="user wants a JSON response",
  limit=5,
  entry_types=["lesson", "rule"],
)

# Write what was learned from this run.
mubit.remember(
  content="Tool X failed for type Y; route to Z.",
  intent="lesson",
  lesson_type="failure",
)
FAQ
Why call this a primitive?

Because it does one thing — give your agent execution memory — and nothing else. You compose it into whatever you're building, instead of buying a finished product around it.

What does Mubit build on top of it?

Intelligence turns captured lessons into observability. Actions proposes prompt and skill updates from them. Gateway uses the same memory store on the inference path. Same primitive underneath.

What does the SDK actually store?

Short, retrievable summaries of what happened in a run — the input that triggered the agent, the decision it made, the outcome, and any tags you attach. Mubit handles embedding and ranking; you just write the lesson.

Do I need a vector database?

No. Memory ships with managed embeddings + ANN retrieval. Point the SDK at your agent ID and you're done — no separate index to provision, scale, or backup.

How is retrieval ranked?

A blend of semantic similarity to the current context, recency, and tag match. You can override the ranker per-call if you need custom weighting — e.g. boost failures, demote stale lessons.

Will it slow my agent down?

Writes are non-blocking — they queue to a background worker. Reads stay off your agent's critical path too, so memory never blocks the loop it's running in.

Where is memory stored — my infra or yours?

Either. Use Mubit Cloud for the fastest setup, or self-host the memory plane in your own region. Same SDK, same APIs, same wire format — switch any time.

How do I scope memory per-user or per-tenant?

Lessons carry arbitrary metadata. Pass user_id, tenant_id, env, or anything else to write(), then filter on the same keys in retrieve() — Mubit constrains the result set automatically.