Introduction to AI Voice Agents in Low Code Voice Agent
AI Voice Agents are intelligent systems designed to interact with users through voice commands, processing natural language to perform tasks, provide information, or control devices. In the context of low code platforms, these agents empower users to integrate sophisticated voice functionalities without extensive programming knowledge.
What is an AI Voice Agent?
An AI Voice Agent is a software entity that uses speech recognition, natural language processing, and speech synthesis to understand and respond to human speech. These agents can be embedded in various applications, from customer service bots to smart home assistants.
Why are they important for the Low Code Voice Agent Industry?
In the low code industry, AI Voice Agents enable businesses to rapidly deploy voice-enabled applications. This capability is crucial for enhancing user engagement, providing hands-free interaction, and supporting accessibility.
Core Components of a Voice Agent
- Speech-to-Text (STT): Converts spoken language into text.
- Large Language Model (LLM): Processes the text to understand and generate responses.
- Text-to-Speech (TTS): Converts text responses back into spoken language.
For a detailed setup, refer to the
Voice Agent Quick Start Guide
.What You'll Build in This Tutorial
In this tutorial, you will build a low code AI Voice Agent using the VideoSDK framework. This agent will process user speech, generate intelligent responses, and speak back to the user using state-of-the-art plugins.
Architecture and Core Concepts
High-Level Architecture Overview
The architecture of the AI Voice Agent involves several components working in tandem to process and respond to user input. The data flow begins with capturing user speech, converting it to text, processing it through a language model, and finally converting the response back to speech.

Understanding Key Concepts in the VideoSDK Framework
- Agent: The core class representing your bot, responsible for handling user interactions.
- CascadingPipeline: Manages the flow of audio processing through STT, LLM, and TTS components. Learn more about the
cascading pipeline in AI voice Agents
. - VAD & TurnDetector: These components determine when the agent should listen and when it should respond, ensuring smooth interaction. Explore the
Turn detector for AI voice Agents
.
Setting Up the Development Environment
Prerequisites
To get started, ensure you have Python 3.11+ installed and a VideoSDK account. You can sign up at app.videosdk.live.
Step 1: Create a Virtual Environment
Create a virtual environment to manage dependencies:
1python -m venv voice_agent_env
2source voice_agent_env/bin/activate # On Windows use `voice_agent_env\Scripts\activate`
3Step 2: Install Required Packages
Install the necessary packages using pip:
1pip install videosdk-agents videosdk-plugins
2Step 3: Configure API Keys in a .env file
Create a
.env file in your project directory and add your VideoSDK API keys:1VIDEOSDK_API_KEY=your_api_key_here
2Building the AI Voice Agent: A Step-by-Step Guide
Let's start by presenting the complete, runnable code for the AI Voice Agent:
1import asyncio, os
2from videosdk.agents import Agent, AgentSession, CascadingPipeline, JobContext, RoomOptions, WorkerJob, ConversationFlow
3from videosdk.plugins.silero import SileroVAD
4from videosdk.plugins.turn_detector import TurnDetector, pre_download_model
5from videosdk.plugins.deepgram import DeepgramSTT
6from videosdk.plugins.openai import OpenAILLM
7from videosdk.plugins.elevenlabs import ElevenLabsTTS
8from typing import AsyncIterator
9
10# Pre-downloading the Turn Detector model
11pre_download_model()
12
13agent_instructions = "You are a 'low code voice agent' designed to assist users in creating and managing voice applications with minimal coding effort. Your persona is that of a friendly and knowledgeable tech assistant. Your capabilities include guiding users through the setup of voice applications, providing tips on optimizing voice interactions, and troubleshooting common issues. You can also suggest best practices for integrating voice agents into existing systems. However, you are not a substitute for a professional developer, and users should be advised to consult with a developer for complex integrations or customizations. Always remind users to test their applications thoroughly before deployment."
14
15class MyVoiceAgent(Agent):
16 def __init__(self):
17 super().__init__(instructions=agent_instructions)
18 async def on_enter(self): await self.session.say("Hello! How can I help?")
19 async def on_exit(self): await self.session.say("Goodbye!")
20
21async def start_session(context: JobContext):
22 # Create agent and conversation flow
23 agent = MyVoiceAgent()
24 conversation_flow = ConversationFlow(agent)
25
26 # Create pipeline
27 pipeline = CascadingPipeline(
28 stt=DeepgramSTT(model="nova-2", language="en"),
29 llm=OpenAILLM(model="gpt-4o"),
30 tts=ElevenLabsTTS(model="eleven_flash_v2_5"),
31 vad=SileroVAD(threshold=0.35),
32 turn_detector=TurnDetector(threshold=0.8)
33 )
34
35 session = AgentSession(
36 agent=agent,
37 pipeline=pipeline,
38 conversation_flow=conversation_flow
39 )
40
41 try:
42 await context.connect()
43 await session.start()
44 # Keep the session running until manually terminated
45 await asyncio.Event().wait()
46 finally:
47 # Clean up resources when done
48 await session.close()
49 await context.shutdown()
50
51def make_context() -> JobContext:
52 room_options = RoomOptions(
53 # room_id="YOUR_MEETING_ID", # Set to join a pre-created room; omit to auto-create
54 name="VideoSDK Cascaded Agent",
55 playground=True
56 )
57
58 return JobContext(room_options=room_options)
59
60if __name__ == "__main__":
61 job = WorkerJob(entrypoint=start_session, jobctx=make_context)
62 job.start()
63Step 4.1: Generating a VideoSDK Meeting ID
To create a meeting ID, use the following
curl command:1curl -X POST "https://api.videosdk.live/v1/meetings" \
2-H "Authorization: Bearer YOUR_API_KEY" \
3-H "Content-Type: application/json"
4Step 4.2: Creating the Custom Agent Class
The
MyVoiceAgent class defines the behavior of your voice agent. It inherits from the Agent class and provides custom entry and exit messages.1class MyVoiceAgent(Agent):
2 def __init__(self):
3 super().__init__(instructions=agent_instructions)
4 async def on_enter(self): await self.session.say("Hello! How can I help?")
5 async def on_exit(self): await self.session.say("Goodbye!")
6Step 4.3: Defining the Core Pipeline
The
CascadingPipeline orchestrates the flow of data through the agent's components:1pipeline = CascadingPipeline(
2 stt=DeepgramSTT(model="nova-2", language="en"),
3 llm=OpenAILLM(model="gpt-4o"),
4 tts=ElevenLabsTTS(model="eleven_flash_v2_5"),
5 vad=SileroVAD(threshold=0.35),
6 turn_detector=TurnDetector(threshold=0.8)
7)
8Each plugin is responsible for a specific task:
- STT: Converts speech to text using
Deepgram STT Plugin for voice agent
. - LLM: Processes text with
OpenAI LLM Plugin for voice agent
. - TTS: Converts text to speech with
ElevenLabs TTS Plugin for voice agent
. - VAD: Detects voice activity using
Silero Voice Activity Detection
. - Turn Detector: Manages conversation flow.
Step 4.4: Managing the Session and Startup Logic
The
start_session function initializes the agent session and keeps it running until manually terminated:1async def start_session(context: JobContext):
2 agent = MyVoiceAgent()
3 conversation_flow = ConversationFlow(agent)
4 pipeline = CascadingPipeline(...)
5 session = AgentSession(agent=agent, pipeline=pipeline, conversation_flow=conversation_flow)
6 try:
7 await context.connect()
8 await session.start()
9 await asyncio.Event().wait()
10 finally:
11 await session.close()
12 await context.shutdown()
13The
make_context function sets up the room options, and the main block starts the job:1def make_context() -> JobContext:
2 room_options = RoomOptions(name="VideoSDK Cascaded Agent", playground=True)
3 return JobContext(room_options=room_options)
4
5if __name__ == "__main__":
6 job = WorkerJob(entrypoint=start_session, jobctx=make_context)
7 job.start()
8Running and Testing the Agent
Step 5.1: Running the Python Script
Execute the script using Python:
1python main.py
2Step 5.2: Interacting with the Agent in the Playground
Once the script is running, look for the playground link in the console output. Use this link to join the session and interact with your voice agent.
Advanced Features and Customizations
Extending Functionality with Custom Tools
You can extend the agent's capabilities by integrating custom tools. The
function_tool concept allows you to add new functionalities tailored to specific needs.Exploring Other Plugins
Besides the plugins used in this tutorial, explore other STT, LLM, and TTS options available in the VideoSDK framework to enhance your agent's performance. For a comprehensive understanding, refer to the
AI voice Agent core components overview
.Troubleshooting Common Issues
API Key and Authentication Errors
Ensure your API keys are correctly set in the
.env file and that they have the necessary permissions.Audio Input/Output Problems
Check your microphone and speaker settings. Ensure the correct devices are selected and functioning properly.
Dependency and Version Conflicts
Use the virtual environment to manage dependencies and avoid version conflicts. Ensure all packages are up-to-date.
Conclusion
Summary of What You've Built
In this tutorial, you have successfully built a low code AI Voice Agent using the VideoSDK framework. You learned how to set up the development environment, create a custom agent, define a processing pipeline, and test the agent in a playground environment.
Next Steps and Further Learning
Consider exploring additional plugins and custom tools to expand your agent's capabilities. Continue learning about voice technologies and their applications in various industries. For more details on managing sessions, see
AI voice Agent Sessions
.Want to level-up your learning? Subscribe now
Subscribe to our newsletter for more tech based insights
FAQ