Skip to main content
Google ADK for Java is the JVM port of Google’s Agent Development Kit — a framework for building agents with Gemini models, function tools, and multi-agent workflows. ADK already emits its own OpenTelemetry spans; the com.arize:openinference-instrumentation-adk-java Java agent decorates them in place with OpenInference span kinds, prompts and completions, tool arguments and results, token counts, and session and user IDs. Your agent code stays untouched — the only application-side change is registering a global OpenTelemetry SDK that points at Arize AX.

Prerequisites

  • Java 17+ (Google ADK for Java is compiled to Java 17 bytecode) and Gradle 8+
  • An Arize AX account (sign up)
  • A GOOGLE_API_KEY from Google AI Studio

Launch Arize AX

  1. Sign in to your Arize AX account.
  2. From Space Settings, copy your Space ID and API Key. You will set them as ARIZE_SPACE_ID and ARIZE_API_KEY below.

Install

The instrumentation is a -javaagent, not a library, so it is never on your compile classpath. Resolve the shaded all jar into its own Gradle configuration and hand it to the JVM at launch:

Configure credentials

Setup tracing

Java doesn’t separate setup from runtime the way Python or TypeScript do — both happen in the same main method. Register the OpenTelemetry SDK first, then build your ADK objects:
Note that Main never imports an OpenInference class. The agent rewrites ADK’s own telemetry methods at JVM startup, so instrumentation is entirely a launch-time concern.

Run Google ADK

To launch outside Gradle, download the shaded jar from Maven Central once and pass it to the JVM yourself:

Expected output

Verify in Arize AX

  1. Open your Arize AX space and select project google-adk-java-tracing-example.
  2. You should see a new trace within ~30–60 seconds (Arize’s Java OTLP ingest is slightly slower than the Python path) rooted at an invocation chain span carrying session.id, user.id, and agent.name, with an agent_run [weather_agent] agent span, two call_llm LLM spans (the tool-call turn and the final answer, each with llm.model_name, llm.provider, messages, tool schemas, and token counts), and a tool_call [getWeather] tool span holding the tool arguments and result.
  3. If no traces appear, see Troubleshooting.

Check from the skill, CLI, or SDK

Confirm spans are actually reaching your Arize AX project. Use whichever fits your workflow — the skill and CLI work for any framework; the SDK check is shown for each language.
Install the Arize Skills plugin and let your coding agent check for you:
Then prompt your agent:
Use the arize-trace skill to export and analyze recent traces from my project. Confirm spans are arriving, and summarize any errors or latency issues.

Troubleshooting

  • No traces in Arize AX. Confirm ARIZE_SPACE_ID and ARIZE_API_KEY are set in the same shell that runs gradle run. The OTLP exporter logs at FINE level — to surface delivery errors, add java.util.logging.Logger.getLogger("io.opentelemetry").setLevel(Level.FINE) before initialization, or wire an SLF4J implementation. To confirm spans are being produced locally before troubleshooting export, add SimpleSpanProcessor.create(LoggingSpanExporter.create()) as an extra processor — it prints every span to stderr.
  • No OpenInference ADK instrumentation installed line at startup. The -javaagent never reached the JVM. Under Gradle, check that tasks.named('run') sets jvmArgs and that configurations.openinferenceAgent resolves — gradle dependencies --configuration openinferenceAgent should list exactly one jar.
  • Agent installed, but spans have no OpenInference attributes. You are on an unsupported ADK version. The agent advises com.google.adk.Telemetry, which ADK renamed to com.google.adk.telemetry.Tracing in 0.6.0; pin com.google.adk:google-adk to 0.5.0 or lower. The warning OpenInference ADK instrumentation failed to transform ... in the log confirms a matcher mismatch.
  • Spans appear, but prompts and responses are empty. Your application touched an ADK class before buildAndRegisterGlobal() ran, so ADK captured a no-op GlobalOpenTelemetry. Move every ADK construction call after the tracer registration, including static initializers and dependency-injection graphs that build LlmAgent eagerly.
  • 401/403 from Google. Verify GOOGLE_API_KEY is set and enabled for gemini-2.5-flash. If both GOOGLE_API_KEY and GEMINI_API_KEY are set, ADK logs a warning and uses GOOGLE_API_KEY.
  • Spans dropped at JVM exit. BatchSpanProcessor exports asynchronously. Always tracerProvider.forceFlush().join(...) and tracerProvider.shutdown().join(...) before main returns. For a long-running service, register a JVM shutdown hook instead.
  • SLF4J(W): No SLF4J providers were found. Harmless, but it also hides the agent’s own install log line. Add runtimeOnly 'org.slf4j:slf4j-simple:2.0.17' to build.gradle to see it.

Resources

Google ADK for Java

OpenInference ADK Java Agent (Maven Central)

OpenInference ADK Java Source

Runnable ADK Java Example

Google ADK for Python