It seems that my agent in the build version of liv...
# ask-ai
m
It seems that my agent in the build version of livekit is not retaining its name. How do I fix this so my application knows what agent to call?
t
Thanks for reaching out, Ryan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
m
great
t
Thanks — that sounds frustrating. You're asking how to make an agent keep its name in the build version so your application can reliably call it. You're correct that when an agent has no explicit name it can be auto-dispatched and behave inconsistently. What to do • Set an explicit agent name so the agent is only dispatched when you request it. How to set it 1. Python agents ◦ Add the
agent_name
parameter to your
@server.rtc_session
decorator. Example:
Copy code
@server.rtc_session(agent_name="my-telephony-agent")
   async def my_agent(ctx: JobContext):
       # Your agent logic here
       pass
1. Node.js agents ◦ Provide
agentName
in
ServerOptions
. Example:
Copy code
const opts = new ServerOptions({
     agentName: "my-telephony-agent"
   });
What changes after you set a name • The agent will no longer be auto-dispatched; it must be explicitly dispatched by name. • Dispatch can be done via: ◦ The CreateAgentDispatchRequest API ◦ SIP dispatch rules that reference the
agent_name
◦ Room token configuration with
RoomAgentDispatch
Quick checks if it still doesn’t work • Confirm the name in your agent code exactly matches the name used by your dispatch rules or API call (case-sensitive). • Redeploy the agent after changing the configuration so the name takes effect. • If you use SIP or any automated dispatching layer, update its rules to reference the exact
agent_name
. If you'd like, tell me: • Which runtime you’re using (Python or Node.js), • The exact name you set (or the code snippet), and • How you currently dispatch the agent (API, SIP, or room token). I’ll help verify the configuration and walk through any remaining steps. Sources: Agents telephony integration | LiveKit Documentation | Agent dispatch | LiveKit Documentation | Agent Builder | LiveKit Documentation
Thanks — glad that helped! If you’d like, I can: • Walk through updating your existing agent code and show the exact spot to add
agent_name
(Python or Node.js). • Help you update dispatch rules (SIP, API, or room token) to reference the exact agent name. • Suggest checks to verify the agent is being dispatched correctly after redeploying. Which of those would be most useful right now?
m
Thanks for sharing that LiveKit support response. It confirms what we already have set up — the agent name needs to match between the agent code and the dispatch rule. In your case, since you're using Agent Builder (not self-hosted Python/Node.js), the agent name is set in the Builder UI (which you've done as "Avero_Mod") and the dispatch rule references that same name. That part is correct. The real question to ask LiveKit support is about metadata passing — specifically:
"I'm using Agent Builder with SIP dispatch rules. My dispatch rule metadata contains JSON (e.g.,
{"company_id": "...", "tenant_id": "..."}
). In my agent's instructions and HTTP tool configurations, I reference these as
{{metadata.company_id}}
. How does the agent access dispatch metadata and SIP participant attributes (like
sip.phoneNumber
,
sip.callID
) in Agent Builder? Are they available as template variables, and if so, what's the syntax?"
This is the critical gap — the agent is being dispatched correctly now, but it's using placeholder values for company_id, tenant_id, caller_phone, etc. because the metadata isn't flowing through. Also worth asking:
"Can the agent access room metadata that is updated after the room is created? For example, if my server updates room metadata via the LiveKit API when a SIP participant joins, will the agent see the updated metadata via
{{metadata.*}}
variables?"
The answer to these two questions will determine our approach: • If Agent Builder can read room metadata updates → We inject caller-specific data from our webhook handler into room metadata, and the agent picks it up automatically • If it can only read dispatch rule metadata → We put the static values (company_id, tenant_id) in the dispatch rule, and add a new HTTP tool like
identify_caller
that the agent calls first to get the dynamic per-call info
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
m
How do I view logs for my agent in LiveKIT? I am having issues that I need to see how and what the LiveKIT agent is doing, and how it is responding to APIs and calls.
How do I view logs for my agent in LiveKIT? I am having issues that I need to see how and what the LiveKIT agent is doing, and how it is responding to APIs and calls.
hello?