I'd be happy to help you trigger an action of an agent in a LiveKit room from your server! Here are a few approaches you can try:
•
Dispatch the agent with metadata: When you dispatch the agent to the room, include the intended action in the metadata. The agent can then read this metadata and respond accordingly as soon as it joins.
•
Use room metadata updates: You can update the room metadata from your server, and the agent can keep an eye out for these changes to trigger specific actions.
•
External event polling: Another option is to set up an external API or event system (like WebSocket or Redis) that your agent can poll or listen to for commands.
Just a quick note: LiveKit doesn’t currently offer a direct server-side API to invoke arbitrary actions on an agent that’s already joined. So, actions need to be set up in advance or triggered through the agent’s own logic, room events, or metadata changes. If you’d like, I can share some examples to help you get started with any of these methods—just let me know!
Sources:
src/main/kotlin/io/livekit/server/AgentDispatchServiceClient.kt |
Agent dispatch | LiveKit Docs |
Dispatching agents | LiveKit Docs |
Function calling with Voice Agents | LiveKit Docs |
avatars/hedra/education_avatar/agent.py