CrewAI memory backend backed by MuBit memory engine
Project description
mubit-crewai
CrewAI memory backend backed by MuBit.
This adapter provides a class that satisfies CrewAI's crewai.memory.storage.backend.StorageBackend protocol (verified against crewai>=1.14.6,<2), routing all memory operations through MuBit's control plane. Also includes an extended MubitCrewMemory class with MAS coordination helpers and the outcome-attribution loop.
Install
pip install mubit-crewai[crewai]
Basic usage
Drop-in StorageBackend
from mubit_crewai import MubitStorage
from crewai import Crew
from crewai.memory import Memory
storage = MubitStorage(api_key="mbt_...", session_id="crew-run-1")
crew = Crew(
agents=[...],
memory=Memory(storage=storage),
)
Extended MuBit features
from mubit_crewai import MubitCrewMemory, extract_entry_ids
memory = MubitCrewMemory(api_key="mbt_...", session_id="crew-run-1")
crew = Crew(agents=[...], memory=memory.as_crew_memory())
# Extended:
context = memory.get_context("What do we know about the customer?")
memory.checkpoint("Finished research phase")
memory.handoff("researcher", "writer", "Here are the findings...")
Outcome-attribution loop (v0.7.0)
Close the recall -> act -> credit loop so the entries that helped get
reinforced, and process rewards land per step:
result = memory.recall("How did we resolve the last billing dispute?")
entry_ids = extract_entry_ids(result) # reference_ids of recalled evidence
# ... the crew acts on the recalled context ...
memory.record_outcome(
"task-123", "success",
entry_ids=entry_ids, # credit the entries that helped
verified_in_production=True, # boost lessons confirmed in live use
)
memory.record_step_outcome("plan", outcome="success") # per-step process reward
StorageBackend interface
Implements the full StorageBackend protocol — save, search, delete,
update, get_record, list_records, get_scope_info, list_scopes,
list_categories, count, reset, plus async asave/asearch/adelete.
| Method | MuBit mapping |
|---|---|
save(records) |
control.ingest (intent from categories, idempotency keyed by record id) |
search(query_embedding, ...) |
control.query, returns (MemoryRecord, score) tuples |
delete(...) / reset() |
local-index delete / control.delete_run |
A legacy save(value, metadata, agent_id) / search(query, limit, score_threshold)
shim is retained for older callers.
Intent inference
The memory_type metadata key maps to MuBit intents:
memory_type |
MuBit intent |
|---|---|
short_term |
trace |
long_term |
lesson |
entity |
fact |
MuBit extension methods
remember()/recall()— direct write/read (idempotent writes, citations on recall)get_context()— assembled context retrievalcheckpoint()— save memory state snapshotrecord_outcome()— outcome feedback for tasks (withentry_ids+verified_in_production)record_step_outcome()— per-step process rewardlearned()— persist a confirmed lessonsurface_strategies()— strategy clusters from lessonsregister_agent()— MAS agent registrationhandoff()— agent-to-agent handoffdiagnose()— failure-path lesson surfacing
Module helpers extract_entry_ids(result) and extract_citations(result) are
re-exported for closing the attribution loop on a recall() result.
Config
| Parameter | Default | Purpose |
|---|---|---|
endpoint |
http://127.0.0.1:3000 |
MuBit HTTP endpoint |
api_key |
"" |
MuBit API key |
session_id |
"default" |
Session/run scope |
agent_id |
"crewai" |
Default agent ID |
For tests, inject mubit_client directly.
Development
PYTHONPATH=sdk/python/mubit-sdk/src:integrations/python \
python3 -m unittest integrations.python.mubit_crewai.tests.test_storage -v
License
Apache-2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mubit_crewai-0.6.0.tar.gz.
File metadata
- Download URL: mubit_crewai-0.6.0.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c48bb1dd718646253dd9b58a81d85d29cf1b755e13bb6b6166230cb8ddabf8c
|
|
| MD5 |
3e292f885e9dcb1162b8d6b16a66f416
|
|
| BLAKE2b-256 |
e818a472c193974caa75cf2b23ad6364316df811c3d1c06e26822e66fe3f2419
|
File details
Details for the file mubit_crewai-0.6.0-py3-none-any.whl.
File metadata
- Download URL: mubit_crewai-0.6.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d36039fad056751362ddf3fd28b926773e93dc7eee02f250e3f90a67878dc7e
|
|
| MD5 |
d64bde867e2b16adb49c09afdd299f5e
|
|
| BLAKE2b-256 |
44808008b09e98410733383ee1a59db8772a6cd824c8842d1f1b1f1ba8be37e2
|