To get started, you’ll need the following API keys:
- Cerebras: the fastest inference on earth, get an API key here.
- LiveKit: build enterprise-grade realtime AI agents and get your API key here
- Cartesia: an STT/TTS service with realistic voices, get a free API key here
Step 1: Install Required Packages
First, let’s install all the necessary libraries, import everything we need, and configure our API credentials.Step 2: Context Loading Function
This function loads all files from thecontext/ directory. It reads your sales documents and formats them for the AI to reference during conversations.
For now, we will add a sample products.json to the directory.
Step 3: Build the Sales Agent
In this step, we define theSalesAgent class — your AI voice assistant powered by:
- Cerebras for natural language generation (via GPT-OSS 120B)
- Cartesia TTS (Ink-Whisper) for text to speech
- Cartesia STT for realtime speech to text
- Silero VAD for voice activity detection
on_enter() method so that the agent greets users as soon as they join the room, making the experience feel conversational from the start.
All responses are spoken aloud, so we’ve added constraints to the prompt to avoid things like bullets or non-verbal symbols!
Step 4: Run the Agent
Define the entry point function that LiveKit calls when someone joins a voice session. It connects to the room, creates the agent, and starts the conversation session. This also creates a web interface where you can talk to your agent directly in the notebook.If you can’t unmute your microphone, try restarting your notebook environment.
Challenges
The following, optional sections, let’s expand on our agent!Step 5: Multi-Agent Support
Now let’s enhance our sales agent with multi-agent capabilities. This allows different specialists to handle different parts of the conversation. For this, we’ll need to importfunction_tool so that we can call functions. Switching from agent to agent will be the result of a function call.
Enhanced Sales Agent with Transfer Capabilities
Now let’s modify our SalesAgent to add the ability to transfer to other specialists. Thankfully, this is very easy! All we need to do is return an instance of another Agent, and it will take over the interaction.Technical Specialist Agent
Our Sales Agent won’t be able to transfer anywhere unless we also define the other agents that it is going to be switching to. For the technical specialist, we’re going to change the prompt to focus on technical questions instead. We’re also going to change the voice so that it’s clear to the user that they’re speaking to a different agent. We’ll also include the tool calls to switch between agents.Pricing Specialist Agent
Next, we’ll define our last agent, the Pricing Specialist. Like the Technical Support Agent, this agent also has it’s own voice, and another separate prompt. We’ll finish this one off with the same tool calls, but this time registering the Technical Support Agent, and the Sales Agent as transferrable.Multi-Agent Entrypoint
Our new entrypoint will need to specify which Agent will start the interaction. In this case, we want the Sales Agent to start the call, so we specify:agent=SalesAgent() as a part of our session.start.
Try it out!
With this multi-agent setup:- Conversations start with the Sales Agent - The general sales representative who can answer basic questions
- Agents can transfer to specialists - When the conversation requires specialized knowledge:
- Say “I need technical details” to transfer to the Technical Agent
- Say “Let’s discuss pricing” to transfer to the Pricing Agent
- Specialists can transfer back - Any agent can transfer to any other agent.

