Build intelligent voice agents with outbound calls, web sessions, and webhooks.
Voice Agents are server-managed configurations that pair an LLM with SLNG’s STT and TTS models. You create an agent once, then dispatch it to phone calls or web sessions. Agents support template tools, built-in utilities like current date/time lookup, webhooks, human transfer, and dynamic prompts via template variables.
If you already have an agent configured the way you want, you can duplicate it from the API or
from Agent Infra. Duplication preserves the stored agent configuration, but it requires a new
slng_api_key and does not copy the inbound SIP trunk.
curl -X POST https://api.agents.slng.ai/v1/agents \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Healthcare Outreach Agent", "system_prompt": "You are Sarah, a patient outreach coordinator for {{practice_name}}. You are calling {{patient_name}} to help schedule their next visit. Keep responses to 1–2 sentences, ask one question at a time, and never provide medical advice.", "greeting": "Hi, is this {{patient_name}}? This is Sarah calling from {{practice_name}}. I'm reaching out because it looks like you're due for a visit, and I wanted to help get that scheduled for you if now's a good time?", "language": "en", "models": { "stt": "slng/deepgram/nova:3-en", "llm": "groq/moonshotai/kimi-k2-instruct-0905", "tts": "slng/deepgram/aura:2-en", "tts_voice": "aura-2-thalia-en", "llm_kwargs": {} }, "enable_interruptions": true, "tools": [ { "type": "template", "id": "dc4d6391-dc51-44e3-a816-bf65948290a2", "template": "hangup", "execution_policy": { "pre_action_message": { "enabled": true, "text": "Thank you for your time. Have a great day." } } } ], "livekit_deployment": "default-eu", "slng_api_key": "YOUR_SLNG_API_KEY", "template_defaults": { "patient_name": "Maria", "practice_name": "Greenfield Family Medicine" } }'
slng_api_key is the SLNG API key the agent runtime will use to call STT/LLM/TTS on
https://api.slng.ai. You can reuse the same key you use for this API, or use a dedicated key.
livekit_deployment is optional. If omitted, it defaults to default-eu.
2
Create a web session (no telephony)
Use web sessions to test an agent without PSTN/SIP:
Outbound calls require the agent to be configured with an outbound SIP trunk (sip_outbound_trunk_id).
Configure this in the Dashboard Telephony page and attach it to your agent.
Use idle_nudges to recover from long silences. The agent can send two follow-up prompts, then speak a final message and hang up.
{ "idle_nudges": { "enabled": true, "first_nudge_delay_seconds": 15, "second_nudge_delay_seconds": 30, "hangup_delay_seconds": 15, "first_nudge_text": "Are you still there?", "second_nudge_text": "I can stay on the line if you need a moment.", "final_hangup_text": "I’m going to disconnect for now. Feel free to call back anytime." }}
If you omit this field, the API can still return language-specific defaults for the agent.
Use Handlebars syntax ({{variable}}) in your system prompt and greeting(s) to create dynamic agents:
{ "system_prompt": "You are calling {{patient_name}} from {{practice_name}} to help schedule a checkup.", "template_defaults": { "practice_name": "Greenfield Family Medicine" }}
When dispatching a call, provide values for template variables:
{ "tools": [ { "type": "built_in", "id": "f0d84ac5-7988-460c-995d-2ad9621c09bb", "built_in": "current_datetime", "timezone": "Europe/Madrid", "prompt": "Use this whenever you need the current local date, time, or day of week for the caller." } ]}
This exposes a get_current_datetime tool to the model. The result includes timezone, local_datetime,
local_date, local_time, day_of_week, utc_offset, and is_dst.Like webhook tools, built-in tools can also be configured with "source": "system" plus system.triggers
to inject the current date/time automatically on events such as call_start.
{ "tools": [ { "type": "webhook", "id": "8d7f2a3f-35d6-4ff9-97e6-1ab6a2d6867a", "name": "check_order_status", "description": "Check the status of a customer order by order ID", "url": "https://api.yourcompany.com/orders/status", "parameters": { "type": "object", "properties": { "order_id": { "type": "string" } }, "required": ["order_id"] }, "auth": { "type": "bearer", "token": "your-api-token" }, "timeout_seconds": 10, "wait_for_response": true, "show_results_to_llm": true, "llm_result_instructions": "Summarize the tool result briefly and ask the caller for the next required detail." } ]}
Webhook auth secrets are write-only. Agent responses will include auth_type but never return
tokens/secrets.
Use show_results_to_llm to control whether successful webhook payloads are exposed back to the model.
Set it to false when the webhook is side-effect only. Use llm_result_instructions to tell
the model how to interpret and respond to successful results when they are visible.
Transfer the caller to a human (requires sip_outbound_trunk_id on the agent):
{ "tools": [ { "type": "human_transfer", "id": "a9040e05-15a8-4fc9-86bd-a4903a6a907e", "name": "transfer_to_support", "description": "Transfer to a human support agent", "phone_number": "+14155551234", "execution_policy": { "pre_action_message": { "enabled": true, "text": "Let me connect you to a member of our team." } } } ]}
Scheduling assistant: current_datetime + hangup + idle_nudges. Useful when the agent needs accurate local time before offering appointment slots.
Support router: contextual webhook lookup + human_transfer. Good for triage flows where the agent resolves routine cases but escalates exceptions.
Collections follow-up: voicemail_detection + system webhook on call_end. Useful when every completed call needs a CRM or collections-platform summary.
Restaurant host: current_datetime + availability webhook. Good for reservation, booking, and inventory-style lookups that depend on real-time availability.
After-hours clinic router: system-injected current_datetime on call_start + human_transfer + hangup. Useful when business-hour logic should be available to the model before the first user turn.
The API reference now includes multiple Create agent request examples showing these patterns with
concrete payloads.
POST /v1/agents/{agent_id}/calls dispatches an outbound call (requires telephony)
POST /v1/agents/{agent_id}/web-sessions creates a web (non-telephony) session
POST /v1/agents/{agent_id}/duplicate creates a server-side copy with a new name and slng_api_key
GET /v1/agents/{agent_id}/calls lists calls (paginated)
GET /v1/agents/{agent_id}/calls/{call_id} fetches a call record
Call records include fields like livekit_session_report when available.
These fields are treated as opaque objects and their structure may change. For a user-friendly transcript view,
use the Dashboard calls page.