Connect an agent
Connect an agent to coval by providing the agent’s configuration.
Authorizations
API key for authentication
Body
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_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_OPENAI_REALTIME: OpenAI Realtime voice-to-voice agents
- MODEL_TYPE_GEMINI_REALTIME: Gemini Live voice-to-voice agents
MODEL_TYPE_VOICE, MODEL_TYPE_OUTBOUND_VOICE, MODEL_TYPE_CHAT, MODEL_TYPE_CHAT_A2A, MODEL_TYPE_CHAT_WEBSOCKET, MODEL_TYPE_SMS, MODEL_TYPE_WEBSOCKET, MODEL_TYPE_OPENAI_REALTIME, MODEL_TYPE_GEMINI_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..."
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 WEBSOCKET agents:
Required:
endpoint- WebSocket endpoint URL (must be wss://, validated). Required indirectconnection mode.
Connection mode:
connection_mode-direct(default) orhttp_first. Inhttp_firstmode Coval issues an HTTP request first and dials the WebSocket URL returned in the response.http_url,http_method,http_request_body,http_headers,websocket_url_response_path- HTTP-first setup fields whenconnection_mode=http_first.
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_first; empty string skips the ready-message wait).handshake_requires_session_id- Whether the ready message must includesession_id(defaulttruein direct mode andfalseinhttp_first).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- Inbound JSON audio payload encoding:pcm(default) ormp3.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.
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.
["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.

