Control the Agent
Send speak, chat, and interrupt commands over the LiveKit data channel
Once your app is connected to the LiveKit room (see Quickstart), all commands to the agent are sent via sendText() on a data-channel topic. This guide covers the three command topics and their payload formats.
Note: If you are using the D-ID Agents SDK or Embed Code, these details are handled internally — call
speak()andchat()instead.
Commands
| Command | Topic | Payload |
|---|---|---|
speak | did.speak | { "script": { "type": "text", "input": "..." } } |
chat | lk.chat | plain text string |
interrupt | did.interrupt | empty string |
speak
Generates video from text (equivalent to the V1 Talks/Clips Streams API).
- Topic:
did.speak - Payload:
{ "script": { "type": "text", "input": "Your text here" } } - Use for: scripted content, announcements, predetermined messages, faster generation without LLM processing
chat
Sends a conversational message. The agent's LLM processes the input and responds.
- Topic:
lk.chat - Payload: plain text string
- Use for: natural conversations, Q&A, context-aware responses using a knowledge base
interrupt
Interrupts the current video sequence and returns the agent to idle.
- Topic:
did.interrupt - Payload: empty string
- Use for: stopping a long response, barge-in flows. Requires
interrupt_enabledon the agent (defaulttrue).
Sending commands
// speak — generate video from text
await room.localParticipant.sendText(
JSON.stringify({ script: { type: "text", input: "Hello!" } }),
{ topic: "did.speak" }
);
// chat — conversational message
await room.localParticipant.sendText(
"What is the weather?",
{ topic: "lk.chat" }
);
// interrupt — stop the current video
await room.localParticipant.sendText("", { topic: "did.interrupt" });