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.2.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.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mubit_adk-0.5.2.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.2.tar.gz
Algorithm Hash digest
SHA256 7cff83065b07938d347140e4ef4d6187dfa8928755bede41bb027971fa69671c
MD5 f56c9049bf16ab5ad42eeddd6786d0c5
BLAKE2b-256 9dae19ccffedd2a4e1c4d3d3850c29d9f90ca846c69f7aacb88c4a7ae9b10257

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mubit_adk-0.5.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 81a7ca0711c4fe2efa2d7743289511a8b22a1d4871176b43c251b2343c984aab
MD5 22751703fe9bc5fd674a2a80b7d3663d
BLAKE2b-256 cc7a374b33305fc74b224b0257a1ec0a0df0fd2fe21d816f6a859203fbce0c50

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