Prerequisites
Before proceeding, ensure that your development environment meets the following requirements:- A Zero Runtime account (create one from the Zero Runtime Dashboard).
- Node.js and Python 3.11+ installed on your device.
- A Google API key with Gemini Live API access.
You need a Zero Runtime account to generate a token and a Google API key for the Gemini Live API.
Generate a token from the Zero Runtime Dashboard and a Google API key from Google AI Studio.
Project Structure
First, create an empty project usingmkdir folder_name in your preferred location for the JavaScript frontend. Your final project structure should look like this:
root
index.html
config.js
index.js
agent-js.py
.env
index.html: Creates a basic UI for joining the meeting.config.js: Stores the token and room ID for the JavaScript frontend.index.js: Renders the meeting view and handles audio functionality.agent-js.py: The Python AI agent backend using the Google Gemini Live API..env: Environment variables for the Python agent’s API keys.
Part 1: JavaScript Frontend
Install Zero Runtime
Import Zero Runtime using the
<script> tag or install it using npm/yarn.- <script>
- npm
- yarn
Design the user interface
Create an
index.html file containing a join-screen and a grid-screen for audio-only interaction.index.html
Configure environment and credentials
Create a meeting room using the Zero Runtime API:Copy the
roomId from the response and configure it in config.js:config.js
Implement meeting logic
In
index.js, retrieve DOM elements, declare variables, and add the core meeting functionality.index.js
Part 2: Python AI Agent
Setup the project
Use Python 3.11 or higher, then install the Zero Runtime Agents SDK. Create and activate a virtual environment, then install
zrt and python-dotenv. Every provider plugin ships with zrt.Configure environment variables
Create a
.env file in your project root to store your keys and token securely for the Python agent:.env
Create the AI agent backend
Create the Python AI agent (
agent-js.py) that joins the same meeting room and interacts with users through voice.agent-js.py
Part 3: Run the Application
Start the frontend
Once you have completed all the steps above, serve your frontend files:Open
http://localhost:8000 in your web browser.Run the AI agent
Open a new terminal, activate your virtual environment, and run the Python agent. It reads
GOOGLE_API_KEY from the .env file.Connect and interact
-
Join the meeting from the frontend:
- Click the Join Agent Meeting button in your browser.
- Allow microphone permissions when prompted.
-
Agent connection:
- Once you join, the Python agent detects your participation.
- You should see “Participant joined” in the terminal.
- The AI agent greets you and initiates the game.
-
Start playing:
- The agent guides you through a number guessing game (1–100).
- Use your microphone to interact with the AI host.
Troubleshooting
'Waiting for participant...' but no connection
'Waiting for participant...' but no connection
- Ensure both the frontend and the agent are running.
- Check that the
ROOM_IDmatches inconfig.jsandagent-js.py. - Verify your Zero Runtime token is valid.
Audio not working
Audio not working
- Check browser permissions for microphone access.
- Ensure your Google API key has Gemini Live API access enabled.
Agent not responding
Agent not responding
- Verify your
GOOGLE_API_KEYis set in the.envfile. - Check that the Gemini Live API is enabled in your Google Cloud Console.
Next Steps
Quickstart Example
Complete working example with source code.
Build Your First Voice Agent
Learn the Cascade and Realtime pipelines in depth.