Repository navigation
feat(google-genai-live): Gemini Live instrumentor (TH-8243) - #255
Merged
Merged
Conversation
New package traceAI-google-genai-live: wraps google-genai AsyncLive.connect and the AsyncSession send_client_content / send_realtime_input / send_tool_response / receive methods (Gemini Developer API, google-genai >=2.28,<3) so one Live session is one trace: setup, user turns, model turns with model and tokens, tool calls with cancellation, interruptions, goAway, and a resume with the stored handle as a reconnect span in the same trace. Audio sessions get a parentless CONVERSATION root with call.* and conversation.transcript* so Future AGI lists them as calls; text sessions are CHAIN. Audio bytes, API keys and resumption handles never land on a span. Text content is on by default; metadata_only / TraceConfig hide_inputs / hide_outputs drop it. Vertex Live, ephemeral tokens, Live.send and Live.start_stream are not wrapped. Tests run the real SDK against a scripted socket, including frames recorded from real gemini-3.8-live sessions on 2026-10-15. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ming tests Drop the package-specific metadata_only option. Content capture now follows the standard traceAI TraceConfig convention only: text on by default; FI_HIDE_INPUTS / FI_HIDE_OUTPUTS (or TraceConfig(hide_inputs/hide_outputs)) drop a direction, and the *_MESSAGES / *_TEXT variants do the same because all Live content is message text. The example, run_e2e.sh, README and changelog use the env vars. Tests: privacy tests run through the env vars and TraceConfig; new cases for the message/text switches. The non-blocking-reader check allows half the 0.5 s export time instead of 50 ms, and the flush-once check waits for the flush thread to start, so both hold on a loaded machine. Unused imports removed from test_fence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nik13
marked this pull request as ready for review
October 21, 2026 22:19
Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
traceAI-google-genai-liveinpython/frameworks/google-genai-live/for Gemini Live sessions opened by a customer's Python process using the official SDK'sclient.aio.live.connect(...)on the Gemini Developer API. TH-8243, parent TH-8103. Companion docs: future-agi/docs#938.AsyncLive.connectandAsyncSession.send_client_content,send_realtime_input,send_tool_response, andreceive. Does not wrap deprecatedsend/start_stream, ordinary generation, LiveKit or Pipecat.TraceConfig/FI_HIDE_*controls, not a package-specific metadata-only flag. Raw error text requires both content directions enabled. API keys, raw audio, resumption handles and stacktraces are excluded; connection URL is path only.Exact-head acceptance — 2026-10-28
PASS at
341d22b11e0ebae838793341a7ed62049a6a124c. Currentdevwas merged into the PR normally; no integration code changes were needed for this refresh.Endpoint: native Gemini Developer API WebSocket,
wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent. This run used neither CLIProxy nor Vertex. The model list was fetched with the temporary key, andgemini-2.5-flash-native-audio-latestwas selected from models advertisingbidiGenerateContent.Consumer build: wheel built from this exact head and installed into a fresh Python 3.12.10 environment with
google-genai==2.31.0, publishedfi-instrumentation-otel==1.1.0, OpenTelemetry SDK 1.45.1 and websockets 16.1.1. The README'sexamples/voice_tool.pywas copied unchanged into the consumer project and run with the selected model: one short typed weather question, a realget_weatherfunction call/response, and an audio answer with output transcription. No audio file was saved or exported.3d61a5a7-8f7c-4814-83b5-c1fa371a0f50FI_HIDE_INPUTSandFI_HIDE_OUTPUTSdd7f9509-8825-4688-a416-6c5a0a20a05aFI_HIDE_INPUTSalone05f0e85f-25c8-41b0-ac4f-31b0418cee8aFI_HIDE_OUTPUTSalone8065533d-c198-472e-a65d-78ff3e18a57dd97ab816-5deb-46e1-9815-f2a58cb0af3esetup_rejected, no invented turns or token counts711c7751-9a23-493b-8864-d42e88ba5f60Direct export to Future AGI Cloud and read-back verified all six traces: unique span IDs, correct parent relationships, requested model, positive API-reported LLM usage, transcript/tool content in default mode, directional privacy and real setup errors. Default-session LLM usage was 538 prompt / 59 response tokens, matching the server's latest usage metadata. The actual temporary Gemini key and both FI key values were absent from every retrieved payload, as were local paths, stacktraces and raw audio.
A single key restricted to
generativelanguage.googleapis.comwas created infagi-omega-stagingfor both Gemini integration tests, then deleted and verified absent from active keys.generativelanguage.googleapis.comandapikeys.googleapis.comwere both restored to their original disabled states. The earlier CLIProxy Live-route blocker is superseded for acceptance by these successful native Developer API sessions.Tests and CI
package (google-genai-live).Supported surface and limits
google-genai>=2.28,<3; this refresh used 2.31.0. Python range is>=3.10,<3.14, matching the FI instrumentation dependency.@google/genai, google-genai 3.x, deprecated send methods and audio-recording attachments are outside scope.goAwayand resumption are covered by the package's scripted-SDK test suite; this native refresh exercised short clean sessions and rejected setup.call.talk_ratiois omitted unless both speech durations are measured. The typed-input sessions in this refresh do not claim a user-audio timing ratio.Remaining acceptance blockers: none. This refresh does not merge the PR.
🤖 Generated with Claude Code