Skip to content

Google ADK

Google ADK (the Agent Development Kit, google-adk) is Google’s framework for building and deploying agents. ADK has native OpenTelemetry instrumentation and resolves its tracer from the global tracer provider — so once logfire.configure() has set Logfire as the global provider, ADK’s agent, LLM, and tool spans flow to Logfire automatically, with no instrumentor.

Installation

Terminal
pip install logfire google-adk

Usage

First, opt in to the latest generative AI semantic conventions and tell ADK to put message content directly on model spans. Run these commands in your terminal before starting the application:

Terminal
export OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY

Then call logfire.configure() before you run the agent:

import asyncio

from google.adk.agents import Agent  # Agent is an alias of LlmAgent
from google.adk.runners import InMemoryRunner
from google.genai import types

import logfire

# Sets the global OTel tracer provider — ADK's native spans flow here automatically.
logfire.configure(service_name='adk-demo')


def get_weather(city: str) -> dict:
    """Return the current weather for a city."""
    return {'status': 'success', 'report': f"It's sunny and 25C in {city}."}


agent = Agent(
    name='weather_agent',
    model='gemini-2.5-flash',
    instruction='You are a helpful assistant. Use tools to answer questions.',
    tools=[get_weather],
)


async def main():
    runner = InMemoryRunner(agent=agent, app_name='weather_app')
    session = await runner.session_service.create_session(app_name='weather_app', user_id='user1')
    message = types.Content(role='user', parts=[types.Part(text='Weather in Paris?')])
    async for event in runner.run_async(user_id='user1', session_id=session.id, new_message=message):
        if event.is_final_response():
            print(event.content.parts[0].text)


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

You’ll see a trace in Logfire with the agent run, the underlying LLM (Gemini) call, and the get_weather tool call nested as a timeline. Google ADK runs also appear in the specialized Agents view; the support matrix shows which columns each view populates.

Managed prompts

Keep your agents’ instructions in Prompt Management and fetch them at runtime:

Terminal
pip install 'logfire[variables]'
from google.adk.agents import Agent
from pydantic import BaseModel

import logfire

logfire.configure()


class InstructionInputs(BaseModel):
    persona: str


instruction_var = logfire.template_var(
    name='prompt__weather_agent_instruction',
    type=str,
    default='You are a helpful assistant. Use tools to answer questions.',
    inputs_type=InstructionInputs,
)

with instruction_var.get(InstructionInputs(persona='a friendly meteorologist'), label='production') as resolved:
    instruction = resolved.value

agent = Agent(name='weather_agent', model='gemini-2.5-flash', instruction=instruction)

See Use Prompts in Your Application for the full workflow.