/google-adk:streaming-patternsfrom google-adk
Configures Google ADK bidi-streaming for real-time multimodal AI agents. Covers LiveRequestQueue, audio/video streaming, session management, and response modalities.
Ships in google-adk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Comprehensive patterns for configuring Google ADK bidi-streaming (bidirectional streaming) to build real-time, multimodal AI agents with voice, video, and streaming tool capabilities.
ADK bidi-streaming enables low-latency, bidirectional communication between users and AI agents with:
from google.adk.agents import Agent
from google.adk.agents.run_config import RunConfig, StreamingMode
from google.genai import types
# Configure for audio streaming
run_config = RunConfig(
response_modalities=["AUDIO"],
streaming_mode=StreamingMode.BIDI
)
# Run agent with bidi-streaming
async for event in agent.run_live(request_queue, run_config=run_config):
if event.server_content:
# Handle streaming response
handle_response(event)
from google.adk.agents import LiveRequestQueue
# Create queue for multimodal inputs
request_queue = LiveRequestQueue()
# Enqueue text
await request_queue.put("What's the weather?")
# Enqueue audio chunks
await request_queue.put(audio_bytes)
# Signal activity boundaries
await request_queue.put(types.LiveClientRealtimeInput(
media_chunks=[types.LiveClientRealtimeInputMediaChunk(
data=audio_chunk
)]
))
CRITICAL: Only ONE response modality per session. Cannot switch mid-session.
# Audio output (voice agent)
RunConfig(response_modalities=["AUDIO"])
# Text output (chat agent)
RunConfig(response_modalities=["TEXT"])
Session Resumption (automatic reconnection):
RunConfig(
session_resumption=types.SessionResumptionConfig()
)
Context Window Compression (unlimited sessions):
RunConfig(
context_window_compression=types.ContextWindowCompressionConfig(
trigger_tokens=100000,
sliding_window=types.SlidingWindow(target_tokens=80000)
)
)
See templates/audio-config.py for speech and transcription settings.
Use environment variable (no code changes needed):
# Google AI Studio (Gemini Live API)
export GOOGLE_GENAI_USE_VERTEXAI=FALSE
# Vertex AI (Live API)
export GOOGLE_GENAI_USE_VERTEXAI=TRUE
Define tools as async generators for continuous results:
@streaming_tool
async def monitor_stock(symbol: str):
"""Stream real-time stock price updates."""
while True:
price = await fetch_current_price(symbol)
yield f"Current price: ${price}"
await asyncio.sleep(1)
See templates/streaming-tool-template.py for complete pattern.
Process events from run_live():
async for event in agent.run_live(request_queue, run_config=run_config):
# Server content (agent responses)
if event.server_content:
if event.server_content.model_turn:
# Text/audio from model
process_model_response(event.server_content.model_turn)
if event.server_content.turn_complete:
# Agent finished speaking
handle_turn_complete()
# Tool calls
if event.tool_call:
# ADK executes tools automatically
log_tool_execution(event.tool_call)
# Interruptions
if event.interrupted:
handle_interruption()
Transfer stateful sessions between agents:
# Agent 1 creates session
session = await agent1.run_live(request_queue, run_config=config)
# Transfer to Agent 2 (seamless handoff)
await agent2.run_live(
request_queue,
run_config=config,
session=session # Maintains conversation context
)
Configure RunConfig
Create LiveRequestQueue
Implement Event Handling
Define Streaming Tools (optional)
Test and Deploy
See examples/audio-video-agent.py for complete multimodal setup including:
All templates use placeholders only (no hardcoded API keys):
Utility scripts for validation and setup:
Real-world streaming agent implementations:
See examples/voice-agent.py
See examples/streaming-tool-agent.py
See examples/multi-agent-handoff.py
This skill follows strict security rules:
.gitignore protection documentedexamples/multi-agent-handoff.py (opens in a new tab)examples/streaming-tool-agent.py (opens in a new tab)examples/video-agent.py (opens in a new tab)examples/voice-agent.py (opens in a new tab)scripts/check-modality-support.py (opens in a new tab)scripts/test-liverequest-queue.py (opens in a new tab)scripts/validate-streaming-config.py (opens in a new tab)templates/audio-config.py (opens in a new tab)templates/bidi-streaming-config.py (opens in a new tab)templates/event-handler.py (opens in a new tab)templates/liverequest-queue.py (opens in a new tab)templates/streaming-tool-template.py (opens in a new tab)templates/video-config.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
3 skills in this plugin
/a2a-patternsAgent-to-Agent (A2A) protocol implementation patterns for Google ADK - exposing agents via A2A, consuming external agents, multi-agent communication, and protocol configuration. Use when building multi-agent systems, implementing A2A protocol, exposing agents as services, consuming remote agents, configuring agent cards, or when user mentions A2A, agent-to-agent, multi-agent collaboration, remote agents, or agent orchestration./observability-patternsComprehensive observability setup patterns for Google ADK agents including logging configuration, Cloud Trace integration, BigQuery Agent Analytics, and third-party observability tools (AgentOps, Phoenix, Weave). Use when implementing monitoring, debugging agent behavior, analyzing agent performance, setting up tracing, or when user mentions observability, logging, tracing, BigQuery analytics, AgentOps, Phoenix, Arize, or Weave.npx claudepluginhub vanman2024/ai-dev-marketplace --plugin google-adkOther plugins' skills for the same job