Hi, can I build an HTTP API layer on top of LiveKi...
# ask-ai
s
Hi, can I build an HTTP API layer on top of LiveKit Cloud where I can send my assistant configuration — such as instructions, STT, TTS, LLM settings, etc. — along with the customer’s phone number and the caller ID, to initiate outbound phone calls? Instead of hard coding all the agent configuration while creating an agent?
t
Thanks for reaching out, Eswara. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Yes — you can build an HTTP API layer that sends per-call assistant configuration (instructions, STT, TTS, LLM settings) plus phone number and caller ID to initiate outbound calls without hardcoding the agent. How it works (high level) 1. Have your HTTP API accept the full payload (instructions, model/voice IDs, STT choice, customer phone, caller ID, etc.). 2. When your API receives a request, dispatch the agent and include that payload in the dispatch
metadata
(the job metadata). 3. In the agent entrypoint, read
ctx.job.metadata
, parse the runtime config, and build the
AgentSession
(STT/LLM/TTS, instructions) dynamically. 4. From the agent, call
create_sip_participant
(or equivalent) to place the outbound call using the phone number from metadata. 5. Control caller ID either by selecting a trunk configured with the desired number or by passing
sip_number
in the
CreateSIPParticipant
request if your trunk supports dynamic numbers. Key implementation points • Pass everything needed per-call via job
metadata
so no agent redeploy is required. • Parse metadata in the agent and instantiate
AgentSession
with the provided STT/LLM/TTS settings and
Agent(instructions=...)
. • Use
sip_trunk_id
and
sip_call_to
to place the call; use
sip_number
or the trunk’s configured number to control caller ID. • Your HTTP API can call LiveKit’s server SDK/CLI to create the dispatch with metadata. If you’d like, I can: • Provide a compact example HTTP POST payload and the exact dispatch CLI/SDK call to send it. • Show a minimal agent entrypoint snippet that reads metadata and starts the session + SIP participant call. Which of those would help you next? Sources: Agent dispatch | LiveKit docs | External data and RAG | LiveKit Docs | Agents telephony integration | LiveKit Docs | SIP outbound trunk | LiveKit docs