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:
ApiResponserequest(String, String, String, Optional<HttpOptions>) // line 186ApiResponserequest(String, String, byte[], Optional<HttpOptions>) // line 210CompletableFuture<ApiResponse> asyncRequest(String, String, String, ...) // line 239CompletableFuture<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:
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: only request() and asyncRequest() are overridden; no WebSocket or Live API interceptionbraintrust-sdk/instrumentation/genai_1_18_0/src/main/java/com/google/genai/BraintrustInstrumentation.java — wraps ApiClient into Client; no live client wrappingbraintrust-sdk/instrumentation/genai_1_18_0/src/test/java/dev/braintrust/instrumentation/genai/v1_18_0/BraintrustGenAITest.java — tests only sync/async generateContent; no Live API tests
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 becauseBraintrustApiClientonly wraps HTTP-basedApiClient.request()andasyncRequest()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 thecom.google.genaipackage to access package-privateApiClient) overrides exactly four methods:The Live API is not HTTP — it uses WebSocket (WSS) via
org.java_websocket.client.WebSocketClientinternally. The entry point is:AsyncSessionthen 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 messagesNone 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:client.aio.live, notclient.modelsBraintrust 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)Upstream sources
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