Skip to content

Agents

← Back to API Reference

Agents define a voice AI assistant: which STT / LLM / TTS providers to use, the system prompt, available tools, and how to route calls.

Two modes:

ModeHow it works
FreeformSingle LLM turn per conversation, driven by prompt. flow_nodes_count = 0.
FlowMulti-node finite state machine. Each node has its own prompt and transitions. flow_nodes_count > 0. See Flow Nodes.

Contents


GET /api/agents

List all agents with call counts and flow metadata.

Response:

json
[
  {
    "id": "uuid",
    "name": "sales-agent",
    "prompt": "You are a helpful sales assistant...",
    "greeting": "Hello {{customer_name}}, how can I help?",
    "stt_provider": "deepgram",
    "stt_model": "nova-3-general",
    "stt_language": "en",
    "llm_provider": "openai",
    "llm_model": "gpt-4.1-nano",
    "llm_settings": { "temperature": 0.1, "max_tokens": 150 },
    "tts_provider": "cartesia",
    "tts_model": "sonic-3",
    "voice": "694f9389-aac1-45b6-b726-9d9369183238",
    "pre_call_tool_ids": [],
    "tool_ids": [],
    "webhook_url": null,
    "webhook_events": [],
    "created_at": "2026-03-18T10:00:00",
    "total_calls": 42,
    "flow_nodes_count": 0
  }
]

GET /api/agents/{agent_id}

Get a single agent with full configuration.


GET /api/agents/stats

Dashboard statistics — total calls, active calls, per-agent aggregates.

Response:

json
{
  "total_calls": 1250,
  "active_calls": 3,
  "completed_calls": 1200,
  "failed_calls": 47,
  "avg_duration": 63.4,
  "agents": [
    {
      "agent_id": "uuid",
      "agent_name": "sales-agent",
      "total_calls": 400,
      "completed": 385,
      "failed": 15,
      "avg_duration": 72.1
    }
  ]
}

POST /api/agents

Create a new agent.

Minimal request:

json
{
  "name": "support-agent",
  "prompt": "You are a helpful support agent."
}

Full request:

json
{
  "name": "sales-agent",
  "prompt": "You are a helpful sales assistant. When the user gives their order number, call check_order.",
  "greeting": "Hello {{customer_name}}, how can I help you today?",

  "stt_provider": "deepgram",
  "stt_model": "nova-3-general",
  "stt_language": "en",
  "stt_settings": {},

  "llm_provider": "openai",
  "llm_model": "gpt-4.1-nano",
  "llm_settings": { "temperature": 0.1, "max_tokens": 150 },

  "tts_provider": "cartesia",
  "tts_model": "sonic-3",
  "voice": "694f9389-aac1-45b6-b726-9d9369183238",
  "tts_language": "en",
  "tts_settings": {},

  "pipeline_settings": {
    "idle_warn_secs": 25,
    "idle_end_secs": 50,
    "vad_confidence": 0.5,
    "vad_start_secs": 0.2,
    "vad_stop_secs": 0.2,
    "vad_min_volume": 0.4,
    "min_words": 3
  },

  "pre_call_tool_ids": ["uuid-of-tool"],
  "tool_ids": ["uuid-of-tool"],
  "context_variables": {
    "customer_name": { "type": "string", "description": "Customer's name" }
  },

  "webhook_url": "https://your-server.com/webhook",
  "webhook_events": ["call_started", "call_ended"]
}

PATCH /api/agents/{agent_id}

Update agent configuration. Send only the fields you want to change.


DELETE /api/agents/{agent_id}

Delete an agent and all its flow nodes. Calls associated with the agent are kept.


POST /api/agents/generate

Generate an agent config from a plain-English description using AI. Returns a config object you can review and submit to POST /api/agents.

json
{
  "description": "A customer support agent for a SaaS product that handles billing questions and technical issues",
  "language": "English"
}

Import / Export

GET /api/agents/{agent_id}/export

Export a portable JSON bundle: full agent config + all flow nodes + all referenced tool definitions. Use this to move agents between environments.

POST /api/agents/import

Import an agent bundle.

json
{
  "version": "1",
  "overwrite": false,
  "agent": { "name": "sales-agent", "prompt": "..." },
  "tools": [{ "id": "tool-ref-1", "name": "lookup_order", "webhook_url": "https://..." }],
  "flow_nodes": [{ "node_key": "greeting", "is_initial": true }]
}
  • Tools are matched by name. Existing tools are reused; missing ones are created.
  • UUID references in tool_ids / pre_call_tool_ids are remapped to real DB IDs automatically.
  • Returns 409 if the agent name already exists and overwrite is false.

Field Reference

Core fields

FieldRequiredDefaultDescription
nameYesUnique slug. No spaces — used in webhook URLs.
promptYesLLM system prompt. For freeform agents, mention tool_ids tools here to tell the LLM when to use them.
greetingNoFirst TTS message when call connects. Supports placeholders.

STT (Speech-to-Text)

FieldDefaultOptions
stt_providerdeepgramdeepgram · sarvam · openai · elevenlabs
stt_modelnova-3-general, saaras:v3, whisper-1, …
stt_languageenBCP-47: en, hi-IN, ta-IN, …
stt_modeSarvam only: transcribe · translate
stt_settings{}Provider-specific options as a JSON object

LLM

FieldDefaultOptions
llm_provideropenaiopenai · google · grok
llm_modelgpt-4.1-nanogpt-4.1-nano, gemini-2.5-flash, grok-3-beta, …
llm_settings{}{ "temperature": 0–2, "max_tokens": int }

TTS (Text-to-Speech)

FieldDefaultOptions
tts_providercartesiacartesia · elevenlabs · sarvam · deepgram · openai
tts_modelsonic-3, bulbul:v2, eleven_flash_v2_5, …
voiceVoice ID or speaker name (provider-specific)
tts_languageLanguage tag for multilingual TTS providers
tts_settings{}Provider-specific options as a JSON object

Pipeline

FieldDefaultDescription
pipeline_settings.idle_warn_secs25Seconds of silence before the agent prompts the user
pipeline_settings.idle_end_secs50Seconds of silence before the agent ends the call
pipeline_settings.vad_confidence0.5Voice activity detection confidence threshold (0–1)
pipeline_settings.vad_start_secs0.2Seconds of speech required to begin transcribing
pipeline_settings.vad_stop_secs0.2Seconds of silence required to stop transcribing
pipeline_settings.vad_min_volume0.4Minimum audio volume to register as speech (0–1)
pipeline_settings.min_words3Minimum word count before the LLM processes a turn

Tools

FieldDescription
pre_call_tool_idsTool UUIDs that fire in parallel with the greeting (before conversation starts)
tool_idsTool UUIDs the LLM can call during conversation. Freeform agents only — flow agents assign tools per node. Mention each tool in prompt to tell the LLM when to use it.

Outbound calls

FieldDescription
context_variablesSchema of variables expected for outbound calls: { "var": { "type": "string", "description": "..." } }. Used for substitution in greeting and flow prompts, and injected as LLM context.

Webhooks

FieldDescription
webhook_urlYour endpoint that receives call event notifications
webhook_eventsEvents to subscribe to: ["call_started", "call_ended"]

See Webhooks for payload formats.