Skip to main content
  1. Sign up — Create an account at platform.respan.ai
  2. Create an API key — Generate one on the API keys page
  3. Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page
Add the Docs MCP to your AI coding tool to get help building with Respan. No API key needed.
{
  "mcpServers": {
    "respan-docs": {
      "url": "https://docs.respan.ai/mcp"
    }
  }
}

What is Google ADK?

Google ADK (Agent Development Kit) is Google’s framework for building AI agents. It provides tools for creating agents that can interact with Google’s Gemini models and external tools.

Setup

1

Install packages

pip install google-adk respan-ai openinference-instrumentation-google-adk python-dotenv
2

Set environment variables

export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"
3

Initialize and run

import os
from dotenv import load_dotenv

load_dotenv()

from respan import Respan
from openinference.instrumentation.google_adk import GoogleADKInstrumentor
from google.adk import Agent, Runner

# Initialize Respan with Google ADK instrumentation
respan = Respan(instrumentations=[GoogleADKInstrumentor()])

agent = Agent(
    name="Assistant",
    model="gemini-2.0-flash",
    instruction="You are a helpful assistant.",
)

runner = Runner(agent=agent, app_name="my-app")
result = runner.run(user_id="user_1", query="What is the capital of France?")
print(result)
respan.flush()
4

View your trace

Open the Traces page to see your agent trace with LLM spans and tool calls.

Configuration

ParameterTypeDefaultDescription
api_keystr | NoneNoneFalls back to RESPAN_API_KEY env var.
base_urlstr | NoneNoneFalls back to RESPAN_BASE_URL env var.
instrumentationslist[]Plugin instrumentations to activate (e.g. GoogleADKInstrumentor()).
is_auto_instrumentbool | NoneFalseAuto-discover and activate all installed instrumentors via OpenTelemetry entry points.
customer_identifierstr | NoneNoneDefault customer identifier for all spans.
metadatadict | NoneNoneDefault metadata attached to all spans.
environmentstr | NoneNoneEnvironment tag (e.g. "production").

Attributes

In Respan()

Set defaults at initialization — these apply to all spans.
from respan import Respan
from openinference.instrumentation.google_adk import GoogleADKInstrumentor

respan = Respan(
    instrumentations=[GoogleADKInstrumentor()],
    customer_identifier="user_123",
    metadata={"service": "adk-agent", "version": "1.0.0"},
)

With propagate_attributes

Override per-request using a context manager.
from respan import Respan, workflow, propagate_attributes
from openinference.instrumentation.google_adk import GoogleADKInstrumentor

respan = Respan(instrumentations=[GoogleADKInstrumentor()])

@workflow(name="handle_request")
def handle_request(user_id: str, query: str):
    with propagate_attributes(
        customer_identifier=user_id,
        thread_identifier="conv_001",
        metadata={"plan": "pro"},
    ):
        result = runner.run(user_id=user_id, query=query)
        print(result)
AttributeTypeDescription
customer_identifierstrIdentifies the end user in Respan analytics.
thread_identifierstrGroups related messages into a conversation.
metadatadictCustom key-value pairs. Merged with default metadata.

Decorators

Use @workflow and @task to create structured trace hierarchies.
from respan import Respan, workflow, task
from openinference.instrumentation.google_adk import GoogleADKInstrumentor
from google.adk import Agent, Runner

respan = Respan(instrumentations=[GoogleADKInstrumentor()])

agent = Agent(
    name="Researcher",
    model="gemini-2.0-flash",
    instruction="You research topics thoroughly.",
)

runner = Runner(agent=agent, app_name="research-app")

@task(name="research_topic")
def research(topic: str) -> str:
    result = runner.run(user_id="user_1", query=f"Research: {topic}")
    return str(result)

@workflow(name="research_pipeline")
def pipeline(topic: str):
    findings = research(topic)
    print(findings)

pipeline("quantum computing applications")
respan.flush()

Examples

Basic agent

from google.adk import Agent, Runner

agent = Agent(
    name="Assistant",
    model="gemini-2.0-flash",
    instruction="You are a helpful assistant.",
)

runner = Runner(agent=agent, app_name="hello-world")
result = runner.run(user_id="user_1", query="Explain machine learning in one sentence.")
print(result)

Tool use

from google.adk import Agent, Runner

def get_weather(city: str) -> str:
    """Get the weather for a city."""
    return f"The weather in {city} is sunny, 72F"

agent = Agent(
    name="Weather Agent",
    model="gemini-2.0-flash",
    instruction="Help users check the weather using the provided tool.",
    tools=[get_weather],
)

runner = Runner(agent=agent, app_name="weather-app")
result = runner.run(user_id="user_1", query="What's the weather in San Francisco?")
print(result)