AI voice agents
An agent is an AI participant. It joins a room, listens to one person and answers out loud. Everyone in the room hears it and can see its state and a live transcript. Use agents for support lines, tutoring, interview practice or a receptionist. Agents need prepaid credit (see Pricing).
Start an agent
bash
curl -X POST https://api.appsocom.dev/rooms/support-42/agents \
-H "Authorization: Bearer $APPSOCOM_API_KEY" -H "Content-Type: application/json" \
-d '{"name":"Ava","instructions":"You are Acme'"'"'s support assistant. Keep answers short.","greeting":"Hi, I'"'"'m Ava. How can I help?"}'
# → {"roomId":"support-42","agentId":"agent-…","participant":{…}}| Field | |
|---|---|
name |
the name people see |
instructions |
what the agent should do and how to behave (a system prompt) |
greeting |
what it says when it joins |
listenTo |
the userId it listens to. By default, the first person with a mic on. |
voice |
which voice to use |
All fields are optional. Stop the agent with DELETE /rooms/:roomId/agents/:agentId. It also leaves by itself 20 seconds after the last person does.
In your app
ts
room.agents; // AI participants (participant.kind === "agent")
room.on("agent-state", (agent, state) => …); // "initializing" | "listening" | "thinking" | "speaking"
room.on("transcript", (seg) => …); // { id, role: "user" | "agent", speakerId, text, final }
room.sendToAgent(agent.id, "What's my order status?"); // type instead of talkingThe agent's voice plays like anyone else's. Transcript segments are sent again with the same id as more words arrive, so replace the line rather than adding a new one.