Connect an agent
Connect an agent to coval by providing the agent’s configuration.
Authorizations
API key for authentication
Headers
Workspace that scopes this operation. When omitted, the organization's active default workspace is used when one can be resolved.
1 - 26Body
Human-readable agent name
1 - 200"Customer Support Agent"
Agent type. Active types that can be created via the v1 API:
- MODEL_TYPE_VOICE: Inbound voice calls (requires phone_number in E.164 format or SIP address)
- MODEL_TYPE_OUTBOUND_VOICE: Outbound voice calls (requires endpoint webhook URL)
- MODEL_TYPE_CHAT: Text-based chat agents (requires metadata.chat_endpoint)
- MODEL_TYPE_CHAT_A2A: A2A JSON-RPC chat agents (requires metadata.chat_endpoint)
- MODEL_TYPE_CHAT_WEBSOCKET: Text chat over WebSocket (requires metadata.endpoint in direct mode)
- MODEL_TYPE_EMAIL: Email-based text agents
- MODEL_TYPE_SMS: SMS messaging agents (requires phone_number in E.164 format)
- MODEL_TYPE_WEBSOCKET: WebSocket voice agents (requires metadata.endpoint wss:// URL in direct mode; metadata.initialization_json is optional)
- MODEL_TYPE_LIVEKIT: LiveKit agents (requires metadata.generate_token_endpoint and metadata.livekit_url)
- MODEL_TYPE_DAILY: Pipecat Cloud agents (requires metadata.pipecat_api_key and metadata.agent_name)
- MODEL_TYPE_OPENAI_REALTIME: OpenAI Realtime voice-to-voice agents
- MODEL_TYPE_GEMINI_REALTIME: Gemini Live voice-to-voice agents
- MODEL_TYPE_GROK_REALTIME: Grok (xAI) Voice Agent voice-to-voice agents
- MODEL_TYPE_DEEPGRAM_REALTIME: Deepgram Voice Agent voice-to-voice agents
MODEL_TYPE_VOICE, MODEL_TYPE_OUTBOUND_VOICE, MODEL_TYPE_CHAT, MODEL_TYPE_CHAT_A2A, MODEL_TYPE_CHAT_WEBSOCKET, MODEL_TYPE_EMAIL, MODEL_TYPE_SMS, MODEL_TYPE_WEBSOCKET, MODEL_TYPE_LIVEKIT, MODEL_TYPE_DAILY, MODEL_TYPE_OPENAI_REALTIME, MODEL_TYPE_GEMINI_REALTIME, MODEL_TYPE_GROK_REALTIME, MODEL_TYPE_DEEPGRAM_REALTIME "MODEL_TYPE_VOICE"
Phone number in E.164 format (e.g., +12345678901) or SIP address (e.g., sip:user@domain.com).
Required for:
- MODEL_TYPE_VOICE agents (E.164 or SIP)
- MODEL_TYPE_SMS agents (E.164 only)
Optional for other agent types.
200"+12345678901"
Webhook endpoint URL that Coval will POST to.
Required for MODEL_TYPE_OUTBOUND_VOICE agents. Must be a valid HTTP/HTTPS URL.
200"https://api.yourcompany.com/triggers/voice-simulation"
Agent instructions/system prompt
50000"You are a helpful customer support agent..."
Your own external id for this agent. Defaults to the generated agent id when omitted.
1 - 200"my-support-agent"
Primary language for the agent
200"en"
Free-form agent attributes; referenceable in metric prompts as {{agent.<key>}}.
{ "company_name": "Acme Corp" }
Simulator-specific configuration (JSONB, max 10MB).
For CHAT agents:
Required:
chat_endpoint- Chat endpoint URL (validated, no private IPs/localhost)
Authentication:
authorization_header- Auth header (Bearer, X-API-Key, etc.)
Initialization:
initialization_endpoint- Init endpoint called before chat (validated URL)initialization_payload- JSON payload for init request (max 16KB)
Custom Data:
custom_data- Organization/agent-level data (max 32KB JSON string)custom_persona_data- Persona-specific data (max 16KB JSON string)
Headers & Format:
custom_headers- Additional headers with template variables, as a JSON object or JSON-encoded object string (max 16KB when encoded)response_format- "chat_completions" (default) or "responses"
Request/Response Processing:
input_template- Custom JSON template for requests (validated JSON)payload_wrapper- Wrapper field name (e.g., "data", "request")response_message_path- Dot notation path to extract messagestrip_message_timestamps- Remove timestamp fields (boolean, default: false)
Tool Calls:
tool_call_extraction_config- Configuration for extracting tool calls from custom responses
Dynamic Configuration:
persona_id- Reference persona for parameter substitution (22-char ShortUUID)
Template Variables: {{sessionId}}, {{simulation_output_id}}, {{init_response.path}}, {{persona.field}}, {{messages}}, {{latest_message}}, {{custom_data.field}}
For OUTBOUND_VOICE agents:
trigger_call_headers- JSON string with HTTP headerstrigger_call_payload- JSON string with base payloadphone_number_key- Field name for phone number (default: "phone_number")
For LIVEKIT agents:
Required:
generate_token_endpoint- HTTP/HTTPS endpoint Coval calls to create a participant tokenlivekit_url- LiveKit server URL using ws, wss, http, or https
Optional:
generate_token_headers- Token-request headers as a JSON object or encoded object stringtoken_request_payload- Fields merged into the token request as a JSON object or encoded object stringcontent_type- Convenience value for the token-requestContent-Typeheaderlivekit_agent_name- Agent dispatch name
For DAILY (Pipecat Cloud) agents:
Required:
pipecat_api_key- Pipecat Cloud API keyagent_name- Pipecat Cloud agent name
Optional:
custom_data- JSON-encoded object with string keys and string values (max 16KB)
For WEBSOCKET agents:
Required:
endpoint- WebSocket endpoint URL (must be wss://, validated). Required indirectconnection mode.
Connection mode:
connection_mode-direct(default),http_first, ortwiml_webhook.http_url,http_method,http_request_body,http_headers,websocket_url_response_path- HTTP-first setup fields whenconnection_mode=http_first.voice_url,voice_http_method,voice_http_headers,voice_form_fields,twilio_account_sid,twilio_from_number,twilio_to_number- TwiML voice-webhook fields whenconnection_mode=twiml_webhook.
Authentication (optional):
authorization_header- Auth header sent during the WebSocket handshake. Supports:"Bearer <token>"→ sent asAuthorization: Bearer <token>"Basic <base64-credentials>"→ sent asAuthorization: Basic <base64-credentials>"X-API-Key <key>"→ sent asX-API-Key: <key>
custom_headers- JSON object or JSON-encoded object string of additional HTTP headers for the WebSocket handshake.
Initialization & handshake (optional):
initialization_json- JSON object or JSON string payload sent after the WebSocket upgrade and before any ready-message wait.handshake_ready_message_type- Message type to wait for before streaming audio (defaultsession_readyin direct mode and empty inhttp_firstandtwiml_webhook; empty string skips the ready-message wait).handshake_requires_session_id- Whether the ready message must includesession_id(defaulttruein direct mode andfalseinhttp_firstandtwiml_webhook).handshake_timeout_seconds- Seconds Coval waits for the ready message (default30).
Audio format (optional):
send_audio_template- JSON template for outbound audio. Must contain{{audio_data}}. Setting it exactly to{{audio_data}}sends raw PCM bytes (default{"type":"audio_chunk","data":"{{audio_data}}"}).message_type_path- Dot-notation path to the field naming the inbound message kind (defaulttype).audio_message_type_value- Value identifying an audio frame; use*to treat every JSON message as audio (defaultaudio_chunk).audio_data_path- Dot-notation path to the inbound base64 audio payload (defaultdata).audio_encoding- JSON audio payload encoding:pcm(default),mp3, orulaw. MP3 is inbound-only;ulawsends and receives G.711 mu-law audio.receive_audio_channels-1for mono inbound JSON PCM or2for legacy stereo-to-mono averaging (default2).send_sample_rate_hertz- Outbound sample rate. One of 8000, 16000, 24000, 48000 (default 16000).receive_sample_rate_hertz- Inbound sample rate. One of 8000, 16000, 24000, 48000 (default 48000).pipeline_sample_rate_hertz- Pipeline-internal rate; must remain 16000.pace_inbound_binary_audio- Boolean, paces inbound binary PCM at real-time. Defaults on when outbound audio is configured for raw PCM bytes, off for JSON templates.send_media_template- Outbound template for image attachments. Must contain{{media_data}}; may also include{{media_name}}and{{mime_type}}. Set exactly to{{media_data}}to send raw bytes, otherwise Coval base64-encodes the image into the JSON template.send_dtmf_template- Outbound template for keypad digits. Must contain{{digit}}.
Per-simulation placeholders:
- Connection setup fields support
{{run_id}},{{simulation_output_id}}(legacy alias{{simulation_id}}),{{stream_sid}},{{call_sid}},{{agent.*}},{{test_case.*}},{{sim_wrapper.*}}, and{{run_metadata.*}}. - Connection setup fields are
initialization_jsonin direct and HTTP-first modes;custom_headersin every mode;http_request_bodyandhttp_headersin HTTP-first mode; andvoice_form_fieldsandvoice_http_headersin TwiML webhook mode. {{stream_sid}}and{{call_sid}}also resolve insend_audio_template,send_media_template, andsend_dtmf_template. Coval generates fresh Twilio-shaped values for every simulation.
Non-audio event capture (optional):
non_audio_event_message_types- List of message-type values to emit asWebsocketEventFrames instead of dropping. Each match carries the message type, optionaleventname, and original payload. Useful for cart updates, transcript fragments, or session telemetry.
Compatibility profile (optional):
websocket_compat_profile- One ofgenericorjson_audio. Forces the simulator routing decision. Usejson_audiofor the JSON audio preset shape.
{ "chat_endpoint": "https://api.example.com/v1/chat", "authorization_header": "Bearer sk-xxx" }
Workflow configuration (JSONB, max 10MB)
{}
Associated metric IDs (22-char IDs)
^[A-Za-z0-9]{22}$["abc123def456ghi789jklm"]
Associated test set IDs (8-char IDs)
^[A-Za-z0-9]{8}$["gT5wq2Hn"]
Tags to associate with this agent. Null or omitted creates the agent with no tags. Pass [] for an empty tag list.
201 - 200["production", "voice"]
Response
Agent created successfully
Agent configuration resource.
Note: The active field (soft delete status) is managed internally and not exposed in API responses.
Show child attributes
Show child attributes
Was this page helpful?