Skip to content

Google ADK

Coralogix's AI Observability integration for Google ADK (Agent Development Kit) provides production-ready tracing for agent workflows built on Gemini. Instrument your ADK agents with a single call to gain full visibility into prompts, completions, tool calls, and performance metrics.

What you need

  • Python version 3.10 and above.
  • Coralogix API keys.
  • Google ADK installed and configured with valid credentials.

Installation

Run the following command.

pip install "llm-tracekit-google-adk"

Authentication

Exporting spans to Coralogix requires configuring OTLP credentials before enabling instrumentation. Use setup_export_to_coralogix or the corresponding environment variables to supply authentication details.

Using setup_export_to_coralogix

from llm_tracekit.google_adk import setup_export_to_coralogix

setup_export_to_coralogix(
    service_name="ai-service",
    application_name="ai-application",
    subsystem_name="ai-subsystem",
    capture_content=True,
)

Using environment variables

If arguments are not passed to setup_export_to_coralogix, the helper reads the following environment variables:

  • CX_TOKEN: Your Coralogix API key.
  • CX_ENDPOINT: Select the ingress.:443 endpoint that corresponds to your Coralogix domain using the domain selector at the top of the page.
  • CX_APPLICATION_NAME: Your application's name.
  • CX_SUBSYSTEM_NAME: Your subsystem's name.

Set up tracing

Instrument

Create an instance of GoogleADKInstrumentor and call instrument before running your agent.

from llm_tracekit.google_adk import GoogleADKInstrumentor

GoogleADKInstrumentor().instrument()

Uninstrument

To remove instrumentation, call the uninstrument method.

GoogleADKInstrumentor().uninstrument()

Full example

import asyncio
from google.adk import Agent, Runner
from google.adk.sessions import InMemorySessionService
from google.genai import types
from llm_tracekit.google_adk import GoogleADKInstrumentor, setup_export_to_coralogix

# Optional: configure sending spans to Coralogix
# Reads connection details from environment variables: CX_TOKEN, CX_ENDPOINT
setup_export_to_coralogix(
    service_name="ai-service",
    application_name="ai-application",
    subsystem_name="ai-subsystem",
    capture_content=True,
)

# Activate instrumentation
GoogleADKInstrumentor().instrument()


async def main():
    agent = Agent(
        name="MyAgent",
        model="gemini-2.0-flash",
        instruction="You are a helpful assistant.",
    )

    session_service = InMemorySessionService()
    runner = Runner(agent=agent, app_name="my_app", session_service=session_service)

    session = await session_service.create_session(app_name="my_app", user_id="user_1")

    async for event in runner.run_async(
        user_id="user_1",
        session_id=session.id,
        new_message=types.Content(role="user", parts=[types.Part(text="Hello!")]),
    ):
        if event.content and event.content.parts:
            for part in event.content.parts:
                if part.text:
                    print(part.text, end="")


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

Enable message content capture

By default, message content — such as prompts, completions, tool call arguments, and tool responses — is not captured.

To capture message content as span attributes, do one of the following:

  • Pass capture_content=True when calling setup_export_to_coralogix.
  • Set the environment variable OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT to true.

Many Coralogix AI evaluations rely on message content; enabling capture is a best practice.

Semantic conventions

AttributeTypeDescriptionExample
gen_ai.prompt.<message_number>.rolestringRole of the author for each input messagesystem, user, assistant, tool
gen_ai.prompt.<message_number>.contentstringContents of the input message (captured when content capture is enabled)What's the weather in Paris?
gen_ai.prompt.<message_number>.tool_calls.<tool_call_number>.idstringID of a tool call issued from the promptcall_O8NOz8VlxosSASEsOY7LDUcP
gen_ai.prompt.<message_number>.tool_calls.<tool_call_number>.typestringType of tool call issued from the promptfunction
gen_ai.prompt.<message_number>.tool_calls.<tool_call_number>.function.namestringFunction name used in the prompt's tool callget_current_weather
gen_ai.prompt.<message_number>.tool_calls.<tool_call_number>.function.argumentsstringArguments passed to the prompt's tool call{"location": "Seattle, WA"}
gen_ai.prompt.<message_number>.tool_call_idstringTool call ID in the input messagecall_mszuSIzqtI65i1wAUOE8w5H4
gen_ai.completion.<choice_number>.rolestringRole of the author for each returned choiceassistant
gen_ai.completion.<choice_number>.finish_reasonstringFinish reason reported for the choicestop, tool_calls, error
gen_ai.completion.<choice_number>.contentstringText returned by the model (captured when content capture is enabled)The weather in Paris is rainy and overcast.
gen_ai.completion.<choice_number>.tool_calls.<tool_call_number>.idstringID of a tool call triggered by the modelcall_O8NOz8VlxosSASEsOY7LDUcP
gen_ai.completion.<choice_number>.tool_calls.<tool_call_number>.typestringType of tool call triggered by the modelfunction
gen_ai.completion.<choice_number>.tool_calls.<tool_call_number>.function.namestringFunction name executed by the model's tool callget_current_weather
gen_ai.completion.<choice_number>.tool_calls.<tool_call_number>.function.argumentsstringArguments supplied to the model's tool call{"location": "Seattle, WA"}
gen_ai.request.tools.<tool_number>.typestringType of tool entry in tools listfunction
gen_ai.request.tools.<tool_number>.function.namestringName of the function used in tool callsget_current_weather
gen_ai.request.tools.<tool_number>.function.descriptionstringDescription of the functionGet the current weather in a given location