Skip to main content

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 retrieval
  • checkpoint() — save memory state snapshot
  • record_outcome() — outcome feedback for tasks (with entry_ids + verified_in_production)
  • record_step_outcome() — per-step process reward
  • learned() — persist a confirmed lesson
  • surface_strategies() — strategy clusters from lessons
  • register_agent() — MAS agent registration
  • handoff() — agent-to-agent handoff
  • diagnose() — 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

mubit_crewai-0.6.0.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mubit_crewai-0.6.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

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

Hashes for mubit_crewai-0.6.0.tar.gz
Algorithm Hash digest
SHA256 2c48bb1dd718646253dd9b58a81d85d29cf1b755e13bb6b6166230cb8ddabf8c
MD5 3e292f885e9dcb1162b8d6b16a66f416
BLAKE2b-256 e818a472c193974caa75cf2b23ad6364316df811c3d1c06e26822e66fe3f2419

See more details on using hashes here.

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

Hashes for mubit_crewai-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d36039fad056751362ddf3fd28b926773e93dc7eee02f250e3f90a67878dc7e
MD5 d64bde867e2b16adb49c09afdd299f5e
BLAKE2b-256 44808008b09e98410733383ee1a59db8772a6cd824c8842d1f1b1f1ba8be37e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page