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

# Google ADK

> Connect Google Agent Development Kit to Orq.ai via OpenTelemetry. Trace agent workflows, tool calls, and Gemini model interactions.

<CardGroup cols={1}>
  <Card title="Observability" icon="chart-line" href="#observability">
    Instrument your code with OpenTelemetry to capture traces, logs, and metrics for every LLM call, agent step, and tool use.
  </Card>
</CardGroup>

## Observability

### Getting Started

Google Agent Development Kit (ADK) is a flexible, model-agnostic framework for developing and deploying AI agents. ADK simplifies building complex agent architectures with workflow orchestration, tool integration, and multi-agent collaboration. Integrate with Orq.ai to monitor agent behavior, track tool usage, analyze workflows, and optimize your agent systems.

### Prerequisites

Before you begin, ensure you have:

* An Orq.ai account and [API Key](/docs/administer/api-keys)
* Google API key (for model access)
* Python 3.8+
* Google ADK installed in your project

### Install Dependencies

**Python:**

<CodeGroup>
  ```bash Bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
  # Google ADK
  pip install google-adk

  # OpenTelemetry packages
  pip install opentelemetry-sdk opentelemetry-exporter-otlp

  # OpenInference instrumentation for ADK (if available)
  pip install openinference-instrumentation-google-adk
  ```
</CodeGroup>

**Java:**

<CodeGroup>
  ```bash Bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
  <!-- For Maven -->
  <dependency>
      <groupId>com.google.ai</groupId>
      <artifactId>google-adk</artifactId>
      <version>latest</version>
  </dependency>
  ```
</CodeGroup>

<CodeGroup>
  ```bash Bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
  // For Gradle
  implementation 'com.google.ai:google-adk:latest'
  ```
</CodeGroup>

### Configure Orq.ai

Set up your environment variables to connect to Orq.ai's OpenTelemetry collector:

**Unix/Linux/macOS:**

<CodeGroup>
  ```bash Bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
  export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.orq.ai/v2/otel"
  export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <ORQ_API_KEY>"
  export OTEL_RESOURCE_ATTRIBUTES="service.name=google-adk-app,service.version=1.0.0"
  export GOOGLE_API_KEY="your-google-api-key"
  ```
</CodeGroup>

**Windows (PowerShell):**

<CodeGroup>
  ```bash Bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
  $env:OTEL_EXPORTER_OTLP_ENDPOINT = "https://api.orq.ai/v2/otel"
  $env:OTEL_EXPORTER_OTLP_HEADERS = "Authorization=Bearer <ORQ_API_KEY>"
  $env:OTEL_RESOURCE_ATTRIBUTES = "service.name=google-adk-app,service.version=1.0.0"
  $env:GOOGLE_API_KEY = "your-google-api-key"
  ```
</CodeGroup>

**Using .env file:**

<CodeGroup>
  ```bash Bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
  OTEL_EXPORTER_OTLP_ENDPOINT=https://api.orq.ai/v2/otel
  OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer <ORQ_API_KEY>
  OTEL_RESOURCE_ATTRIBUTES=service.name=google-adk-app,service.version=1.0.0
  GOOGLE_API_KEY=your-google-api-key
  ```
</CodeGroup>

### Integrations

Choose your preferred OpenTelemetry framework for collecting traces:

### OpenInference

**Best for**: Comprehensive ADK instrumentation with automatic tool and model tracking

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from openinference.instrumentation.google_adk import GoogleADKInstrumentor
  from opentelemetry import trace
  from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
  from opentelemetry.sdk.trace import TracerProvider
  from opentelemetry.sdk.trace.export import BatchSpanProcessor
  from opentelemetry.sdk.resources import Resource
  import os

  # Initialize OpenTelemetry
  resource = Resource.create({
      "service.name": os.getenv("OTEL_SERVICE_NAME", "google-adk-app"),
      "service.version": "1.0.0"
  })

  provider = TracerProvider(resource=resource)
  processor = BatchSpanProcessor(
      OTLPSpanExporter(
          headers={"Authorization": f"Bearer {os.getenv('ORQ_API_KEY')}"}
      )
  )
  provider.add_span_processor(processor)
  trace.set_tracer_provider(provider)

  # Instrument Google ADK
  GoogleADKInstrumentor().instrument()

  # Now use ADK normally - all agent operations will be traced
  import google.adk as adk
  from google.adk.runners import Runner
  from google.adk.sessions import InMemorySessionService
  from google.genai import types
  import asyncio

  async def main():
      # Create a simple agent
      agent = adk.Agent(
          name="Helper",
          instruction="You are a helpful assistant. Give short, clear answers.",
          model="gemini-2.5-flash"
      )

      # Create session and runner
      session_service = InMemorySessionService()
      runner = Runner(
          agent=agent,
          app_name="simple-helper",
          session_service=session_service
      )

      # Create a session (await the async call)
      session = await session_service.create_session(
          app_name="simple-helper",
          user_id="user1"
      )

      # Simple one-shot example
      question = "What is 25 + 17?"
      content = types.Content(role='user', parts=[types.Part(text=question)])

      # Run the agent (this is also async)
      events = runner.run_async(
          user_id="user1",
          session_id=session.id,
          new_message=content
      )

      # Get the response
      async for event in events:
          if event.is_final_response():
              response = event.content.parts[0].text
              print(f"Q: {question}")
              print(f"A: {response}")

  # Run the async main function
  if __name__ == "__main__":
      asyncio.run(main())
  ```
</CodeGroup>

<Info>
  To view more examples of ADK implementation, browse the [Google ADK Samples repository](https://github.com/google/adk-samples)
</Info>

### Next Steps

**Verify your Traces** in the **orq.ai** Studio.

<Frame caption="Traces will be shown for the session and calls made within the ADK implementation.">
  <img src="https://mintcdn.com/orqai/EqUGDI2og-dnTmDI/images/docs/5989db35f83a76af140ae73595632a832d0aa30b98e7294d4298bfe219dbf46f-Screenshot_2025-09-22_at_11.21.09.png?fit=max&auto=format&n=EqUGDI2og-dnTmDI&q=85&s=3cb219d647b3178cf6d8be5730b32840" alt="Traces will be shown for the session and calls made within the ADK implementation." width="1281" height="685" data-path="images/docs/5989db35f83a76af140ae73595632a832d0aa30b98e7294d4298bfe219dbf46f-Screenshot_2025-09-22_at_11.21.09.png" />
</Frame>

<Info>
  To learn more about the capabilities of Traces in orq.ai, see [Traces](/docs/observability/traces)
</Info>

## Evaluations & Experiments

Once your agents are running, use **Evaluatorq** to score outputs across a dataset and **Experiments** to compare configurations side-by-side.

<CardGroup cols={2}>
  <Card title="Run Evaluations with Evaluatorq" icon="flask" href="/docs/evaluators/build#evaluatorq">
    Run parallel evaluations across your agents and compare results.
  </Card>

  <Card title="Run Experiments via the API" icon="flask-vial" href="/docs/experiments/api">
    Compare agent configurations and view results in the AI Studio.
  </Card>
</CardGroup>
