Summary
Add record/replay support for Gemini's Interactions API — the stateful conversation endpoint at:
POST https://generativelanguage.googleapis.com/v1beta/{parent=*}/interactions
This is the Gemini equivalent of OpenAI's Responses API: the server retains conversation transcripts and callers pass previous_interaction_id to chain turns without resending history.
Docs: https://ai.google.dev/gemini-api/docs/interactions
Why
TanStack AI is shipping a geminiTextInteractions() adapter (TanStack/ai#501) that routes through this endpoint. The adapter-level unit tests are comprehensive, but the E2E suite currently has a test.skip(...) placeholder because aimock cannot record/replay this endpoint yet:
https://github.com/TanStack/ai/blob/main/testing/e2e/tests/stateful-interactions.spec.ts
Once supported here, the spec can cover the full two-turn chain:
- First call — capture the server-assigned
interactionId from the SSE response.
- Second call — send
previous_interaction_id and assert the model references context from turn 1 while the outbound request body omits prior history.
What's needed
- Recognize
POST /v1beta/**/interactions as a Gemini endpoint for fixture matching.
- Capture the SSE event stream (
interaction.start, content.start, content.delta with text / function_call / thought_summary payloads, content.stop, interaction.status_update, interaction.complete, error).
- Replay including the server-assigned
interactionId so adapters can round-trip it on the next fixture.
- Ideally respect
previous_interaction_id in fixture matching so chained turns replay distinct recorded responses.
Notes
- The endpoint is currently in Beta per Google; event/request shapes may shift.
- Scope that would cover TanStack AI's needs: text output + function tools. Built-in tools (
google_search, code_execution, etc.) and non-text output via Interactions are not yet exercised by our adapter.
Happy to provide recorded fixtures from TanStack AI's dev environment if that helps bootstrap the implementation.
Summary
Add record/replay support for Gemini's Interactions API — the stateful conversation endpoint at:
This is the Gemini equivalent of OpenAI's Responses API: the server retains conversation transcripts and callers pass
previous_interaction_idto chain turns without resending history.Docs: https://ai.google.dev/gemini-api/docs/interactions
Why
TanStack AI is shipping a
geminiTextInteractions()adapter (TanStack/ai#501) that routes through this endpoint. The adapter-level unit tests are comprehensive, but the E2E suite currently has atest.skip(...)placeholder because aimock cannot record/replay this endpoint yet:https://github.com/TanStack/ai/blob/main/testing/e2e/tests/stateful-interactions.spec.ts
Once supported here, the spec can cover the full two-turn chain:
interactionIdfrom the SSE response.previous_interaction_idand assert the model references context from turn 1 while the outbound request body omits prior history.What's needed
POST /v1beta/**/interactionsas a Gemini endpoint for fixture matching.interaction.start,content.start,content.deltawithtext/function_call/thought_summarypayloads,content.stop,interaction.status_update,interaction.complete,error).interactionIdso adapters can round-trip it on the next fixture.previous_interaction_idin fixture matching so chained turns replay distinct recorded responses.Notes
google_search,code_execution, etc.) and non-text output via Interactions are not yet exercised by our adapter.Happy to provide recorded fixtures from TanStack AI's dev environment if that helps bootstrap the implementation.