Skip to main content

DBOS integration for the Google Agent Development Kit

Project description

Durable Google ADK Agents

Durable execution for the Google Agent Development Kit using DBOS.

Installation

pip install dbos-google-adk

Usage

Add DBOSPlugin to your Runner and call it from a @DBOS.workflow(). Annotate tool calls with @DBOS.step().

import asyncio
import logging

from dbos import DBOS, DBOSConfig
from dbos_google_adk import DBOSPlugin
from google.adk.agents import LlmAgent
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.genai import types

# Suppress cosmetic OpenTelemetry warning. See google/adk-python#4894.
logging.getLogger("opentelemetry.context").setLevel(logging.CRITICAL)


# Decorate tool calls with @DBOS.step() for durable execution
@DBOS.step()
async def get_weather(city: str) -> str:
    """Get the weather for a city."""
    return f"Sunny in {city}"


agent = LlmAgent(name="weather", model="gemini-2.5-flash", tools=[get_weather])
runner = Runner(
    app_name="my-agent",
    agent=agent,
    plugins=[DBOSPlugin()],
    session_service=InMemorySessionService(),
)


# Drive the agent from a DBOS workflow for durable execution
@DBOS.workflow()
async def run_agent(user_id: str, session_id: str, message: str) -> str:
    new_message = types.Content(role="user", parts=[types.Part.from_text(text=message)])
    async for event in runner.run_async(
        user_id=user_id, session_id=session_id, new_message=new_message
    ):
        if event.is_final_response():
            return event.content.parts[0].text
    return ""


async def main():
    config: DBOSConfig = {"name": "my-agent"}
    DBOS(config=config)
    DBOS.launch()

    await runner.session_service.create_session(
        app_name="my-agent", user_id="u", session_id="s"
    )
    print(await run_agent("u", "s", "How is the weather in San Francisco?"))


if __name__ == "__main__":
    asyncio.run(main())

DBOSPlugin checkpoints every model call through DBOS so that an interrupted workflow resumes from the last completed step on retry. It must be used from within a @DBOS.workflow().

For durable event compaction, wrap your summarizer with DBOSEventSummarizer so the compaction LLM call is also checkpointed:

from dbos_google_adk import DBOSEventSummarizer
from google.adk.models.google_llm import Gemini

summarizer = DBOSEventSummarizer.from_llm(Gemini(model="gemini-2.5-flash"))

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

dbos_google_adk-0.1.0.tar.gz (253.5 kB view details)

Uploaded Source

Built Distribution

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

dbos_google_adk-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file dbos_google_adk-0.1.0.tar.gz.

File metadata

  • Download URL: dbos_google_adk-0.1.0.tar.gz
  • Upload date:
  • Size: 253.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dbos_google_adk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 279c659acc88d8be626080746a61b3690999b555a93326da3e94c7512771c28b
MD5 22ebdbd1c49a60dd4d259e792d5a8ee1
BLAKE2b-256 9600e7b5b23fdef509246350c223445bea8e0d443fa3e22c509ac966c710efba

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbos_google_adk-0.1.0.tar.gz:

Publisher: publish.yml on dbos-inc/dbos-google-adk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbos_google_adk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dbos_google_adk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31c34bad313a45cfafe0d431ee64947940dfca7b5e2e296b01426f9b8535e1aa
MD5 97e9baee20bb16338b31c892a50392ab
BLAKE2b-256 69ae2dde947a9659f44af220426e0669808fbdb5a9603603c01aab9e18cde61e

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbos_google_adk-0.1.0-py3-none-any.whl:

Publisher: publish.yml on dbos-inc/dbos-google-adk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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