Hi,👋 we have updated the app and fixed multiple bugs. We are lacking funds, request to free user not to use Adblock. Ads are non intrusive. 😊

@akshay_pachaar: Let's build a real-time Voice ...

@akshay_pachaar
16 views Mar 25, 2025
1
Let's build a real-time Voice RAG Agent, step-by-step:
2
Before we begin, here's a quick demo of what we're building

Tech stack:

- @Cartesia_AI for SOTA text-to-speech
- @AssemblyAI for speech-to-text
- @LlamaIndex to power RAG
- @livekit for orchestration

Let's go! 🚀
3
Here's an overview of what the app does:

1. Listens to real-time audio
2. Transcribes it via AssemblyAI
3. Uses your docs (via LlamaIndex) to craft an answer
4. Speaks that answer back with Cartesia

Now let's jump into code!
4
1️⃣ Set up environment and logging

This ensures we can load configurations from .env and keep track of everything in real time.

Check this out👇
Media image
5
2️⃣ Setup RAG

This is where your documents get indexed for search and retrieval, powered by LlamaIndex.

The agents answers would be grounded to this knowledge base.

Check this out👇
Media image
6
3️⃣ Setup Voice Activity Detection

We also want Voice Activity Detection (VAD) for smooth real-time experience—so we’ll “prewarm” the Silero VAD model.

This helps us detect when someone is actually speaking.

Check this out👇
Media image
7
4️⃣ The VoicePipelineAgent and Entry Point

This is where we bring it all together. The agent:

1. Listens to real-time audio.
2. Transcribes it using AssemblyAI.
3. Crafts an answer with your documents via LlamaIndex.
4. Speaks that answer back using Cartesia.

Check this out 👇
Media image
8
5️⃣ Run the app

Finally, we tie it all together. We run our agent with, specifying the prewarm function and main entrypoint.

That’s it—your Real-Time Voice RAG Agent is ready to roll!
Media image
9
The entire code is 100% open-source, you can find it here!

GitHub repo: github.com/patchy631/ai-e…
10
That's a wrap!

If you enjoyed this breakdown:

Follow me → @akshay_pachaar ✔️

Every day, I share insights and tutorials on LLMs, AI Agents, RAGs, and Machine Learning!
Actions
Visual Editor Carousel Maker NEW
Update Thread
What You Can Do
  • Download as PDF
  • Save to Notion
  • Export as Markdown
  • Visual Editor
  • LinkedIn & Instagram Carousel Maker
Create Free Account

Includes 7-day Premium trial