Setup
Install the Braintrust and@google/adk packages, then set your API keys. Auto-instrumentation supports @google/adk v0.6.1 to v0.6.x and v1.0.0 to v1.x. Versions v0.7.0 through v0.9.x aren’t supported.1
Install packages
2
Set environment variables
.env
Auto-instrumentation
To trace ADK agents without modifying your application code, initialize Braintrust normally, then run your app with Braintrust’s import hook to patch the ADK SDK at runtime.1
Initialize Braintrust and call ADK
2
Run with the import hook
node --import can run the file directly. The Braintrust APIs work the same in TypeScript projects — compile your TypeScript to JavaScript, then run the compiled file with the import hook.If you’re using a bundler, see Trace LLM calls for plugin and loader setup.
Manual instrumentation
To trace the ADK module manually, wrap it yourself withwrapGoogleADK() and destructure the wrapped classes from the result.Manual instrumentation traces runner, agent, and tool spans, but not LLM call spans. ADK constructs its model client internally, so user-side wrapping cannot intercept the underlying model calls. To capture LLM spans, use auto-instrumentation instead.
What Braintrust traces
Braintrust captures:- Runner execution as a task span, with the new message as input, the final event as output, and the user and session IDs in metadata
- Agent invocations as task spans nested under the runner, with the agent name and model in metadata
- Tool calls as tool spans nested under the agent, with arguments as input, the result as output, and the tool name plus call ID in metadata
- Token usage (prompt, completion, total, cached, and reasoning tokens) aggregated across the run on the runner span
- LLM calls inside ADK as nested LLM spans, traced via Braintrust’s Google GenAI integration since ADK uses Google GenAI internally for model calls