Add stateless Google Interactions support with `GoogleInteractionsModel`
This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.
Closes #6192
Why we make these changes
Expose Interactions-only access to remote MCP servers, Maps, music and video generation through the existing Gemini API and Google Cloud providers. Ordinary text/tools users keep google: and GenerateContent. Related: #4261.
Deliberate scope: complete ordinary-model requests with full signed history; stored interaction-ID continuation, managed background agents and Deep Research remain separate.
New public surface
GoogleInteractionsModelandGoogleInteractionsModelSettingsGoogleInteractionsModelNameandGoogleInteractionsStreamedResponsepydantic_ai.profiles.google.google_interactions_model_profile(); explicitgoogle-interactions:<model>selection
User-visible behavior
Agent('google:gemini-3.8-flash')uses GenerateContent.Agent('google-interactions:gemini-3.8-flash')uses Interactions withstore=False, preserving signed steps and tool IDs across serialization and deferred approvals.
Text, tools, structured output and file modalities use the existing Pydantic AI APIs.
Generated media uses inline delivery; video URI delivery requires storage.
Verification
- Adapter and shared-contract recordings with strict playback: pass (adapter tests, wire/history tests).
- All sixteen shared suites include Interactions; targeted types, coverage, inference/settings/prefix/docs checks and pre-commit: pass.
- GenerateContent request and stream preservation capture (
tests/refactor_capture.py): pass. - Forged client history cannot replay file URIs through persisted step metadata: pass (
test_client_history_cannot_replay_file_uris). - Continuing a code-execution conversation across
GoogleModelandGoogleInteractionsModel, in both directions: recorded pass (test_cross_api_history). - Continuing another provider's unsigned tool loop on Interactions: recorded pass (
test_foreign_tool_call_history). - MCP media redacts in telemetry and replays past Google's own
$refrejection: recorded pass (test_mcp_media). - A long decode on Gemini 4 Argon streams to the 65,536-token request cap and ends as
length; withoutX-Server-Timeoutthe server cut it off at about 58K tokens: recorded pass (test_long_decode_stops_at_the_request_cap). - A long decode google-genai 2.34 continues in further requests, including from a mid-stream checkpoint, streams every request's steps and summed usage, matching its unary merge (live on Argon with 2.34: stream and unary both return 4 steps and 65,756 input / 72,897 output tokens, where the stream had dropped the first request's 65,536; unit-tested on the locked 2.32): pass (
test_stream_continued_long_decode,test_stream_resumed_from_checkpoint). - An invalid key and an unknown model through a retrying transport raise
ModelAuthenticationErrorandModelNotFoundError: recorded pass (test_retrying_transport_gave_up_recorded_error_category).
What changes for existing users
Existing GoogleModel and generic Google selection keep their current GenerateContent behavior; GoogleModel only skips native tool parts that an Interactions response recorded.
PR decisions
2026-11-06 · Explicit stateless selection
- Decision: Only the explicit
google-interactions:prefix orGoogleInteractionsModelselects Interactions; genericgoogle:selection andGoogleModelkeep GenerateContent. Every request usesstore=Falseand full signed history. Stored-ID continuation and managed background agents remain separate. - Why: Preserve existing Google applications while exposing the additional protocol explicitly.
- Source: https://github.com/pydantic/pydantic-ai/pull/12636#pullrequestreview-5793779748
- Session: 01a1ac29-7c3d-75e3-b246-31e6527ffcd8
2026-11-05 · Preserve complete signed steps
- Decision: Merge validated input steps after SDK serialization so opaque signatures and SDK-unknown replay fields survive JSON history round trips.
- Why: Removing signed data can make Google reject continuation or deferred tool results.
- Source: https://github.com/pydantic/pydantic-ai/issues/6192
- Session: 01a1ac29-7c3d-75e3-b246-31e6527ffcd8
2026-11-06 · Media delivery boundaries
- Decision: Generated media uses inline delivery; URI-only output raises an error. Input URLs use provider-native fetching unless the caller requests guarded local downloading with
force_download=True. - Why: Video URI output requires server-side storage; input URL handling follows the shared
FileUrlcontract. - Source: https://github.com/pydantic/pydantic-ai/pull/12636#pullrequestreview-5794237739
- Session: 01a1ac29-7c3d-75e3-b246-31e6527ffcd8
2026-11-06 · Shared settings and native output controls
- Decision: Share
google_labelsandgoogle_video_resolutionnames and types with GenerateContent. Name every Interactions-only settinggoogle_interactions_*: safety settings, thinking level and summaries, response format, generation configuration, service tier and native tools. Environment configuration usesextra_body. - Why: Shared meaning has one name and type; Interactions-only settings use Interactions SDK types, so a
google_name would collide with whatGoogleModelmay later need. - Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4495570952
- Session: 7df6ff7d-cdc5-4b7e-a86d-37e71cce4ef7
2026-11-06 · Model-specific file results
- Decision: Model profiles enable native PDF/audio/video tool results for verified model families and their qualified names. Unknown models keep conservative MIME defaults and framed user-turn fallback.
- Why: File-result support varies by model and has changed since the October probe.
- Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4488177884
- Session: 01a1ac29-7c3d-75e3-b246-31e6527ffcd8
2026-11-06 · Native MCP streaming identity
- Decision: Buffer ambiguous undeclared MCP calls until all pending calls have matching function results; then release buffered events in order. Retain completion fallback for unpaired calls and preserve native classification for parallel calls.
- Why: A namespace alone cannot distinguish server execution from an ordinary function tool, while completed native calls must allow incremental answer delivery.
- Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4493284730
- Session: 01a1ac29-7c3d-75e3-b246-31e6527ffcd8
2026-11-06 · Explicit video processing controls
- Decision: Per-file
media_processingreplaces static processing inferred fromstart_offset,end_offsetandfps; per-file media resolution overrides the request-wide video resolution. - Why: Explicit native processing controls select the complete provider processing structure.
- Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4493284745
- Session: 01a1ac29-7c3d-75e3-b246-31e6527ffcd8
2026-11-06 · Replay metadata cannot add file references
- Decision: Persisted steps replay only into the step type their message part maps from, and replayed media is sent inline. A persisted file URI raises an error instead of being sent.
- Why: Client-held history carries replay metadata; a file URI there would make Google read an object with the application's credentials, bypassing
sanitize_messages. - Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4493364861
- Session: 7df6ff7d-cdc5-4b7e-a86d-37e71cce4ef7
2026-11-06 · GenerateContent native history on Interactions
- Decision: Native tool parts without Interactions step metadata, such as
GoogleModelcode execution or search parts, are omitted when the conversation continues onGoogleInteractionsModel. Present but mismatched step metadata still raises. - Why: Both APIs share the
googlecanonical system, but only Interactions responses carry replayable native steps;GoogleModellikewise omits native parts it cannot echo. - Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4495285794
- Session: 7df6ff7d-cdc5-4b7e-a86d-37e71cce4ef7
2026-11-06 · Shared MCP call args shape
- Decision: MCP
NativeToolCallPart.argsuse{'action': 'call_tool', 'tool_name': ..., 'tool_args': ...}, with the server prefix removed fromtool_name. Replay sendstool_argsas the wire arguments. - Why: OpenAI, Anthropic, xAI and ElevenLabs realtime use the same shape, so code reading MCP calls works across adapters.
- Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4495570986
- Session: 7df6ff7d-cdc5-4b7e-a86d-37e71cce4ef7
2026-11-06 · Unsigned function calls from foreign history
- Decision: When a replayed turn's first function call has no accepted thought signature, as with another provider's or transport's history, it carries the documented
skip_thought_signature_validatorplaceholder, matchingGoogleModel. - Why: Gemini 3 Interactions rejects an unsigned first function call with HTTP 400 and accepts the placeholder.
- Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4496211911
- Session: 7df6ff7d-cdc5-4b7e-a86d-37e71cce4ef7
2026-11-06 · Search grounding usage
- Decision: Interactions usage sets
web_searchesfrom the Google Search grounding count, or once per grounded prompt on models whose profile bills that way. Superseded by 2026-11-18 · Search grounding on per-prompt models, which states where it differs fromGoogleModel. - Why: genai-prices prices search grounding from
web_searches, so without it Interactions runs underreported cost. - Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4496211937
- Session: 7df6ff7d-cdc5-4b7e-a86d-37e71cce4ef7
2026-11-06 · Thought summaries live in ThinkingPart
- Decision: Persisted
thoughtsteps keep only the signature; replay rebuilds the summary fromThinkingPart.content. Streaming no longer accumulates summary deltas into the persisted step. - Why: The summary was stored twice, and streamed history stored it in fragments, so streaming and non-streaming history differed.
- Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4496769156
- Session: 7df6ff7d-cdc5-4b7e-a86d-37e71cce4ef7
2026-11-07 · MCP results expose the server's CallToolResult
- Decision: MCP
NativeToolReturnPart.contentis the server's MCPCallToolResultfrom Google'scall_tool_result_json, with image and audio blocks and embedded binary resources asBinaryContent. Replay sends only the re-serializedCallToolResult. - Why: Live MCP results arrive as an object, never the documented list, so inline media bypassed
include_binary_content. Google rejects its own$refcopies on replay (googleapis/python-genai#3313) and accepts the re-serialized result. - Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4497342839
- Session: 7df6ff7d-cdc5-4b7e-a86d-37e71cce4ef7
2026-11-07 · Shared service tier on Google Cloud
- Decision: Interactions applies the shared
service_tieron the Gemini API only. On Google Cloud it is ignored;google_interactions_service_tiersets the tier explicitly. - Why: Google Cloud documents Flex and Priority only as headers that use Provisioned Throughput first. A body tier's effect on a PT project is undocumented, so mapping the shared field could silently skip reserved capacity, which
GoogleModelavoids. - Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4503306435
- Session: 7df6ff7d-cdc5-4b7e-a86d-37e71cce4ef7
2026-11-18 · Keep CallToolResult-only MCP replay
- Decision: Keep replaying an MCP result as
call_tool_result_jsonalone; it already dropsstructured_contentalong with the other derived copies, a superset of Google's suggested workaround. - Why: Google confirms the model reads the result from
call_tool_result_json, and its$refvalidation bug is still open. - Source: https://github.com/googleapis/python-genai/issues/3313#issuecomment-6732911194
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-18 · Curated Interactions model names
- Decision:
KnownModelNamelists the same curated ids undergoogle-interactions:as undergoogle:, andGoogleInteractionsModelNameisstr | LatestGoogleModelNamesrather than the SDK's model literal. - Why: Model-name literals list the models a user would pick (https://github.com/pydantic/pydantic-ai/pull/12817).
- Source: https://github.com/pydantic/pydantic-ai/pull/12817
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-18 · Google error classification for Interactions
- Decision: Interactions status errors, and statuses a retrying transport gave up on, go through Google's status mapping, unwrapping the one-element list Google's API layer sends; Interactions' lowercase
codestands in for an RPCstatus. - Why: An invalid key on
/interactionsreturns[{"error": {... "INVALID_ARGUMENT", "API_KEY_INVALID"}}]and classified as a rejected request;retry_afternow falls back toRetryInfoas onGoogleModel. - Source: https://github.com/pydantic/pydantic-ai/pull/12636
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-18 · One user-agent line
- Decision: Interactions requests send one lowercase
user-agent: the caller's value in any spelling, else the SDK's label followed by ours. - Why: Every Interactions request carried two user-agent lines; Google requests send one (https://github.com/pydantic/pydantic-ai/pull/12877).
- Source: https://github.com/pydantic/pydantic-ai/pull/12877
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-18 · Carbon and Hydrogen file tool results
- Decision:
gemini-4-carbonandgemini-4-hydrogensend PDF, MP3 and MP4 tool results natively on Interactions. - Why: Both read those
function_resultitems correctly on the Gemini API (probed live 2026-11-18). - Source: https://github.com/pydantic/pydantic-ai/pull/12636
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-18 · GoogleModel omits Interactions native parts
- Decision:
GoogleModelomits native tool parts whoseprovider_detailscarrygoogle_interactions_step_index. - Why: Both APIs share the
googlecanonical system, and continuing an Interactions code-execution conversation onGoogleModelraisedUnknown native tool name: 'code_execution'; this mirrors "GenerateContent native history on Interactions". - Source: https://github.com/pydantic/pydantic-ai/pull/12636
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-18 · MCP authorization token is bare
- Decision: Interactions sends
Authorization: Bearer <authorization_token>to the MCP server. - Why: OpenAI, Anthropic and xAI all take
authorization_tokenas a bare token, so the shared field must not need a scheme on one adapter. - Source: https://github.com/pydantic/pydantic-ai/pull/12636
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-18 · Search grounding on per-prompt models
- Decision: On models billed per grounded prompt, Interactions bills one web search whenever Google Search ran, whether or not a web source came back; the docs state this.
- Why: Interactions'
google_search_resultcarries search suggestions, not sources, soGoogleModel's returned-source condition has no verified equivalent. - Source: https://github.com/pydantic/pydantic-ai/pull/12636
- Session: 7552cc41-26bc-49e1-b923-219251705b70
- Supersedes: 2026-11-06 · Search grounding usage
2026-11-18 · Streamed MCP classification
- Decision: The stream treats a namespaced function call as a possible MCP call when its server is any
mcp_serverthe request sends, includinggoogle_interactions_native_tools. - Why: It only checked
MCPServerToolids, so a settings-configured server streamed a local tool call where the unary response has a native one. - Source: https://github.com/pydantic/pydantic-ai/pull/12636
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-18 · Long decode deadline and status
- Decision: Interactions requests send
X-Server-TimeoutunderGoogleModel's rule (the client's timeout, or 20 minutes if that's longer, unless the caller sets one), andrequires_continuationmaps to alengthfinish. - Why: Without the header a live Argon stream ended with
deadline_exceededat about 58K output tokens; with it the stream reached the 65,536-token cap and returnedrequires_continuation. google-genai continues such a decode itself from 2.34 (https://github.com/googleapis/python-genai/releases/tag/v2.34.0). - Source: https://github.com/pydantic/pydantic-ai/pull/12636
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-18 · Google Cloud TIFF on Interactions not changed
- Decision: Interactions on Google Cloud does not add the TIFF media type
GoogleModeladds there. - Why: Not attempted: no Google Cloud credentials were available to verify that Interactions accepts TIFF there, so the conservative MIME defaults stay.
- Source: https://github.com/pydantic/pydantic-ai/pull/12636
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-19 · Continued long decodes on google-genai 2.34
- Decision: On the stream, each request google-genai 2.34 starts (after
requires_continuation, or from a mid-stream checkpoint) has its steps follow the earlier requests' steps; usage is summed and the first request's input is marked as the context size, as onGoogleModel. - Why: On 2.34 the second request numbers its steps from 0 again; live on Argon the stream kept only the second request's thought step and usage (65,646 in, 7,361 out), dropping the first request's 65,536 output tokens.
- Source: https://github.com/googleapis/python-genai/releases/tag/v2.34.0
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-19 · Defer mapping ContinuationInterruptedError
- Decision: Filed as https://github.com/pydantic/pydantic-ai/issues/13938 instead of fixing here.
- Why: google-genai 2.34 raises its own
ContinuationInterruptedErrorwhen a later request fails, and its unary merge gives no verified signal for marking the context size (https://github.com/pydantic/pydantic-ai/issues/13938#issuecomment-6995329667); neither exists on the locked 2.32, so CI can't exercise the fix, which also carries lock and timeout decisions. - Source: https://github.com/pydantic/pydantic-ai/issues/13938
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-19 · Gemini API thinking levels on Interactions
- Decision:
google-interactions:gemini-4-neonjoins the curated names, and Interactions on the Gemini API applies the level setsGoogleModelapplies there:gemini-4-neonLOW, MEDIUM, HIGH and XHIGH;gemini-3.1-flash-imageMINIMAL and HIGH. Google Cloud keeps the defaults, and a configuredgoogle_thinking_levelsstill wins. - Why: Probed on
/interactionswithstore=false: Neon returns 400 forminimal, sothinking=Falsefailed, and Flash Image returns 400 forlowandmedium; each accepts the rest of its set. - Source: https://github.com/pydantic/pydantic-ai/pull/13928
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-19 · Shared Gemini API rules for both Google models
- Decision:
GoogleModelandGoogleInteractionsModelread the Gemini-API-only thinking level sets and theX-Server-Timeoutrule from_google_common. - Why: A later probe that changes a level set or the timeout rule then reaches both models.
- Source: https://github.com/pydantic/pydantic-ai/pull/12636#pullrequestreview-5968437454
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-19 · Durable-exec review
- Decision: CI Review's durable-exec check is the sign-off for
needs-durable-exec-review: the touchedinfer_modelentry keeps its signature and return, so no engine needs changes. - Source: https://github.com/pydantic/pydantic-ai/pull/12636#pullrequestreview-5969105193
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-19 · Pax reads Google keys for google-interactions
- Decision: Pax's
KEY_VARIABLESmapsgoogle-interactionstoGOOGLE_API_KEYandGEMINI_API_KEY, as forgoogleandgoogle-decisions, and the API compatibility gate countsKEY_VARIABLESas a growing registry. - Why: Without the entry Pax looked for
GOOGLE_INTERACTIONS_API_KEY, which core never reads; adding a provider's entry changes nothing existing providers read. - Source: https://github.com/pydantic/pydantic-ai/pull/12636#issuecomment-7009015444
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-25 · Input URLs stay provider-fetched
- Decision:
GoogleInteractionsModelkeeps sending input file URLs for Google to fetch on both transports, unless the caller setsforce_download=True.GoogleModel's local download on the Gemini API is tracked separately in https://github.com/pydantic/pydantic-ai/issues/14552. - Why: David (2026-11-25): this matches the shared
FileUrlcontract that OpenAI Responses, Anthropic andGoogleModelon Google Cloud follow.GoogleModel's Gemini API download rule dates from when that API accepted only YouTube URLs infileData. - Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4683701926
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-25 · MCP media keep their block metadata in vendor_metadata
- Decision: An MCP image, audio or embedded binary resource becomes a
BinaryContentwhosevendor_metadata['google_interactions_mcp_content']holds the rest of the MCP content block; replay rebuilds the block from it.docs/models/google.mddocuments the key. - Why: The metadata belongs to the file and travels with it through UI adapters' round-trips. The Anthropic and OpenAI Responses MCP connectors already keep the server's result content in history that UI adapters send to clients.
- Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4691740778
- Session: 7552cc41-26bc-49e1-b923-219251705b70
2026-11-25 · infer_model_profile returns the Interactions profile
- Decision: For a
google-interactions:id,infer_model_profilemerges the Interactions overrides (supports_tool_return_schema=False, tool-return MIME types) over theGoogleProviderprofile, matchingGoogleInteractionsModel.profile. - Why: Temporal's fallback for unregistered model strings and Pax read
infer_model_profile, which returned the GenerateContent profile for this prefix; the context window already matched. - Source: https://github.com/pydantic/pydantic-ai/pull/12636#discussion_r4691829427
- Session: 7552cc41-26bc-49e1-b923-219251705b70
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
- PR title is fit for the release changelog.