Skip to content

feat(google-adk): add ADK instrumentation and e2e coverage#1765

Open
Abhijeet Prasad (AbhiPrasad) wants to merge 3 commits intomainfrom
feat/google-adk-instrumentation
Open

feat(google-adk): add ADK instrumentation and e2e coverage#1765
Abhijeet Prasad (AbhiPrasad) wants to merge 3 commits intomainfrom
feat/google-adk-instrumentation

Conversation

@AbhiPrasad
Copy link
Copy Markdown
Member

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) commented Apr 9, 2026

resolves #1477

Add Braintrust instrumentation for @google/adk with auto-instrumentation support by default when users run with Braintrust's loader hook.

This adds tracing for:

  • Runner.runAsync
  • BaseAgent.runAsync and subclasses
  • FunctionTool.runAsync

It also adds Google ADK e2e coverage for both hook-driven and wrapped execution.

Because ADK uses @google/genai under the hood, underlying LLM spans continue to come from the existing Google GenAI instrumentation.

Recommended usage: auto-instrumentation

The primary way users should adopt this is via Braintrust auto-instrumentation:

node --import braintrust/hook.mjs app.mjs

Then they can use @google/adk normally and Braintrust will trace supported ADK operations automatically.

Example:

import * as adk from "@google/adk";
import { initLogger } from "braintrust";

initLogger({ projectName: "my-google-adk-app" });

const agent = new adk.LlmAgent({
  name: "weather_agent",
  model: "gemini-2.5-flash-lite",
  instruction: "Answer weather questions",
});

const runner = new adk.InMemoryRunner({ agent, appName: "weather-app" });

await runner.sessionService.createSession({
  appName: runner.appName,
  userId: "user-1",
  sessionId: "session-1",
});

for await (const event of runner.runAsync({
  userId: "user-1",
  sessionId: "session-1",
  newMessage: {
    role: "user",
    parts: [{ text: "What's the weather in Paris?" }],
  },
})) {
  console.log(event);
}

If needed, it can be disabled with:

BRAINTRUST_DISABLE_INSTRUMENTATION=google-adk node --import braintrust/hook.mjs app.mjs

Manual usage

Manual wrapping is also available for cases where users want explicit control:

import * as adk from "@google/adk";
import { wrapGoogleADK } from "braintrust";

const wrapped = wrapGoogleADK(adk);

Screenshot

image

@AbhiPrasad
Copy link
Copy Markdown
Member Author

wait this need some more work. I realized the parent child relationships are wrong 😢

@lforst
Copy link
Copy Markdown
Member

wait this need some more work. I realized the parent child relationships are wrong 😢

I honestly don't know why this is so painful in this SDK. Tracing channels make it harder because they are event based. It should honestly just be a simple wrapping call imo.

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) force-pushed the feat/google-adk-instrumentation branch 2 times, most recently from 45ea59e to 19c40c1 Compare April 13, 2026 14:11
Add manual and load-time instrumentation for `@google/adk` across runner,
agent, and tool execution. This introduces the wrapper entrypoint,
tracing-channel plugin, vendored SDK types, exports, and loader config needed
to emit Braintrust spans for Google ADK workflows.

Add a dedicated Google ADK e2e scenario with a committed lockfile and stable
snapshots for both wrapped and hook-driven execution.

Stabilize the scenario by pre-creating ADK sessions, letting the loader hook
respect `BRAINTRUST_DISABLE_INSTRUMENTATION`, and normalizing volatile outputs
in the assertions so the coverage stays repeatable.
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) force-pushed the feat/google-adk-instrumentation branch from 19c40c1 to d4ef367 Compare April 13, 2026 14:11
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) marked this pull request as ready for review April 13, 2026 14:11
@AbhiPrasad
Copy link
Copy Markdown
Member Author

Okay fixed the parent-child relationships! This is good to review now.

@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 13, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednext@​15.5.15 ⏵ 14.2.3482 +2070 -3095 +450 -4670
Updated@​ai-sdk/​openai@​3.0.52 ⏵ 1.3.2471 -110085 -398100
Updated@​ai-sdk/​openai@​3.0.52 ⏵ 2.0.5371 -110085 -398100
Updated@​opentelemetry/​exporter-trace-otlp-http@​0.53.0 ⏵ 0.200.07310010094100
Updated@​opentelemetry/​exporter-trace-otlp-http@​0.53.0 ⏵ 0.205.07310010094100
Updated@​opentelemetry/​context-async-hooks@​1.26.0 ⏵ 2.6.17410083 -493100
Addedopenai@​5.23.274100100100100
Added@​vercel/​otel@​0.1.01001007599100
Addedcohere-ai@​7.21.07510010093100
Addedcohere-ai@​8.0.07510010095100
Added@​types/​react-dom@​18.3.71001007686100
Added@​braintrust/​otel@​0.1.27710010088100
Updated@​opentelemetry/​sdk-trace-base@​1.26.0 ⏵ 2.0.078 +110010093100
Addedcohere-ai@​7.20.08210010088100
Updated@​ai-sdk/​openai@​3.0.52 ⏵ 0.0.62100 +2810083 -597 -1100
Updated@​opentelemetry/​otlp-exporter-base@​0.53.0 ⏵ 0.205.0100 +110084 -194100
Updatedreact@​19.2.5 ⏵ 18.3.110010084 +197100
Updated@​opentelemetry/​otlp-exporter-base@​0.53.0 ⏵ 0.35.0100 +11008591 -3100
Updated@​ai-sdk/​openai@​3.0.52 ⏵ 2.0.57100 +2810085 -398100
Updated@​ai-sdk/​openai@​3.0.52 ⏵ 3.0.799 +2710086 -298100
Updated@​opentelemetry/​otlp-transformer@​0.53.0 ⏵ 0.35.0100 +110087 -391 -3100
Added@​vercel/​otel@​2.1.0991009787100
Updated@​opentelemetry/​context-async-hooks@​1.26.0 ⏵ 1.9.0100 +2710088 +188 -5100
Updated@​opentelemetry/​sdk-trace-base@​1.26.0 ⏵ 1.9.0100 +2210010088 -5100
Addedzod@​4.1.1110010010088100
Updatedai@​6.0.159 ⏵ 5.0.7689 -1010010099100
Addedtypescript@​5.4.4100100909990
Updatedbraintrust@​2.2.2 ⏵ 2.2.1-rc.090 +11009097100
Updated@​opentelemetry/​exporter-trace-otlp-http@​0.53.0 ⏵ 0.35.099 +2610010091 -3100
Updatedreact-dom@​19.2.5 ⏵ 18.3.192 -71009298100
Updatedai@​6.0.159 ⏵ 6.0.192 -810010099100
Addedcohere-ai@​7.14.09710010093100
See 15 more rows in the dashboard

View full report

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) force-pushed the feat/google-adk-instrumentation branch from d4ef367 to 4739528 Compare April 13, 2026 16:07
@lforst Luca Forstner (lforst) force-pushed the feat/google-adk-instrumentation branch from 4739528 to 3ae014b Compare April 13, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integration for Google Agent Development Kit (ADK) for TypeScript

2 participants