{"library":"openinference-instrumentation-google-adk","title":"OpenInference Google ADK Instrumentation","description":"This library provides OpenTelemetry instrumentation for Google ADK (Agent Development Kit). It automatically patches Google ADK's runner, agent, LLM, and tool layers to generate spans that adhere to the OpenTelemetry GenAI semantic conventions, enabling detailed observability for Google ADK applications and LLM interactions. It is part of the broader OpenInference project by Arize-AI, which sees frequent updates and new instrumentation releases across various AI/ML frameworks. The current version is 0.1.10. [1, 2, 8, 10, 15]","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install openinference-instrumentation-google-adk google-adk opentelemetry-sdk opentelemetry-exporter-otlp"],"cli":null},"imports":["from openinference.instrumentation.google_adk import GoogleADKInstrumentor"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nimport asyncio\nfrom google.adk.agents import Agent\nfrom google.adk.runners import InMemoryRunner\nfrom google.genai import types\n\nfrom opentelemetry import trace\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import SimpleSpanProcessor, ConsoleSpanExporter\nfrom opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter\n\nfrom openinference.instrumentation.google_adk import GoogleADKInstrumentor\n\n# Set your Google API Key (replace with your actual key or use env var)\nos.environ[\"GOOGLE_API_KEY\"] = os.environ.get(\"GOOGLE_API_KEY\", \"YOUR_GEMINI_API_KEY_HERE\")\n\n# 1. Configure OpenTelemetry Tracer Provider\n# For simplicity, using ConsoleSpanExporter here. In a real app, use OTLPSpanExporter\n# to send traces to an observability backend like Arize Phoenix, SigNoz, or Langfuse.\nresource = Resource.create({\"service.name\": \"my-adk-agent\"})\ntracer_provider = TracerProvider(resource=resource)\n\n# To export to console (for quick verification):\ntracer_provider.add_span_processor(SimpleSpanProcessor(ConsoleSpanExporter()))\n\n# To export to an OTLP endpoint (e.g., a collector, Phoenix, SigNoz, Langfuse):\n# endpoint = os.environ.get(\"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT\", \"http://localhost:4317\")\n# tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))\n\ntrace.set_tracer_provider(tracer_provider)\n\n# 2. Instrument Google ADK\nGoogleADKInstrumentor().instrument(tracer_provider=tracer_provider)\n\n# 3. Define a sample Google ADK Agent\ndef get_current_time(city: str) -> dict:\n    \"\"\"Returns the current time for a specified city.\"\"\"\n    # This is a dummy tool, replace with actual logic\n    return {\"status\": \"success\", \"time\": f\"The current time in {city} is 12:00 PM.\"}\n\nagent = Agent(\n    name=\"TimeAgent\",\n    model=\"gemini-pro\", # or \"gemini-2.0-flash-exp\" as per docs\n    description=\"Agent to provide current time in a city.\",\n    instruction=\"You must use the get_current_time tool to find the answer.\",\n    tools=[get_current_time]\n)\n\nasync def main():\n    runner = InMemoryRunner(agent=agent)\n    print(\"Agent started. Ask a question about time.\")\n    user_prompt = \"What time is it in London?\"\n    print(f\"User: {user_prompt}\")\n    response = await runner.run(types.Message(text=user_prompt))\n    print(f\"Agent: {response.text}\")\n\n    user_prompt_2 = \"What about New York?\"\n    print(f\"User: {user_prompt_2}\")\n    response_2 = await runner.run(types.Message(text=user_prompt_2))\n    print(f\"Agent: {response_2.text}\")\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n","lang":"python","description":"This quickstart demonstrates how to set up OpenTelemetry tracing for a Google ADK agent using `openinference-instrumentation-google-adk`. It configures a `TracerProvider` (showing both console and OTLP export options), initializes the `GoogleADKInstrumentor`, and then runs a basic ADK agent that uses a tool. Ensure `GOOGLE_API_KEY` is set as an environment variable or directly in the code for Gemini access. [3, 6, 11, 12, 16, 17]","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"0.1.9","pypi_latest":"0.1.13","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":28.4,"avg_import_s":0.65,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"openinference-instrumentation-google-adk","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.47,"mem_mb":12.2,"disk_size":"692.4M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"openinference-instrumentation-google-adk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":36.3,"import_time_s":0.42,"mem_mb":16.1,"disk_size":"665M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"openinference-instrumentation-google-adk","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":0.1,"import_time_s":0.69,"mem_mb":13.5,"disk_size":"748.8M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"openinference-instrumentation-google-adk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":35.9,"import_time_s":0.7,"mem_mb":17.1,"disk_size":"722M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"openinference-instrumentation-google-adk","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.82,"mem_mb":13.7,"disk_size":"732.7M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"openinference-instrumentation-google-adk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":31,"import_time_s":0.91,"mem_mb":17.6,"disk_size":"706M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"openinference-instrumentation-google-adk","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.8,"mem_mb":15.6,"disk_size":"728.1M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"openinference-instrumentation-google-adk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":30,"import_time_s":0.85,"mem_mb":15.7,"disk_size":"701M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"openinference-instrumentation-google-adk","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.38,"mem_mb":11,"disk_size":"474.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"openinference-instrumentation-google-adk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":37,"import_time_s":0.42,"mem_mb":15.1,"disk_size":"473M"}]}}