-
Notifications
You must be signed in to change notification settings - Fork 1
[BOT ISSUE] Google GenAI: Interactions API not instrumented #198
Description
Summary
The Google GenAI Interactions API (client.interactions.*) is not instrumented. This is a publicly documented Beta API (available since google-genai SDK v1.55.0) that provides a unified interface for agentic applications with server-managed conversation state, background execution, and tool orchestration.
The Interactions API is distinct from the Live API tracked in #125. The Live API is WebSocket-based real-time bidirectional streaming; the Interactions API is a request/response API for server-managed agentic conversations where the server handles conversation history, tool execution, and multi-turn state.
What is missing
The following client.interactions.* methods produce zero Braintrust tracing:
| Method | Description |
|---|---|
client.interactions.create() |
Create and execute an interaction (the primary inference call) |
client.interactions.get() |
Retrieve a completed interaction |
client.interactions.cancel() |
Cancel an in-progress interaction |
client.interactions.delete() |
Delete an interaction |
At minimum, interactions.create() should be instrumented with:
- Interaction-level span: Capturing model config, input content, output content, token usage, and duration
- Tool use spans: The Interactions API supports function calling, Google Search grounding, code execution, and MCP tools — tool calls and results should appear as nested spans
- Multi-turn linkage: The API uses
previous_interaction_idfor server-side conversation state management; this relationship should be captured in span metadata to enable trace-level visibility into multi-turn conversations
Key distinguishing features from generate_content
- Server manages conversation state via
previous_interaction_id(no client-side history resending) - Supports long-running/background execution (e.g., Deep Research agent)
- Supports streaming via the same
create()call - Has its own content types (
ToolCallContent,GoogleMapsContent, etc.) - Returns interaction status (
COMPLETE,INCOMPLETE, etc.)
Current instrumentation coverage
| Google GenAI Method | Instrumented? |
|---|---|
models.generate_content() |
Yes |
models.generate_content_stream() |
Yes |
models.embed_content() |
Yes |
models.generate_images() |
Yes |
aio.live.connect() |
No (#125) |
interactions.create() |
No |
interactions.get() |
No |
Braintrust docs status
not_found — the Gemini integration page documents generate_content, streaming, function calling, structured outputs, thinking tokens, context caching, and grounding, but does not mention the Interactions API.
Upstream sources
- Interactions API documentation: https://ai.google.dev/gemini-api/docs/interactions
google-genaiPython SDK on PyPI (v1.70.0): https://pypi.org/project/google-genai/- SDK GitHub repository: https://github.com/googleapis/python-genai
- API entry points:
client.interactions.create(),.get(),.cancel(),.delete() - Available since SDK v1.55.0, currently labeled Beta
Local files inspected
py/src/braintrust/integrations/google_genai/patchers.py— defines 8 patchers (4 sync + 4 async) forgenerate_content,generate_content_stream,embed_content,generate_images; zero references tointeractionspy/src/braintrust/integrations/google_genai/tracing.py— wrapper functions for the 4 patched method families; nointeractionswrapperpy/src/braintrust/integrations/google_genai/integration.py— integration class registers the 8 patchers; no interactions patcherpy/src/braintrust/integrations/google_genai/test_google_genai.py— no interactions test casespy/noxfile.py—test_google_genai(latest)session exists but does not test interactions