I am integrating livekit into my AI assistant proj...
# ask-ai
c
I am integrating livekit into my AI assistant project, what should I use? The python sdk or the cloud one?
t
Thanks for reaching out, Ritam. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm excited to help you with your AI assistant project! You can definitely use both the Python SDK and LiveKit Cloud together—they really complement each other nicely. The Python SDK is perfect for building your AI assistant's core logic and integrating AI features, while LiveKit Cloud takes care of deployment, scaling, and maintenance, making things much easier for you. Here’s a friendly approach to get you started: • Start with the Python SDK: This is where you'll build your AI assistant. You can jump right in by using the ready-to-go Python starter project with the command
lk app create --template agent-starter-python
. • Set up LiveKit Cloud: This lets you deploy your AI assistant globally without much hassle. Just make sure to configure your API keys and environment variables properly. • Develop and Test Locally: Before going live, run your assistant locally using
python3 agent.py dev
to make sure everything works smoothly. • Deploy to Production: When you're ready, use the LiveKit CLI to deploy your assistant to LiveKit Cloud, so it can scale globally with ease. If you ever feel stuck or want some guidance—whether it’s setting up AI providers, configuring telephony features, or deploying to production—please don’t hesitate to reach out. I’m here to support you every step of the way! Sources: LiveKit Docs | livekit-agents/README.md | complex-agents/nutrition-assistant/nutrition-assistant-frontend/README.md | README.md | Voice AI quickstart | LiveKit Docs
c
I actually have setup my database and frontend, so do I need to run lk app create --template agent-starter python?
t
Hi there! You actually don’t need to use the
lk app create --template agent-starter-python
command if you already have your database and frontend set up. The agent-starter-python template is really meant as a helpful starting point for new projects, but it’s definitely not mandatory. Instead, you can smoothly integrate LiveKit directly into your existing setup by: • Adding LiveKit dependencies to your backend (for example,
livekit-agents
if you’re using Python). • Implementing the agent logic right within your current Python application. • Connecting your frontend to LiveKit using the SDK that fits your stack, like React, Flutter, and so on. • Continuing to use your existing database and authentication system for token generation and managing users. The template can still be a great reference if you want to peek at best practices and implementation patterns. Please feel free to reach out if you’d like some guidance on integrating specific LiveKit features into your current setup—I’m here to help!
c
How do I get the API and secret key of livekit?
t
To help you get your API key and secret key for LiveKit, here’s a simple guide you can follow: Option 1: Using LiveKit Cloud (Recommended) 1. First, sign into LiveKit Cloud and create a new project. 2. Next, head over to the project’s settings page where you can generate your API keys. 3. You’ll then receive two important strings:
LIVEKIT_API_KEY
and
LIVEKIT_API_SECRET
. Option 2: Self-Hosted LiveKit Server If you’re running your own LiveKit server, no worries! You can generate your API keys and secrets by following the self-hosted server setup guide. Once you have your keys, just set them as environment variables in your application like this:
Copy code
LIVEKIT_API_KEY=<your_api_key>
LIVEKIT_API_SECRET=<your_api_secret>
LIVEKIT_URL=<your_livekit_url>
If you hit any bumps or have questions along the way, please don’t hesitate to reach out—I’m here to help! Sources: Mini tutorial: setting up a LiveKit Cloud project | Running LiveKit on AWS | avatars/hedra/education_avatar/education-frontend/.env.example | Generating tokens | LiveKit Docs | livekit-api/src/access_token.rs
c
Does livekit needs assemblyai or cartesia plugins?
t
Hi there! Just to clarify, LiveKit doesn’t require AssemblyAI or Cartesia plugins—they’re completely optional and here if you’d like to use them: • LiveKit Inference: This gives you easy access to models from AssemblyAI, Cartesia, and other providers without needing any plugins. It’s built into LiveKit Cloud, so billing and integration are all taken care of for you automatically. • Optional Plugins: If you prefer, you can use plugins like
livekit-plugins-assemblyai
or
livekit-plugins-cartesia
to connect directly with these providers using your own accounts and API keys. Just a heads-up, this means you’d be handling your own billing and credentials. Feel free to pick whichever option feels right for your project! And if you’d like a hand setting things up or have any questions, I’m here to help—just let me know! Sources: Models | LiveKit Docs | AssemblyAI plugin guide | LiveKit Docs | Speech-to-text (STT) models | LiveKit Docs | livekit-plugins/livekit-plugins-assemblyai/livekit/plugins/assemblyai/py.ty...
c
Does livekit need an external llm provider like cerebras, st, tts models like deepgram or cartesia for building voice agents which check a database?
t
I’m glad you asked about how LiveKit works with external providers for LLM, STT, and TTS models when building voice agents. LiveKit makes things much easier through LiveKit Inference. With this feature, you can conveniently access models from providers like OpenAI, Cerebras, Deepgram, Cartesia, and more—all with just a single LiveKit API key. This means you don’t have to worry about creating and managing multiple accounts across different providers. Plus, you get a consistent API experience, and billing is all handled smoothly through LiveKit Cloud. Of course, if you prefer, you can also connect directly to these providers using plugins and manage your own accounts and credentials. If you’d like, I’m here to help guide you through setting up LiveKit Inference or assist with using specific providers for your voice agent. Just let me know! Sources: Introducing LiveKit Inference: A unified model interface for voice AI | Models | LiveKit Docs
c
What functions does the AgentSession has?
t
The
AgentSession
class in LiveKit is truly the heart of managing voice AI applications, and I’m excited to walk you through its key functions: • Session Management: You can
start()
a session to get things going,
close()
to wrap it up, and
run()
to process user input smoothly. • Agent Control: Need to switch things up? Use
updateAgent()
to change the active agent, and
currentAgent
helps you see who’s currently active. • Input/Output: Manage your audio inputs with
input
and handle audio or text outputs through `output`—all designed to keep the conversation flowing. • Conversation Management: Keep track of your dialogue with
history
, finalize user input using
commitUserTurn()
, or reset it anytime with
clearUserTurn()
. • Speech and Interaction: Generate speech with
say()
, get AI responses via
generateReply()
, and if needed, halt ongoing actions using
interrupt()
. • Configuration: Customize your experience with options like
voice options
,
turn detection
, and connection settings tailored to your needs. • Event Handling: Stay informed with events that monitor state changes, user interactions, and any errors that might pop up. This class beautifully integrates STT, TTS, and LLM components, handles turn detection, interruptions, and multi-step tool calls, making it a fantastic choice for building voice AI applications. If you’d like, I’m here to dive deeper into any specific function you’re curious about—just let me know! Sources: agents/src/voice/agent_session.ts | livekit-agents/livekit/agents/__init__.py