[bot] Google GenAI Multimodal Live API sessions not instrumented
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- java
- Domain
- observability-sre
Research direction
Start with braintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustApiClient.java and BraintrustInstrumentation.java, then inspect the Google GenAI client.aio.live.connect() and AsyncSession entry points. Compare the existing request instrumentation with the WebSocket-based Live API, and use BraintrustGenAITest.java as the test starting point. Done means Live API sessions and their relevant interactions produce instrumentation coverage without breaking existing generateContent tests.
Written by the indexing model from the issue text.
Description
Summary
The Google GenAI Java SDK has a stable Multimodal Live API (client.aio.live.connect() → AsyncSession) that enables real-time, bidirectional text and audio generation over WebSocket. This API surface is completely invisible to the current Braintrust instrumentation because BraintrustApiClient only wraps HTTP-based ApiClient.request() and asyncRequest() methods — WebSocket connections use an entirely separate transport that is never intercepted.
Braintrust already documents Live API tracing for Python (client.aio.live.connect() sessions and "tool calls made during Live API sessions"), but there is no equivalent Java instrumentation.
What is missing
BraintrustApiClient (the core instrumentation class, placed in the com.google.genai package to access package-private ApiClient) overrides exactly four methods:
ApiResponse request(String, String, String, Optional<HttpOptions>) // line 186
ApiResponse request(String, String, byte[], Optional<HttpOptions>) // line 210
CompletableFuture<ApiResponse> asyncRequest(String, String, String, ...) // line 239
CompletableFuture<ApiResponse> asyncRequest(String, String, byte[], ...) // line 277
The Live API is not HTTP — it uses WebSocket (WSS) via org.java_websocket.client.WebSocketClient internally. The entry point is:
client.aio.live.connect(model, LiveConnectConfig) // → CompletableFuture<AsyncSession>
AsyncSession then provides:
sendClientContent(LiveSendClientContentParameters)— sends text/content turnssendRealtimeInput(LiveSendRealtimeInputParameters)— streams real-time audio/video inputsendToolResponse(LiveSendToolResponseParameters)— responds to model tool callsreceive(Consumer<LiveServerMessage>)— registers callback for server messages
None of these are reachable via ApiClient.request(), so no spans are created for Live API sessions.
Why this is a distinct gap from #61
Issue #61 covers generateContentStream() not being instrumented (missing streaming HTTP method overrides). The Live API is fundamentally different:
- Uses WebSocket (WSS), not HTTP SSE
- Accessed via
client.aio.live, notclient.models - Supports multi-turn real-time sessions, not single request/response
- Even if #61 is fixed, Live API sessions would remain completely uninstrumented
Braintrust docs status
Braintrust docs at https://www.braintrust.dev/docs/integrations/ai-providers/gemini document Live API tracing for Python:
client.aio.live.connect()— supported (Python)- "async Live API round-trips" — supported (Python)
- "tool calls made during Live API sessions" — supported (Python)
- Java Live API: not_found — no mention in Java SDK documentation
Upstream sources
- Google GenAI Java SDK Live API: introduced in v0.3.0 (2025-03-28), stable and progressively enhanced through v1.18.0 (the version this module targets) — https://github.com/googleapis/java-genai
- Google GenAI Java SDK changelog: v0.3.0 "add types for Live API" and "Support Live API", v1.0.0 "add async support for Live API"
- Gemini Live API docs: https://ai.google.dev/api/multimodal-live — real-time, bidirectional generative execution surface for text and audio
Local files inspected
braintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustApiClient.java— lines 186–312: onlyrequest()andasyncRequest()are overridden; no WebSocket or Live API interceptionbraintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustInstrumentation.java— wrapsApiClientintoClient; noliveclient wrappingbraintrust-sdk/instrumentation/genai_1_18_0/src/test/java/dev/braintrust/instrumentation/genai/v1_18_0/BraintrustGenAITest.java— tests only sync/asyncgenerateContent; no Live API tests
- Dominant language
- Java
- Stars
- 21
- Forks
- 5
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from braintrustdata/braintrust-sdk-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
All issues in braintrustdata/braintrust-sdk-java
Similar issues
-
area/plugin
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
kestra-io/plugin-kestra#190 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/rocketmq-dashboard#5064 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
wso2/dpdp-accelerator#287 ·