Gemini 3.x rejects a request whose functionCall parts lack a thought_signature. The signature was carried as base64 protected_data on a text_reasoning content and re-attached by adjacency, which requires the carrier to immediately precede its call. An approval round trip replays the call with no carrier at all, so the next turn failed with a 400. Track signatures in a bounded per-client call_id map populated at parse time from the resolved call_id, and backfill only when the emitted part has no signature. Also stop clearing the held signature on contents that emit no Part, so an approval response or an unsigned thought summary between the carrier and its call no longer drops it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: dd0909cd-c7c3-42cb-aef1-1e9a3e64d917
Get Started with Microsoft Agent Framework Gemini
Install the provider package:
pip install agent-framework-gemini --pre
Gemini Integration
The Gemini integration enables Microsoft Agent Framework applications to call Google Gemini models with familiar chat abstractions, including streaming, tool/function calling, and structured output.
Structured Output
Gemini structured output can be configured with either a Pydantic model in response_format, a JSON schema mapping in response_format, or a Gemini-specific response_schema. Declarative agents that define outputSchema pass that schema through response_format.
Authentication
The connector supports both google-genai authentication modes.
Gemini Developer API
Obtain an API key from Google AI Studio and set either the package-prefixed or SDK-standard environment variable:
export GEMINI_API_KEY="your-api-key"
# or: export GOOGLE_API_KEY="your-api-key"
export GEMINI_MODEL="gemini-2.5-flash-lite"
# or: export GOOGLE_MODEL="gemini-2.5-flash-lite"
Vertex AI
Set the standard Vertex AI environment variables used by google-genai:
export GOOGLE_GENAI_USE_VERTEXAI=true
export GOOGLE_CLOUD_PROJECT="your-project-id"
export GOOGLE_CLOUD_LOCATION="global"
export GOOGLE_MODEL="gemini-2.5-flash-lite"
Examples
See the Google Gemini samples for runnable end-to-end scripts covering:
- Basic agent with tool calling and streaming
- Extended thinking with
ThinkingConfig - Google Search grounding
- Google Maps grounding
- Built-in code execution