Universal.Operative.Sdk.Realtime.GoogleGemini 1.0.0

dotnet add package Universal.Operative.Sdk.Realtime.GoogleGemini --version 1.0.0
                    
NuGet\Install-Package Universal.Operative.Sdk.Realtime.GoogleGemini -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Universal.Operative.Sdk.Realtime.GoogleGemini" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Universal.Operative.Sdk.Realtime.GoogleGemini" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Universal.Operative.Sdk.Realtime.GoogleGemini" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Universal.Operative.Sdk.Realtime.GoogleGemini --version 1.0.0
                    
#r "nuget: Universal.Operative.Sdk.Realtime.GoogleGemini, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Universal.Operative.Sdk.Realtime.GoogleGemini@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Universal.Operative.Sdk.Realtime.GoogleGemini&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Universal.Operative.Sdk.Realtime.GoogleGemini&version=1.0.0
                    
Install as a Cake Tool

About

Universal.Operative.Sdk.Realtime.GoogleGemini adapts the Gemini Live API to Universal.Operative.Sdk.Realtime's provider-neutral IModel/IRealtimeSession/SessionEvent model, via Google's own Google.GenAI package (which ships a typed BidiGenerateContent client directly — the existing turn-based Universal.Google.Gemini.Client has no Live API bindings).

This is the second realtime adapter, deliberately chosen next (before Nova Sonic) to stress-test two things the OpenAI adapter didn't exercise: native session resumption, and parallel/async tool-call correlation.

How to Use

Installation

dotnet add package Universal.Operative.Sdk
dotnet add package Universal.Operative.Sdk.Realtime
dotnet add package Universal.Operative.Sdk.Realtime.GoogleGemini

Quick start

using Universal.Operative.Sdk.Realtime;
using Universal.Operative.Sdk.Realtime.GoogleGemini;

var model = new Model(apiKey, modelId: "gemini-2.5-flash-native-audio-preview-09-2025");

IRealtimeSession session = await model.ConnectAsync(new RealtimeSessionOptions
{
    SystemPrompt = [new TextBlock("You are a helpful voice assistant.")],
    Tools = [myTool],
});

IOperative operative = OperativeBuilder.Create(session).AddTool(myTool).Build();

await foreach (SessionOutputEvent e in operative.RunAsync())
{
    switch (e)
    {
        case SessionReadyEvent: Console.WriteLine("connected"); break;
        case TranscriptDeltaEvent t: Console.WriteLine($"{t.Role}: {t.Text}"); break;
        case AudioOutputDeltaEvent a: /* play a.Audio (24kHz PCM16) */ break;
        case SessionExpiringEvent expiring: /* about to disconnect -- see resumption below */ break;
    }
}

Session resumption

Session implements IResumableSession (Capabilities.HasFlag(SessionCapabilities.NativeResumption) is true). Gemini pushes a fresh resumption handle over the life of the connection; suspend and resume with it directly:

if (session is IResumableSession resumable)
{
    SessionHandle handle = await resumable.SuspendAsync();
    // ... later, possibly after a restart ...
    IRealtimeSession resumed = await resumable.ResumeAsync(handle);
}

Fidelity notes

  • Capabilities: AudioInProcess | ToolCalling | Transcripts | NativeResumption.
  • Tool results: the full ToolResult content is JSON-serialized into Gemini's function-response object ({"result": ...} / {"error": ...}), not flattened to a bare string the way OpenAI's wire format requires.
  • Async tool scheduling: SubmitToolResultEvent.SchedulingHint maps to Gemini's FunctionResponse.Scheduling (interrupt/whenIdle/silent) — a client-set hint on the response, not something the model attaches to the original call.
  • Barge-in: automatic (server-side VAD) only; InterruptRequestEvent throws NotSupportedException since Gemini has no client-sent cancel event, and manual activityStart/activityEnd isn't wired up.
  • Tool choice: RealtimeSessionOptions.ToolChoice throws NotSupportedException -- Google.GenAI.Types.LiveConnectConfig has no tool-choice-equivalent field.
  • Raw passthrough: video frames, UsageMetadata, and voice-activity signals beyond interrupted aren't promoted to canonical events -- they arrive as RawPassthroughEvent.
  • Auth: direct Gemini API key only; Vertex AI auth isn't wired up.
  • Audio format: fixed at Model.InputSampleRateHertz (16kHz) in and Model.OutputSampleRateHertz (24kHz) out, mono PCM16 -- not configurable, unlike the other adapters.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 40 8/12/2026

Google Gemini Live adapter for Universal.Operative.Sdk.Realtime, using Google's own Google.GenAI package. Implements IResumableSession using Gemini's native session-resumption handle. Direct Gemini API key auth only; Vertex AI auth is not wired up.