Tried has three moving parts: the API, the agent runtime and the media layer. This page explains how they fit together and walks through a call from the first ring to the last webhook. Knowing the lifecycle helps you decide where to put logic: in the prompt, in a function, in a pre-call workflow or in a webhook handler.
Components#
| Component | What it does |
|---|---|
| API | The REST API you call, the dashboard backend, webhook delivery, post-call analysis, the batch call scheduler and knowledge base ingestion. Stateless, backed by Postgres and Redis. |
| Agent runtime | A Python worker built on LiveKit Agents. One job per call. It runs speech recognition, turn-taking, the LLM, functions and text to speech. |
| Media | LiveKit rooms. Phone calls arrive through LiveKit SIP from Telnyx, Twilio or your own SIP trunk. Web calls join from the browser. |
| Providers | Hosted APIs for models: OpenAI, Anthropic and Google for text, Premium and Standard voices (with six more voice providers through the API), Deepgram and four other transcription providers. |
| Storage | Recordings, knowledge base files and exports in object storage (S3). |
PSTN ─ Telnyx / Twilio / your trunk ─▶ LiveKit SIP ─▶ room "call_<call_id>" ◀── browser (web call)
│ agent dispatch
▼
agent worker: STT ─▶ turn detector ─▶ LLM (stream) ─▶ TTS (stream)
│ events (transcript, tools, latency)
▼
API: store call, webhooks, post-call analysis, billingThe configuration snapshot#
When a call starts, the worker fetches one frozen snapshot of everything it needs: the agent, its engine (Retell LLM, conversation flow or Custom LLM WebSocket URL), the resolved voice and fallback voices, knowledge base IDs and the merged dynamic variables. The worker never reads the database during the call.
This has two effects you should know about:
- Edits to an agent do not change calls that are already running. They apply to the next call.
- If the API is briefly unavailable mid-call, the call continues. The worker buffers its events and retries.
Which version of the agent goes into the snapshot depends on how the call was started. Phone numbers can pin a version or follow an environment tag such as prod. API calls can pass override_agent_version. See Versions and environments.
Inbound phone call#
The call reaches LiveKit#
Your carrier sends the call to LiveKit SIP, and a dispatch rule creates a room for it.
The API picks the agent#
The API looks up the number, checks Allowed Inbound Countries, and picks an agent from the number's inbound agents. With A/B testing on, it picks by weight.
Inbound webhook (optional)#
If the number has an inbound webhook, the API calls it. The caller keeps hearing ringing. The response can change the agent, set dynamic variables or metadata, or reject the call. The request times out after 10 seconds and is retried twice.
Pre-call workflow (optional)#
If the agent has an enabled pre-call workflow, it runs now. Its outputs become dynamic variables. See Workflows.
Concurrency check#
If the workspace has no free concurrency slot, the call waits in a queue for up to 40 seconds and then goes to the number's fallback number. With no fallback number it ends with concurrency_limit_reached.
The agent joins#
The API creates the call record with direction inbound, dispatches the agent worker, and the worker greets the caller.
Outbound phone call#
You request the call#
POST /v2/create-phone-call with from_number and to_number. The API validates the numbers, checks the do-not-call flag when asked, your credit and budget, a concurrency slot and the calls-per-second limit of the number.
The call is registered#
The API stores a call with status registered and returns it to you straight away.
The worker warms up while it rings#
The API creates the room, dispatches the agent and dials the callee through the outbound trunk. The worker opens its provider connections while the phone rings, so the first reply does not wait for connection setup.
The callee answers#
Voicemail, IVR and call screener detection run at the start of the call when they are turned on. Then the conversation proceeds. If nobody answers within Ring Duration, the call ends with dial_no_answer.
Web call#
POST /v3/create-web-call creates a room and returns an access_token and livekit_url. The browser joins the room with the browser SDK or livekit-client. The token is valid for one room for one hour; the response carries the expiry in expires_at. Transfers do not apply to web calls.
During the call#
The worker sends events to the API in batches: each utterance, function calls and results, flow node transitions, keypad digits, collected variables and per-turn latency. The API stores them on the call, which is how Live Monitoring and the transcript_updated webhook see the conversation as it happens.
You can change a running call with PATCH /update-live-call/:call_id: override dynamic variables, change metadata, or add context for the agent and ask it to respond. See Dynamic variables.
The call ends when the caller or agent hangs up, the agent transfers the call, End Call on Silence or Max Call Duration is reached, or a detection feature ends it. The reason is stored in disconnection_reason.
After the call#
When the call ends:
- The call status becomes
endedand thecall_endedwebhook is sent. - Post-call analysis runs with the agent's
post_call_analysis_modeland fillscall_analysis. Thecall_analyzedwebhook is always delivered aftercall_ended. - The post-call workflow runs after analysis, if the agent has one.
- Contact memory is rewritten, if the agent has Update memory after each call on.
- Cost is computed per second and recorded on the call.
- The data storage setting is applied last, once webhooks and analysis have received the full call. With Everything except PII, PII is scrubbed from the stored transcript and the recording is beeped over the redacted words. With Basic attributes only, the transcript, variables and recordings are removed.
Where to put your logic#
| You want to | Use |
|---|---|
| Change what the agent says or how it reasons | The prompt, or nodes in a conversation flow |
| Fetch data before the agent speaks | A pre-call workflow, or the number's inbound webhook |
| Fetch or write data during the call | A function (custom HTTP, code, MCP or integration app) |
| Route the caller to a person or another agent | Call Transfer or Agent Transfer functions |
| Act on the result of a call | The call_analyzed webhook or a post-call workflow |