Skip to main content

Documentation Index

Fetch the complete documentation index at: https://arize-ax.mintlify.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

Google ADK (Agent Development Kit) is Google’s Python framework for building agents that combine Gemini models with tools, sessions, and runners. Arize AX captures every ADK run — agent invocations, tool calls, and the underlying Gemini calls — via the openinference-instrumentation-google-adk package.
https://storage.googleapis.com/arize-phoenix-assets/assets/images/phoenix-docs-images/gc.ico

Google ADK Tracing Tutorial (Google Colab)

Prerequisites

Launch Arize AX

  1. Sign in to your Arize AX account.
  2. From Space Settings, copy your Space ID and API Key. You will set them as ARIZE_SPACE_ID and ARIZE_API_KEY below.

Install

pip install arize-otel openinference-instrumentation-google-adk google-adk

Configure credentials

export ARIZE_SPACE_ID="<your-space-id>"
export ARIZE_API_KEY="<your-api-key>"
export ARIZE_PROJECT_NAME="google-adk-tracing-example"
export GEMINI_API_KEY="<your-gemini-api-key>"

Setup tracing

# instrumentation.py
import os

from arize.otel import register
from openinference.instrumentation.google_adk import GoogleADKInstrumentor

tracer_provider = register(
    space_id=os.environ["ARIZE_SPACE_ID"],
    api_key=os.environ["ARIZE_API_KEY"],
    project_name=os.environ["ARIZE_PROJECT_NAME"],
)

GoogleADKInstrumentor().instrument(tracer_provider=tracer_provider)
print("Arize AX tracing initialized for Google ADK.")
When deploying to Vertex AI Agent Engine, the same register(...) + GoogleADKInstrumentor().instrument(...) calls must run inside the remote agent module (the file you pass to agent_engines.create(...)), not in the local driver script. Local instrumentation does not propagate to the remote runtime.

Run Google ADK

# example.py

# Importing instrumentation first ensures tracing is set up
# before `google.adk` is imported.
from instrumentation import tracer_provider

import asyncio

from google.adk.agents import Agent
from google.adk.runners import InMemoryRunner
from google.genai import types


def get_ocean_salinity() -> dict:
    """Return a one-line factoid about ocean salinity."""
    return {
        "status": "success",
        "report": (
            "The ocean is salty because rivers continuously dissolve "
            "mineral salts from rocks and soil and carry them to the "
            "sea, where they accumulate over millions of years."
        ),
    }


agent = Agent(
    name="ocean_agent",
    model="gemini-2.5-flash",
    description="Answers questions about the ocean using a tool.",
    instruction=(
        "Use get_ocean_salinity to answer the user. "
        "Reply with a concise two-sentence summary."
    ),
    tools=[get_ocean_salinity],
)


async def main() -> None:
    runner = InMemoryRunner(agent=agent, app_name="ocean_app")
    await runner.session_service.create_session(
        app_name="ocean_app",
        user_id="demo_user",
        session_id="demo_session",
    )
    async for event in runner.run_async(
        user_id="demo_user",
        session_id="demo_session",
        new_message=types.Content(
            role="user",
            parts=[types.Part(text="Why is the ocean salty?")],
        ),
    ):
        if event.is_final_response():
            print(event.content.parts[0].text.strip())


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

Expected output

Arize AX tracing initialized for Google ADK.
The ocean is salty because rivers continuously dissolve mineral salts from rocks and soil and carry them to the sea, where they accumulate over millions of years. Water leaves the ocean through evaporation but the salts remain, steadily concentrating until reaching today's roughly 3.5% salinity.

Verify in Arize AX

  1. Open your Arize AX space and select project google-adk-tracing-example.
  2. You should see a new trace within ~30 seconds with this shape: an invocation [ocean_app] root span (CHAIN) wraps an agent_run [ocean_agent] span (AGENT), which wraps two call_llm spans (LLM, model gemini-2.5-flash — the first emits the function call, the second consumes the tool result) and an execute_tool get_ocean_salinity span (TOOL). Prompts, responses, and token usage are attached to the LLM spans.
  3. If no traces appear, see Troubleshooting.

Troubleshooting

  • No traces in Arize AX. Confirm ARIZE_SPACE_ID and ARIZE_API_KEY are set in the same shell that runs example.py. Enable OpenTelemetry debug logs with export OTEL_LOG_LEVEL=debug and re-run.
  • ADK spans missing but other spans present. GoogleADKInstrumentor().instrument(...) must run before any from google.adk import .... Make sure instrumentation.py is the first import in your entry point.
  • 401 / 403 from Gemini. Verify GEMINI_API_KEY is set and has access to gemini-2.5-flash. ADK also accepts GOOGLE_API_KEY; if you set both, GEMINI_API_KEY takes precedence.
  • 404 NOT_FOUND for the model. Google occasionally retires older Gemini aliases for new users. Swap gemini-2.5-flash for a model your key can call.
  • Vertex AI / Agent Engine deployments. Set GOOGLE_GENAI_USE_VERTEXAI=true plus GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION, and run register(...) + GoogleADKInstrumentor().instrument(...) inside the remote agent module — not in the local driver. See the Google ADK observability guide for the full Agent Engine snippet.

Resources

Google ADK Documentation

OpenInference Google ADK Instrumentor

Google ADK Python SDK

ADK Sample: Travel Concierge (multi-agent)