how to register telephony agent to livekit cloud? ...
# ask-ai
b
how to register telephony agent to livekit cloud? and will it reduce the latency?
t
Thanks for reaching out, Blue. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I can help with both parts: how to register (deploy) a telephony agent to LiveKit Cloud, and whether that will reduce latency. Acknowledging your question • You’re asking how to register/deploy a telephony agent to LiveKit Cloud and whether deploying it to Cloud reduces latency. How to register / deploy a telephony agent to LiveKit Cloud 1. Install the LiveKit CLI if you haven't already. 2. From your agent project directory, run:
Copy code
lk agent create
• This command will generate a
Dockerfile
,
.dockerignore
, and a
livekit.toml
configuration for your agent. • It registers the agent with LiveKit Cloud and begins deployment. 1. After deployment you can manage versions, perform rollbacks, and monitor the agent from the LiveKit Cloud dashboard. If you want, I can walk you through: • Preparing your agent code or Dockerfile (example tweaks needed for telephony), • What to put in
livekit.toml
for telephony agents, • Verifying the agent is running in the Cloud dashboard (what to look for). Will deploying the agent to LiveKit Cloud reduce latency? • Yes. When your agent is deployed to LiveKit Cloud it runs in the same data center(s) as LiveKit media servers and inference services. That co-location reduces network hops, avoids public internet congestion, and uses private backbone routing between services — all of which lower end-to-end latency. • LiveKit Cloud also offers provisioned inference capacity with model providers, which avoids public endpoint queues during peak demand and gives more consistent, predictable performance for telephony workloads. Quick follow-up questions to finalize guidance • Are you currently running the agent self-hosted or already partially on LiveKit Cloud? • Which cloud region(s) or geographic area do your users and telephony traffic primarily come from? • Do you need help with any specific telephony integrations (SIP gateway, PSTN provider, or a particular cloud telephony vendor)? Answering these will let me give step-by-step values or configuration examples tailored to your setup. Sources: examples/drive-thru | livekit/livekit_composite | DeepWiki | Google AI and LiveKit | LiveKit Documentation | Agent deployment overview | LiveKit Documentation | Introducing LiveKit Inference: A unified model interface for voice AI | Introducing LiveKit Inference: A unified model interface for voice AI
b
How much time it will take to build docker file and other things. and can i specify which file it has to use as agent file?
t
Thanks — I’ll answer both parts: how long the CLI-driven build usually takes, and whether you can specify which file is used as your agent entrypoint. Build time (Dockerfile + related files) • Using the LiveKit CLI (
lk agent create
) to generate the Dockerfile,
.dockerignore
, and
livekit.toml
, and to build the container, typically takes only a few minutes. The CLI automates file generation and the containerized build process, so most of the work is done for you. Actual time can vary slightly with your network speed and machine performance, but the process is standardized and generally quick. Specifying which file is used as the agent entrypoint • Yes — you can control which file acts as the agent entrypoint. The CLI detects the agent entry based on your project structure and the file that contains the agent/server entry logic (for example, the file with your
@server.rtc_session()
decorator or equivalent entrypoint code). • To ensure the correct file is used: ◦ Put your intended entrypoint file (e.g.,
telephony_agent.py
or
index.js
) at the expected place in your project. ◦ Ensure your entrypoint contains the agent startup entry (the decorator or server startup call). ◦ The
lk agent create
command will package the project and use that entrypoint when building and deploying the agent. If you’d like, I can: • Review your project structure and suggest the minimal changes so the CLI picks the right entrypoint. • Provide an example
livekit.toml
or Dockerfile snippet tailored to a telephony agent entrypoint. • Walk through the
lk agent create
output so you can confirm the CLI detected the correct file. Which would you prefer?
b
how can i create dispatch request to it..what url i have to use?
t
Good questions — I’ll explain where to send a dispatch, what credentials you need, and give examples for both the CLI and an SDK. Acknowledging your question • You asked what URL/endpoint to use to create a dispatch request to your telephony agent and how to make that request. Which URL to use • Use your LiveKit Cloud project base URL:
Copy code
https://<your-project-name>.livekit.cloud
Example:
<https://myproject.livekit.cloud>
What credentials you need • An API key and API secret for your LiveKit Cloud project (from Project → API Keys in the Cloud dashboard). • The agent name must match the agent’s registered name (the name you set when deploying the agent). How to create a dispatch • You do not POST directly to your agent’s own container URL. Instead, you create a dispatch via LiveKit’s Agent Dispatch API (using the Server SDK or the CLI) against your LiveKit Cloud project URL above. LiveKit then routes the dispatch to the registered agent. Examples 1) Using the LiveKit CLI 1. Run:
Copy code
lk dispatch create \
     --url <https://myproject.livekit.cloud> \
     --api-key YOUR_API_KEY \
     --api-secret YOUR_API_SECRET \
     --agent-name my-telephony-agent \
     --room call-room-123 \
     --metadata '{"phone_number":"+1234567890"}'
1. The CLI authenticates to your project and creates the dispatch which LiveKit will deliver to the named agent. 2) Using the Python Server SDK (concept) • Initialize the API client pointing at your project URL, then call the agent dispatch create method:
Copy code
from livekit import api

LIVEKIT_URL = "<https://myproject.livekit.cloud>"
API_KEY = "YOUR_API_KEY"
API_SECRET = "YOUR_API_SECRET"

lk_api = api.LiveKitAPI(url=LIVEKIT_URL, api_key=API_KEY, api_secret=API_SECRET)

await lk_api.agent_dispatch.create_dispatch(
    api.CreateAgentDispatchRequest(
        agent_name="my-telephony-agent",
        room="call-room-123",
        metadata='{"phone_number":"+1234567890"}'
    )
)
• The SDK call creates the dispatch on LiveKit Cloud; the platform routes it to your agent. What to verify if something fails • Confirm the project URL is correct and matches your Cloud project name. • Confirm the API key/secret are valid and have necessary permissions. • Confirm the agent is registered with that agent_name and is deployed/healthy in the Cloud dashboard. • Check agent logs in the Cloud dashboard for incoming dispatch events. If you want, I can: • Show a concrete
CreateAgentDispatchRequest
example tailored to SIP/PSTN telephony metadata you use. • Help you run the exact
lk dispatch create
command with your project name and example metadata (tell me the project name and agent name — do not share secrets here). Sources: Agent dispatch | LiveKit Documentation | Agents telephony integration | LiveKit Documentation