While using agent dispatch to trigger calls to my ...
# ask-ai
c
While using agent dispatch to trigger calls to my phone number, I am getting error, metadata is not passed. what to do?
t
Thanks for reaching out, Subham. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Could you share a bit more about the error you're running into? For example: • What exact error message pops up? • Are you using a particular SDK or API for agent dispatch? • How are you including the metadata in your setup? Getting these details will really help me figure out what's going on and assist you better.
c
Copy code
lk dispatch create \
--new-room \
--agent-name livspace-agent \
--metadata '+917978884674'
Using project [qualif-test-sd]
Dispatch created: id:"AD_6SLq7tut2uES" agent_name:"livspace-agent" room:"room-5LvqZhwCpswd" metadata:"+917978884674" state:{created_at:1756984926812556951}
{"message": "received job request", "level": "INFO", "name": "livekit.agents", "job_id": "AJ_tDRrpCFnaGmi", "dispatch_id": "", "room_name": "room-5LvqZhwCpswd", "agent_name": "livspace-agent", "resuming": false, "timestamp": "2025-09-04T112206.929896+00:00"} what's the problem here?
t
It looks like the metadata isn’t being passed correctly to the agent. No worries—let’s walk through some steps together to troubleshoot and get this sorted out: 1. Verify Metadata Format: Make sure the metadata is passed as a properly formatted string. Using JSON is usually the best way for structured data. Here’s an example:
Copy code
lk dispatch create \
  --new-room \
  --agent-name livspace-agent \
  --metadata '{"phone_number": "+917978884674"}'
1. Check Dispatch Creation: Try running
lk dispatch list --json
to see if the metadata is stored correctly in the dispatch. 2. Agent Configuration: Double-check that your agent is registered with the right
agent_name
in its configuration. For example, in Python:
Copy code
opts = WorkerOptions(
    agent_name="livspace-agent",
)
1. Access Metadata in Agent Code: Make sure your agent code accesses the metadata using
ctx.job.metadata
. If you passed JSON, don’t forget to parse it like this:
Copy code
import json
data = json.loads(ctx.job.metadata)
1. Check CLI Version: It helps to be on the latest LiveKit CLI version. You can check yours by running
lk --version
and update if needed. 2. Enable Verbose Logging: Running the dispatch command with the
--verbose
flag can show if the metadata is included in the outgoing request. If you’re still running into trouble, could you let me know: • Are you using the CLI method or the token-based method? • Which version of the LiveKit CLI are you on? • Do you see the metadata when you run
lk dispatch list --json
? With this info, we can dig a little deeper and figure out what’s going on. I’m here to help! Sources: examples/agent_dispatch.py | autocomplete/fish_autocomplete | Agent dispatch | LiveKit Docs | README.md | Dispatching agents | LiveKit Docs