Skip to main content

Google ADK BaseMemoryService adapter backed by MuBit memory engine

Project description

mubit-adk

Google ADK BaseMemoryService backed by MuBit.

This adapter now uses the canonical Python SDK transport internally instead of raw httpx, while preserving the ADK memory-service contract and adding MuBit-specific helpers for checkpointing, observability, and multi-agent coordination.

Install

pip install mubit-adk[adk]

Basic usage

from google.adk.agents import Agent
from google.adk.tools.preload_memory_tool import PreloadMemoryTool

from mubit_adk import (
    MubitMemoryService,
    make_bigquery_tool_callback,
    make_session_memory_callback,
)

memory = MubitMemoryService(
    endpoint="http://127.0.0.1:3000",
    api_key="mbt_...",
)

agent = Agent(
    name="bigquery_agent",
    description="Read-only BigQuery agent with MuBit memory.",
    model="gemini-2.0-flash",
    instruction="Use BigQuery tools and prior MuBit lessons to answer safely.",
    tools=[
        PreloadMemoryTool(),  # ADK calls memory.search_memory() before each turn.
        bigquery_toolset,     # Your ADK BigQueryToolset.
    ],
    after_agent_callback=make_session_memory_callback(memory),
    after_tool_callback=make_bigquery_tool_callback(memory),
)

For Vertex AI Agent Engine, pass the same memory service through AdkApp:

from vertexai.agent_engines import AdkApp

adk_app = AdkApp(
    agent=agent,
    memory_service_builder=lambda: memory,
    enable_tracing=True,
)

ADK to MuBit mapping

ADK concept MuBit mapping
app_name agent_id
user_id user_id
session.id isolated raw session run_id
adk:<app_name>:<user_id>:memory durable app/user lesson run_id
session/event ingest control ingest items with safe tool summaries
PreloadMemoryTool() calls search_memory() for prompt injection
search_memory() control query over the durable app/user memory run

MuBit extension methods

Existing MAS helpers:

  • checkpoint()
  • record_outcome()
  • record_step_outcome()
  • surface_strategies()

Current observability and coordination helpers:

  • get_context()
  • memory_health()
  • diagnose()
  • archive()
  • dereference()
  • register_agent()
  • list_agents()
  • handoff()
  • feedback()
  • make_session_memory_callback() for fail-open ADK session ingestion
  • make_bigquery_tool_callback() for redacted BigQuery tool lessons and step outcomes

Config

Parameter Default Purpose
endpoint http://127.0.0.1:3000 MuBit HTTP endpoint
api_key "" MuBit API key

For tests or advanced embedding, you can inject mubit_client directly.

Development

PYTHONPATH=sdk/python/mubit-sdk/src:integrations/python/mubit_adk:integrations/python/mubit_integration_base \
python3 -m unittest integrations.python.mubit_adk.tests.test_memory_service integrations.python.mubit_adk.tests.test_mubit_client -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_adk-0.5.3.tar.gz (17.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_adk-0.5.3-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file mubit_adk-0.5.3.tar.gz.

File metadata

  • Download URL: mubit_adk-0.5.3.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mubit_adk-0.5.3.tar.gz
Algorithm Hash digest
SHA256 c4a6dbfdf12b17f46db9077b9544297bc1014cfa5e88a6b73206e58b8628ac47
MD5 b8579a7f1813d403b22f651add92c81e
BLAKE2b-256 412906c0c5fbcf9c8bb9d8c1edb44c9318d1a6c5c726daab323f86b0d70b03b9

See more details on using hashes here.

File details

Details for the file mubit_adk-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: mubit_adk-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mubit_adk-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3526907ec8ee1a4059cc987ab6f369f508339b36160e93e7dd7ba5cb514cd858
MD5 495f261b6748943cef68d0691e10ba89
BLAKE2b-256 b171ebb5a6d2790efb9706f281b215f9604f83aa0fccd3966301595fdf97d617

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