Google ADK
Overview
Google ADK (Agent Development Kit) is Google’s open-source framework for building, evaluating, and deploying AI agents. Confident AI allows you to trace and evaluate Google ADK agents in just a few lines of code.
The integration works via OpenTelemetry: instrument_google_adk() wraps the community-maintained openinference-instrumentation-google-adk package, which instruments every ADK agent, model call, and tool invocation as an OTel span. Confident AI’s OpenInference span interceptor then translates these into Confident AI spans and ships them in real time.
Tracing Quickstart
For users in the EU region, please set the OTEL endpoint to the EU version:
Run your agent
Invoke your agent by executing the script:
You can view the traces on Confident AI by clicking on the link printed in the console.
Advanced Usage
Logging threads
Threads group related traces together and are useful for chat apps, agents, or any multi-turn interactions. You can learn more about threads here. Pass the thread_id to instrument_google_adk.
Trace attributes
Other trace-level attributes can be passed to instrument_google_adk. All parameters are optional and apply to every trace produced while the instrumentation is active.
View Trace Attributes
Your Confident AI API key. Defaults to the CONFIDENT_API_KEY environment variable when omitted.
The name of the trace. Learn more.
Tags are string labels that help you group related traces. Learn more.
Attach any metadata to the trace. Learn more.
Supply the thread or conversation ID to view and evaluate conversations. Learn more.
Supply the user ID to enable user analytics. Learn more.
The turn ID for multi-turn conversations.
Associate this trace with a specific test case ID.
The name of the metric collection to use for online evals at the trace level.
The deployment environment. Accepted values: "production", "staging", "development", "testing". Defaults to "development".
Each attribute is optional, and works the same way as the native tracing features on Confident AI.
Logging prompts
If you are managing prompts on Confident AI and wish to log them, use next_llm_span to associate a Prompt with the next LLM span before invoking your agent.
Be sure to pull the prompt before logging it, otherwise the prompt will not be visible on Confident AI.
Evals Usage
Online evals
You can run online evals on your Google ADK agent, which will run evaluations on all incoming traces on Confident AI’s servers. This approach is recommended if your agent is in production.
Create metric collection
Create a metric collection on Confident AI with the metrics you wish to use to evaluate your agent.
Your metric collection should only contain metrics that evaluate the input and output of the span or trace you are targeting.
Run evals
Pass metric_collection to instrument_google_adk to evaluate every trace produced by your agent.
All incoming traces will now be evaluated using metrics from your metric collection.
You can view eval results on Confident AI by clicking on the link printed in the console.