Hi, why CreateAgentDispatchRequest in node.js envi...
# ask-ai
i
Hi, why CreateAgentDispatchRequest in node.js environment doesn't work?
t
Thanks for reaching out, Heorhi. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm here to help you get the
CreateAgentDispatchRequest
in Node.js working smoothly! Let's walk through some common areas that might need a little attention: • Authentication: Double-check that your API key and secret are correctly set up in the
AgentDispatchClient
. This is often the first step to ensure things run seamlessly. • Agent Registration: Make sure your agent is registered with an
agentName
, as this is essential for using explicit dispatch. • Request Validation: Take a moment to confirm that all required fields like
agent_name
,
room
, and any optional
metadata
are properly included in your request. • Network Issues: It’s a good idea to check your network connection, verify that the host URL is correct, and ensure there aren’t any firewall restrictions blocking the request. • Error Handling: If you’re seeing errors, looking closely at the details returned by the Twirp RPC protocol can give us clues about what might be going wrong. If you’d like, feel free to share the exact error message or the parameters you’re using. I’m here to help you troubleshoot and get everything working just right! Sources: packages/livekit-server-sdk/src/AgentDispatchClient.ts | Agent dispatch | LiveKit Docs | livekit/livekit_agent_dispatch.twirp.go | Agents telephony integration | LiveKit Docs | SIP troubleshooting guide | LiveKit Docs
i
I can see that in documents mentioned that `CreateAgentDispatchRequest`available on in livekit cli and python. But it exist in node.js sdk code, why ?
t
I'm glad you asked about the
CreateAgentDispatchRequest
! It’s available in the Node.js SDK, Python SDK, and LiveKit CLI, but it’s implemented a bit differently depending on the platform: • Node.js SDK: Here, the request is used behind the scenes in the
createDispatch
method of the
AgentDispatchClient
. This makes things easier by letting you provide parameters like room name, agent name, and optional metadata directly. • Python SDK: In this case, you’ll explicitly create the request as a class object and then pass it to the
create_dispatch
method. • LiveKit CLI: You can use the
lk dispatch create
command, which adds handy features like automatic room generation and built-in validation. All of these platforms share the same underlying protocol buffer definition to keep everything consistent. If you want, I’m here to help with any questions you have about using it in Node.js or elsewhere! Sources: packages/livekit-server-sdk/src/AgentDispatchClient.ts | livekit-api/livekit/api/agent_dispatch_service.py | cmd/lk/dispatch.go | livekit-protocol/src/livekit.rs