Framework integrations
Agno Integration
Use MuBit as a persistent memory backend and toolkit for Agno agents. MemoryDb plus an LLM-callable Toolkit.
The mubit-agno adapter exposes two integration surfaces:
MemoryDb— Agno's built-in memory persistence layer.Toolkit— LLM-callable tools (mubit_remember,mubit_recall,mubit_reflect,mubit_checkpoint,mubit_diagnose).
Use MemoryDb to give Agno's existing memory system durable storage; use the Toolkit when you want the LLM itself to drive memory operations.
pip install mubit-agno[agno]Minimal usage
agno_minimal.py
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.memory.v2.memory import Memory
from mubit_agno import MubitAgnoMemory
mubit = MubitAgnoMemory(api_key="mbt_...", session_id="run-1")
agent = Agent(
name="Assistant",
model=OpenAIChat(id="gpt-4o"),
memory=Memory(db=mubit.as_memory_db()),
tools=[mubit.as_toolkit()],
enable_agentic_memory=True,
)
result = agent.run("What do we know about the production database?")
# Extended MuBit features
mubit.checkpoint("Research done", "Completed infra review")
mubit.record_outcome("infra-recall", "success", rationale="Correct recall")
mubit.reflect()
mubit.archive("SELECT * FROM users WHERE active", "sql_query", labels=["infra"])
ref = mubit.dereference("ref_abc123")Full example: Basic agent with persistent memory
An Agno agent backed by MuBit. Memories persist across sessions, enabling cross-conversation learning.
basic.py
import os
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.memory.v2.memory import Memory
from mubit_agno import MubitAgnoMemory
endpoint = os.environ.get("MUBIT_ENDPOINT", "https://api.mubit.ai")
api_key = os.environ["MUBIT_API_KEY"]
mubit = MubitAgnoMemory(
endpoint=endpoint, api_key=api_key,
session_id="basic-example", user_id="demo-user",
)
agent = Agent(
name="Assistant",
model=OpenAIChat(id="gpt-4o"),
memory=Memory(db=mubit.as_memory_db()),
tools=[mubit.as_toolkit()],
enable_agentic_memory=True,
instructions=[
"You have access to MuBit memory tools.",
"Use mubit_remember to store important information.",
"Use mubit_recall to search for relevant memories.",
],
)
# Run 1: store knowledge
agent.run(
"Remember that our production database is PostgreSQL 16 "
"running on AWS RDS in us-east-1, and we use Redis for caching.",
session_id="session-1",
)
mubit.checkpoint("Initial learning", "Stored infrastructure facts")
# Run 2: recall knowledge (cross-session)
agent.run("What database do we use in production?", session_id="session-2")
mubit.record_outcome(
"infrastructure-recall", "success",
rationale="Agent correctly recalled database details from memory",
)Full example: Multi-agent coordination
Two Agno agents — a researcher and a reviewer — share a MuBit run. The researcher hands off findings; the reviewer evaluates, surfaces strategies, and records the outcome.
multi_agent.py
import os
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.memory.v2.memory import Memory
from mubit_agno import MubitAgnoMemory
endpoint = os.environ.get("MUBIT_ENDPOINT", "https://api.mubit.ai")
api_key = os.environ["MUBIT_API_KEY"]
SESSION = "agno-coord-1"
researcher_mem = MubitAgnoMemory(
endpoint=endpoint, api_key=api_key, session_id=SESSION, agent_id="researcher",
)
reviewer_mem = MubitAgnoMemory(
endpoint=endpoint, api_key=api_key, session_id=SESSION, agent_id="reviewer",
)
# Register both agents so handoffs and scopes are explicit
for mem, agent_id, role, scopes in [
(researcher_mem, "researcher", "solution-researcher", ["fact", "lesson"]),
(reviewer_mem, "reviewer", "quality-reviewer", ["fact", "lesson", "rule"]),
]:
mem.register_agent(agent_id, role=role, read_scopes=scopes, write_scopes=scopes)
researcher = Agent(
name="Researcher",
model=OpenAIChat(id="gpt-4o-mini"),
memory=Memory(db=researcher_mem.as_memory_db()),
tools=[researcher_mem.as_toolkit()],
enable_agentic_memory=True,
)
reviewer = Agent(
name="Reviewer",
model=OpenAIChat(id="gpt-4o-mini"),
memory=Memory(db=reviewer_mem.as_memory_db()),
tools=[reviewer_mem.as_toolkit()],
enable_agentic_memory=True,
)
# Researcher produces findings and hands off to reviewer
findings = researcher.run(
"Investigate why tenant billing discrepancies spiked this week. "
"Store the top 3 causes as facts."
)
researcher_mem.handoff(
from_agent_id="researcher", to_agent_id="reviewer",
content=str(findings.content)[:1000],
requested_action="review",
)
# Reviewer consumes the handoff, evaluates, feeds back, surfaces strategies
review = reviewer.run(
"Review the researcher's billing findings. Call out anything weak and "
"use mubit_strategies to see what has worked before."
)
reviewer_mem.feedback(
handoff_id=findings.run_id,
verdict="approve",
comments=str(review.content)[:1000],
from_agent_id="reviewer",
)
# Close the loop: reflect and record outcome
reviewer_mem.reflect()
reviewer_mem.record_outcome(
reference_id="billing-discrepancy-review",
outcome="success",
rationale="Reviewer confirmed findings matched stored rules.",
)
strategies = reviewer_mem.surface_strategies(lesson_types=["success"], max_strategies=3)
print(f"Reusable strategies: {len(strategies.get('strategies', []))}")Extended MuBit features
MubitAgnoMemory exposes the full MAS surface as instance methods:
mubit.register_agent("agent-id", role="...", read_scopes=[...], write_scopes=[...])
mubit.handoff(from_agent_id="...", to_agent_id="...", content="...", requested_action="review")
mubit.feedback(handoff_id="...", verdict="approve", from_agent_id="...")
mubit.checkpoint(snapshot="...", label="...")
mubit.record_outcome(reference_id="...", outcome="success", rationale="...")
mubit.reflect()
mubit.surface_strategies(lesson_types=["success"], max_strategies=3)
mubit.diagnose(query="...")
mubit.archive(content="...", artifact_kind="...", labels=[...])
mubit.dereference(reference_id="...")
mubit.memory_health()Gotchas
- The Toolkit and the MemoryDb are independent. Pass both to
Agent(...)if you want both Agno's automatic memory and the LLM-callable tools. enable_agentic_memory=Trueenables Agno's read-write memory loop. Without it the LLM can't call the tools.session_idis the MuBit scope. Reuse it acrossagent.run()calls to share memory.
Version compatibility
mubit-agno | mubit-sdk | agno |
|---|---|---|
0.5.x | >= 0.6.0 | >= 1.0.0 |