live library
Live streaming and multimodal bidirectional execution primitives.
Provides CascadeLive, GeminiSTT, GeminiTTS, LiveIngress, LiveEgress, LiveRequestQueue, and typed IngressEvent / EgressEvent streams for low-latency voice and multimodal agent pipelines.
import 'package:adk_dart/live.dart';
final model = CascadeLive(
model: 'gemini-2.5-flash',
stt: GeminiSTT(),
tts: GeminiTTS(),
);
Classes
- AgentSpokenOutput
- Text segment whose corresponding audio has been emitted by the TTS stage.
- AudioChunk
- Synthesized audio chunk ready to be streamed to the caller.
- CancelSignal
- Cooperative cancellation signal passed to LiveEgress transforms.
- CascadeLive
- Wraps any text BaseLlm with speech-to-text and text-to-speech transforms to support live audio sessions.
- CascadeLiveConnection
- Live connection bridging STT ingress, text reasoning, and TTS egress.
- EgressEvent
- Base class for events emitted by a LiveEgress transform.
- GeminiSTT
- Speech-to-text transform converting live audio into transcripts using Gemini.
- GeminiTTS
- Text-to-speech transform converting text deltas into speech using Gemini.
- IngressEvent
- Base class for events emitted by a LiveIngress transform.
- LiveActivityEnd
- Marker indicating the end of a live activity segment.
- LiveActivityStart
- Marker indicating the start of a live activity segment.
- LiveClientRealtimeInput
- Structured realtime input payload for CascadeLiveConnection.sendRealtimeInput.
- LiveEgress
- Text-to-speech stream transform converting text deltas to EgressEvents.
- LiveIngress
- Speech-to-text stream transform converting audio chunks to IngressEvents.
- LiveRequest
- A single queued live request payload.
- LiveRequestQueue
- In-memory FIFO queue for live requests.
- LiveTranscription
- Transcription payload emitted on LlmResponse.inputTranscription and LlmResponse.outputTranscription.
- PartialTranscript
- Interim transcript emitted while the user is still speaking.
- UserSpeechStarted
- Signal emitted when user speech begins so active agent output can stop.
- UserTurnFinished
- Final transcript emitted when the user finishes speaking a turn.
- VisualFrame
- A single visual frame and the wall-clock time it was received.
Constants
- visualFramesZipMimeType → const String
- MIME type of the packed visual frames archive stored in the artifact service.
Functions
-
normalizeTtsPcmAudio(
InlineData blob, {int defaultSampleRate = _defaultSampleRate}) → InlineData -
Normalizes Gemini TTS audio
blob(including WAV containers andaudio/L16) into raw PCM labeledaudio/pcm;rate=<rate>. -
packVisualFrames(
List< VisualFrame> frames) → (Uint8List, Map<String, Object?> ) -
Packs
framesand their manifest into one uncompressed (ZIP_STORED) ZIP archive. -
sampleRateOfAudioMime(
String? mimeType) → int -
Extracts the PCM sample rate from
mimeType(e.g.audio/pcm;rate=24000), defaulting to16000Hz when unspecified or invalid. -
sendsGoogleTrackingHeaders(
BaseLlm llm) → bool -
Whether
llmcalls Google APIs that accept ADK tracking headers. -
unpackVisualFrames(
List< int> archiveBytes) → (List<VisualFrame> , Map<String, Object?> ) -
Restores the frames and manifest from a packed
archiveBytesZIP archive. -
withClientLabel(
GenerateContentConfig? config, String label) → GenerateContentConfig -
Returns a copy of
configwhose tracking headers also carrylabel.
Exceptions / Errors
- CascadeConnectionClosedException
- Exception thrown when CascadeLiveConnection.receive is called on an already-closed connection.