Repository navigation
Closed
Description
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.
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:
Once supported here, the spec can cover the full two-turn chain:
- First call — capture the server-assigned
interactionIdfrom the SSE response. - Second call — send
previous_interaction_idand assert the model references context from turn 1 while the outbound request body omits prior history.
What's needed
- Recognize
POST /v1beta/**/interactionsas a Gemini endpoint for fixture matching. - Capture the SSE event stream (
interaction.start,content.start,content.deltawithtext/function_call/thought_summarypayloads,content.stop,interaction.status_update,interaction.complete,error). - Replay including the server-assigned
interactionIdso adapters can round-trip it on the next fixture. - Ideally respect
previous_interaction_idin 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.
Metadata
Metadata
Assignees
Labels
No labels
Activity
jpr5 commentedon Apr 27, 2026
@tombeckenham Can you check out #139 and let me know if this is working for you? 🙏
feat: add Gemini Interactions API handler and server wiring
jpr5 commentedon Apr 30, 2026
@tombeckenham I see your pull request mention — we good here? I got tests, but your successful usage of it is the better evaluation..
tombeckenham commentedon Apr 30, 2026
That first PR didn't have gemini interactions tests wired up. I created another draft PR on my fork which creates aimock tests that rely on this PR. There's a mismatch in the Turn interface in ai mock. Please let me know once that's fixed, and I can retest
feat: Gemini Interactions API record/replay (issue CopilotKit#136) (C…
feat: Gemini Interactions API record/replay (issue #136) (#139)