Skip to main content

Voice Agents

Build interactive voice experiences by combining Speech-to-Text, NLU, and Text-to-Speech. The endpoints below let you discover configured agents and obtain LiveKit session details to connect to an agent.

Need an API Key? If you don't have an API key yet, you can create one here: https://playground.induslabs.io/register

Where to get your API key

Screenshot: where to find your API key. Create one at playground.induslabs.io/register

POST/api/agents

List Available Agents

Returns a list of configured voice agents available in the developer environment.

Functionality
  • Discover configured agents for your organization or developer environment.

Inputs

NameTypeDefaultDescription
api_key*stringrequiredAPI key used for authentication.

Outputs

StatusTypeDescription
200 OKapplication/jsonList of agents and metadata.
401 Unauthorizedapplication/jsonMissing or invalid credentials.

cURL

curl -N -X POST \
"https://developer.induslabs.io/api/agents" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{"api_key":"YOUR_API_KEY"}'

Python

import requests

url = "https://developer.induslabs.io/api/agents"
payload = {"api_key": "YOUR_API_KEY"}

resp = requests.post(url, json=payload, headers={"Content-Type": "application/json"}, timeout=30)
resp.raise_for_status()
print(resp.json())

React + TypeScript

type Agent = { agent_id: string; name?: string };

const resp = await fetch("https://developer.induslabs.io/api/agents", {
method: "POST",
headers: { "Content-Type": "application/json", accept: "application/json" },
body: JSON.stringify({ api_key: process.env.NEXT_PUBLIC_INDUS_API_KEY }),
});
if (!resp.ok) throw new Error("Failed to load agents");
const agents: Agent[] = await resp.json();
POST/api/livekit

Start / Connect LiveKit Session

Request LiveKit session details for a given agent so clients can join the voice session.

Functionality
  • Returns connection details (token, room) required to join LiveKit.

Inputs

NameTypeDefaultDescription
api_key*stringrequiredAPI key used for authentication.
agent_id*stringrequiredID of the agent to connect to.

Outputs

StatusTypeDescription
200 OKapplication/jsonLiveKit connection details and metadata.
401 Unauthorizedapplication/jsonMissing or invalid credentials.

cURL

curl -N -X POST \
"https://developer.induslabs.io/api/livekit" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{"api_key":"YOUR_API_KEY","agent_id":"AGENT_ID"}'

Python

import requests

url = "https://developer.induslabs.io/api/livekit"
payload = {"api_key": "YOUR_API_KEY", "agent_id": "AGT_E882B100"}

resp = requests.post(url, json=payload, headers={"Content-Type": "application/json"}, timeout=30)
resp.raise_for_status()
print(resp.json())

React + TypeScript

import { Room } from "livekit-client";

const resp = await fetch("https://developer.induslabs.io/api/livekit", {
method: "POST",
headers: { "Content-Type": "application/json", accept: "application/json" },
body: JSON.stringify({
api_key: process.env.NEXT_PUBLIC_INDUS_API_KEY,
agent_id: "AGENT_ID"
}),
});
if (!resp.ok) throw new Error("Failed to start LiveKit");
const { url, token } = await resp.json(); // expects { url, token }

const room = new Room();
await room.connect(url, token);
// add RoomEvent listeners as needed
React + TypeScript

Integrate with LiveKit

Example of fetching agents, requesting a LiveKit session for one agent, and connecting to the room from a React app.

Install LiveKit client
  • npm install livekit-client

React + TypeScript component

import { useEffect, useMemo, useState } from "react";
import { Room, RoomEvent } from "livekit-client";

const API_BASE = "https://developer.induslabs.io/api";
const API_KEY = "YOUR_API_KEY"; // Prefer an env var like process.env.NEXT_PUBLIC_INDUS_API_KEY

type Agent = { agent_id: string; name?: string };
type LivekitSession = { url: string; token: string };

async function fetchAgents(): Promise<Agent[]> {
const res = await fetch(`${API_BASE}/agents`, {
method: "POST",
headers: { "Content-Type": "application/json", accept: "application/json" },
body: JSON.stringify({ api_key: API_KEY })
});
if (!res.ok) throw new Error("Failed to load agents");
return res.json();
}

async function startLivekit(agentId: string): Promise<LivekitSession> {
const res = await fetch(`${API_BASE}/livekit`, {
method: "POST",
headers: { "Content-Type": "application/json", accept: "application/json" },
body: JSON.stringify({ api_key: API_KEY, agent_id: agentId })
});
if (!res.ok) throw new Error("Failed to start LiveKit");
return res.json(); // expects { url, token }
}

export function VoiceAgentLivekit() {
const [agents, setAgents] = useState<Agent[]>([]);
const [room, setRoom] = useState<Room | null>(null);
const [status, setStatus] = useState("idle");

useEffect(() => {
fetchAgents().then(setAgents).catch(console.error);
}, []);

const connect = useMemo(
() => async (agentId: string) => {
setStatus("connecting");
const { url, token } = await startLivekit(agentId);
const lkRoom = new Room();
lkRoom.on(RoomEvent.Connected, () => setStatus("connected"));
lkRoom.on(RoomEvent.Disconnected, () => setStatus("disconnected"));
await lkRoom.connect(url, token);
setRoom(lkRoom);
},
[]
);

useEffect(() => {
return () => room?.disconnect();
}, [room]);

if (!agents.length) return <p>Loading agents...</p>;

return (
<div>
<p>Status: {status}</p>
{agents.map((agent) => (
<button key={agent.agent_id} onClick={() => connect(agent.agent_id)}>
Join {agent.name || agent.agent_id}
</button>
))}
</div>
);
}

The /api/livekit response should include url and token. Supply your API key via environment variables in production and extend with reconnection/error handling as needed.