> ## Documentation Index
> Fetch the complete documentation index at: https://www.botgauge.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Trace Google ADK with BotGauge

> Trace Google ADK agents with BotGauge in code or zero-code. Needs ADK 2.10 or newer, with a tested LiteLLM sample and known failure modes.

Records Google ADK agent runs. The verified zero-code run reaches the model through ADK's LiteLLM wrapper, and the extra needs google-adk 2.10 or newer.

| | |
| - | - |
| Extra | `[google-adk]` |
| Verified framework versions | google-adk 2.10.0 and 2.12.0 |
| Instrumentor installed by the extra | `openinference-instrumentation-google-adk 1.0.4` |
| Zero-code run | Traced |

Also verified: google-adk 2.10.0 with instrumentor 1.0.0. The extra no longer installs that older instrumentor. See [supported frameworks](https://www.botgauge.com/docs/integrations/overview.md) for how verification works.

## In code

Call `tracing.init()`, attach the framework instrumentor to the provider it returns, and wrap the work in `tracing.turn()` and `tracing.agent()`.

> [!NOTE]
>
> This sample calls the model through ADK's LiteLLM wrapper, so any OpenAI-compatible endpoint works. `custom_llm_provider="openai"` keeps the plain model name on the LLM span.

**1. Install**

```bash terminal theme={null}
pip install "botgauge[google-adk]" google-adk==2.12.0 litellm==1.103.2
```

**2. Add the code**

```python app.py theme={null}
import asyncio
import os

from botgauge import tracing
from google.adk import Agent
from google.adk.models.lite_llm import LiteLlm
from google.adk.runners import InMemoryRunner
from google.genai import types
from openinference.instrumentation.google_adk import GoogleADKInstrumentor

provider = tracing.init()
GoogleADKInstrumentor().instrument(tracer_provider=provider)

model = LiteLlm(
    model=os.environ["OPENAI_MODEL"],
    custom_llm_provider="openai",
    api_base=os.environ["OPENAI_BASE_URL"],
    api_key=os.environ["OPENAI_API_KEY"],
)

async def main():
    agent = Agent(name="researcher", model=model)
    runner = InMemoryRunner(agent=agent, app_name="demo")
    await runner.session_service.create_session(app_name="demo", user_id="user", session_id="s1")
    question = types.Part(text="In one sentence, what is OpenTelemetry?")
    message = types.Content(role="user", parts=[question])
    with tracing.turn(session_id="ses_google_adk"), tracing.agent("google-adk-agent"):
        run = runner.run_async(user_id="user", session_id="s1", new_message=message)
        events = [event async for event in run]
    print(events[-1].content.parts[0].text)

asyncio.run(main())

tracing.shutdown()
```

**3. Run**

```bash terminal theme={null}
python app.py
```

Needs `BOTGAUGE_API_KEY`, `OPENAI_MODEL`, `OPENAI_BASE_URL`, `OPENAI_API_KEY`.

## Zero-code

Leave your app unchanged and start it with `botgauge instrument`. The sample still wraps the work in `tracing.turn()` and `tracing.agent()` so spans carry session and agent ids.

> [!NOTE]
>
> This sample calls the model through ADK's LiteLLM wrapper, so any OpenAI-compatible endpoint works. `custom_llm_provider="openai"` keeps the plain model name on the LLM span.

**1. Install**

```bash terminal theme={null}
pip install "botgauge[google-adk]" google-adk==2.12.0 litellm==1.103.2
```

**2. Add the code**

```python app.py theme={null}
import asyncio
import os

from botgauge import tracing
from google.adk import Agent
from google.adk.models.lite_llm import LiteLlm
from google.adk.runners import InMemoryRunner
from google.genai import types

model = LiteLlm(
    model=os.environ["OPENAI_MODEL"],
    custom_llm_provider="openai",
    api_base=os.environ["OPENAI_BASE_URL"],
    api_key=os.environ["OPENAI_API_KEY"],
)

async def main():
    agent = Agent(name="researcher", model=model)
    runner = InMemoryRunner(agent=agent, app_name="demo")
    await runner.session_service.create_session(app_name="demo", user_id="user", session_id="s1")
    question = types.Part(text="In one sentence, what is OpenTelemetry?")
    message = types.Content(role="user", parts=[question])
    with tracing.turn(session_id="ses_google_adk"), tracing.agent("google-adk-agent"):
        run = runner.run_async(user_id="user", session_id="s1", new_message=message)
        events = [event async for event in run]
    print(events[-1].content.parts[0].text)

asyncio.run(main())
```

**3. Run**

```bash terminal theme={null}
botgauge instrument python app.py
```

Needs `BOTGAUGE_API_KEY`, `OPENAI_MODEL`, `OPENAI_BASE_URL`, `OPENAI_API_KEY`.

View Google ADK spans liveWatch your Google ADK agent runs through LiteLLM appear in [BotGauge](https://cloud.botgauge.com).

[Try BotGauge →](https://cloud.botgauge.com)

## Related

See [versions not verified](https://www.botgauge.com/docs/integrations/versions-not-verified.md) if you run a different version, [capture and redaction](https://www.botgauge.com/docs/tracing/capture-and-redaction.md) to control exported content, and [troubleshooting](https://www.botgauge.com/docs/tracing/troubleshooting.md) if spans are missing. If ADK is older than 2.10, the extra skips ADK and says so at startup. See [versions not verified](https://www.botgauge.com/docs/integrations/versions-not-verified.md#instrumentors-that-dont-support-your-version) for the two failure modes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.