Overview
If you have chat agents or want to simulate your voice agent conversations without calls, you can use Coval the same way it’s used for voice simulations by generating text conversations. Create test sets, define metrics, and configure templates to evaluate your chat agents automatically. Requirements: Provide a custom text endpoint that Coval can connect toQuick Start
Minimum Required Configuration:- Chat Endpoint - The URL where your agent receives messages
- Authorization Header - Authentication credentials for your API
Core Configuration
Chat Endpoint (Required)
The primary URL where Coval sends conversation messages during simulation. Format: Full HTTPS URL- Must use HTTPS (HTTP will be auto-upgraded)
- Cannot use local/private IP addresses
- Must return JSON responses
Authorization Header (Required)
Authentication credentials sent with every API request. Common Formats:Bearer Token
API Key
Custom Authorization
Standard Protocol
The standard integration for chat uses an HTTP, JSON-based API endpoint that you provide. When running a simulation, Coval’s simulator, acting as a user, will connect to the endpoint to get responses from your agent. We use OpenAI’s chat completions format, although we also support receiving responses in the OpenAI responses format. Query strings are not allowed in URLs.Optional Configuration
Initialization Endpoint
Called once before the conversation starts to set up session state. When to use:- Your API requires session initialization
- You need to obtain a session ID or auth token
- You want to pre-configure conversation context
- Coval calls the initialization endpoint with your initialization payload
- The response is captured and made available to subsequent chat requests via template variables like
{{sessionId}}or{{init_response.conversationId}}in your input template and custom headers
The initialization endpoint is called before any chat messages are sent. The input template is only used for chat requests — it does not affect the initialization call.
Initialization Payload
JSON payload sent to the initialization endpoint. Format: Valid JSON| Variable | Description | Example Value |
|---|---|---|
{{simulation_output_id}} | Unique ID for this simulation | "sim-abc-123" |
{{persona.field}} | Data from persona metadata | {{persona.user_id}} |
{{persona.field}} variables, add initialization_parameters to your Persona’s metadata:
Custom Data
Additional JSON data included in every chat request (for APIs using standard payload format). Format: Valid JSONinput_template. If you use input_template, reference custom data with {{custom_data.field}} instead.
Custom Headers
Additional HTTP headers sent with every chat request, with support for dynamic values from the initialization response. Format: Valid JSON object with string keys and values| Variable | Description | Example |
|---|---|---|
{{sessionId}} | Session ID from init response | Extracted from init_response.sessionId |
{{simulation_output_id}} | Unique simulation ID | Generated by Coval |
{{init_response.path}} | Any nested field from init response | {{init_response.auth.token}} |
Chat Messages
Your chat endpoint should be an HTTPS URL that will respond to POST requests with a JSON body. If an Authorization token was provided, it will be included in the headers. Initial Request from Coval:Advanced Configuration
Response Format
Determines the format for tool call responses sent to your API. Options:Chat Completions (Default)
Standard OpenAI format for tool responses:Responses API
Alternative format for function call outputs:response_format to your model configuration:
- Chat Completions (Default)
- Responses API
Tool Calls
You can include tool/function calls in the Responses format:Payload Wrapper
Wraps the entire payload in a specified field name. When to use: Your API requires all payloads nested under a specific key (e.g.,data, request, body).
Example:
Without wrapper:
"data":
datarequestbodypayload
Input Template
Completely customize the JSON payload sent to your chat endpoint on each conversation turn.The input template is not used for the initialization endpoint — that call always uses the initialization payload. The simulation flow is:
- Coval calls your initialization endpoint with the initialization payload
- The init response is captured
- For each chat turn, Coval uses the input template to build the request to your chat endpoint — and you can reference fields from the init response (e.g.
{{init_response.conversation_id}})
- Your API expects a non-standard payload format
- You need to include specific fields from initialization response
- You want fine-grained control over the request structure
| Variable | Type | Description |
|---|---|---|
{{messages}} | Array | Full conversation history |
{{latest_message}} | String | Most recent user message content |
{{sessionId}} | String | Session ID (from init response or simulation ID) |
{{simulation_output_id}} | String | Unique simulation identifier |
{{custom_data}} | Object | The custom data object |
{{custom_data.field}} | Any | Specific field from custom data |
{{any.nested.path}} | Any | Extract any field from init response using dot notation |
input_template, the custom_data field is ignored. Reference custom data using {{custom_data}} or {{custom_data.field}} in your template instead.
Response Message Path
Tells Coval where to find the assistant’s message in your API response using dot notation. When to use: Your API returns a non-standard response format. Default Behavior (when not set): Expects response in this format:- Use
.to navigate nested objects:data.response.text - Use numeric indices for arrays:
choices.0.message - Combine for complex paths:
data.results.0.output.text
Strip Message Timestamps
Removestimestamp fields from messages before sending to your API.
When to use: Your API rejects requests containing timestamp fields.
Default: Disabled (timestamps included)
Example:
With timestamps (default):
Ending the Chat
You can end the conversation by setting “status” to “ended” in your response:Common Configuration Patterns
Pattern 1: OpenAI-Compatible API
Pattern 2: API with Session Initialization
Pattern 3: Custom API Format with Template
Pattern 4: API with Payload Wrapper
Pattern 5: Complex Custom Format
Troubleshooting
Error: “Failed to run simulation due to an unexpected error”
Problem: This generic error often indicates an issue with your agent configuration, most commonly an invalid input template. Common causes:- Unquoted string variables in your input template (e.g.
{{init_response.id}}instead of"{{init_response.id}}") - Malformed JSON in your input template, initialization payload, or custom data
- Invalid field references in template variables
Error: “Invalid JSON response from endpoint”
Problem: Your API returned non-JSON response Solution: Ensure your endpoint returnsContent-Type: application/json
Error: “Could not extract message from path ‘X’ in response”
Problem: Response message path doesn’t match your API response structure Solution: Verify the path using dot notation matches your actual response structureError: “messages.0.property timestamp should not exist”
Problem: Your API rejects timestamp fields Solution: Enable “Strip Message Timestamps”Tool calls not showing in transcript
Problem: Tool call extraction not configured Solution: Verify your API returns OpenAI-compatible format or contact support for custom tool call extraction configurationSession ID not working in headers
Problem: Template variable not being substituted Solution: Verify initialization endpoint returnssessionId field, or check custom headers configuration
Best Practices
- Start Simple: Begin with just Chat Endpoint and Authorization, add complexity as needed
- Test Incrementally: Add one advanced feature at a time and test
- Use Template Variables: Leverage
{{sessionId}}and init response fields to maintain session state - Validate JSON: Always validate JSON fields before saving
- Check API Logs: Use your API server logs to debug payload/response format issues
- Document Custom Formats: Keep notes on your API’s expected format for future reference

