openinference

OpenInference Instrumentation for Google ADK Java

A Java agent (-javaagent) that decorates the OpenTelemetry spans created by Google ADK for Java with OpenInference attributes:

The complete span coverage above is currently tested against ADK 0.4.0 (com.google.adk.Telemetry). The additional compatibility work only enriches call_llm spans for the observed com.google.adk.telemetry.Tracing.traceCallLlm signatures in ADK 0.6.0, 0.9.0, 1.0.0, and 1.10.1. It does not provide complete invocation, agent, or tool compatibility for ADK 0.6+.

Usage

Build or download the fat -all jar and pass it to the JVM. The application must register a global OpenTelemetry SDK before its first ADK call; ADK’s Telemetry or Tracing class captures GlobalOpenTelemetry when it is loaded, depending on the ADK version.

./gradlew :instrumentation:openinference-instrumentation-adk-java:shadowJar
java -javaagent:openinference-instrumentation-adk-java-<version>-all.jar -cp <classpath> com.example.Main

Tracing can be suppressed with SuppressTracing.begin() and sensitive fields masked through TraceConfig (register an OITracer with OpenInferenceAgent.register(...)), as with the other OpenInference Java instrumentors.

Examples

See java/examples/adk-java-example for a runnable agent with a function tool that exports to a local Phoenix.