Class
Unified way to configure AI Voice Agents with STT, LLM, VAD, Turn Detector, and tools.
Constructor
Initialize an AgentSession with plugin configurations.
Parameters
stt
Speech-to-Text specification or handler instance.String format:
"{provider}/{model}:{language}"- Example:
"deepgram/nova-2:en-US" - Example:
"google/en-US"
KURALIT_STT_PROVIDER if not providedllm
Large Language Model specification or model instance.String format:
"{provider}/{model}"- Example:
"gemini/gemini-2.0-flash-001"
KURALIT_LLM_PROVIDER if not providedvad
Voice Activity Detection specification or handler instance.String format:
"{provider}/{version}"- Example:
"silero/v3"
KURALIT_VAD_PROVIDER if not providedturn_detection
Turn Detector specification or handler instance.String format:
"{provider}/{version}"- Example:
"multilingual/v1"
KURALIT_TURN_DETECTOR_PROVIDER if not providedtools
List of toolkits to provide to the agent.Example:
instructions
Agent system instructions. Defines the agent’s personality and behavior.Priority:
- Direct parameter (highest)
KURALIT_AGENT_INSTRUCTIONSenvironment variable- Default generated instructions (lowest)
name
Agent name. Used for logging and identification.Default:
"WebSocket Agent"Environment fallback: KURALIT_AGENT_NAMEconfig
Full Config object. Used as fallback if components not provided.Note: Usually not needed - AgentSession loads from environment automatically.
Properties
stt
Resolved STT handler instance.
llm
Resolved LLM model instance.
vad
Resolved VAD handler instance.
turn_detection
Resolved turn detector handler instance.
tools
List of toolkits available to the agent.
instructions
Agent system instructions.
name
Agent name.
Usage Examples
String-Based Configuration (Recommended)
With Tools
Environment Variable Configuration
Direct Handler Instances
Configuration Approaches
AgentSession supports three configuration approaches:- String-based (Recommended) - Simple string specifications
- Direct imports - Use handler instances directly
- Environment variables - Automatic loading from
.env
Related
- Agents → - Guide to creating agents
- Tools → - Adding capabilities
- Voice → - Real-time voice setup
- WebSocketServer → - Create server

