Skip to main content
Connect a text chat agent to Coval to simulate conversations — useful for chat agents, or for testing a voice agent’s logic without placing calls. Coval supports three chat connection types. Most agents use the standard connection, which this page covers. If your agent uses a different transport, use one of the others:

WebSocket

A persistent WebSocket connection.

A2A (JSON-RPC)

The A2A v2 JSON-RPC protocol.
The standard connection is an HTTP endpoint you provide that returns responses in OpenAI chat-completions format. You can also point Coval directly at an OpenAI-compatible API. Requirement: a text endpoint Coval can reach.
How to use this page. Most agents need only Quick Start and the two required fields to connect. Everything else is optional — add initialization or custom headers if your API needs them, use Advanced Configuration for non-standard request/response shapes, and treat Common Configuration Patterns and Troubleshooting as reference.

Quick Start

Minimum Required Configuration:
  1. Chat Endpoint - The URL where your agent receives messages
  2. Authorization Header - Authentication credentials for your API
All other fields are optional and depend on your API’s requirements.

Configuration reference

The standard connection has two required fields; everything else is optional. Jump to any field for details.

Core Configuration

Chat Endpoint (Required)

The primary URL where Coval sends conversation messages during simulation. Format: Full HTTPS URL
Requirements:
  • Must use HTTPS (HTTP will be auto-upgraded)
  • Cannot use local/private IP addresses
  • Must return JSON responses
Example:

Authorization Header (Required)

Authentication credentials sent with every API request. Common Formats:

Bearer Token

API Key

Custom Authorization

UI Tip: Use the dropdown to select your auth type, then paste your token/key. The system automatically formats the header correctly.

Connecting an OpenAI-compatible API

Instead of pointing at your own agent backend, you can point Coval directly at any OpenAI-compatible chat completions API. This is useful for testing a model and system prompt without a backend in front of it — Coval calls the API and drives the model itself. Everything else on this page — initialization, custom headers, input templates, response format — applies the same way.

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.

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:
Expected Response Format: Standard format:
Or in the newer Responses format:

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
Format: Full HTTPS URL
Example Response:
How it works:
  1. Coval calls the initialization endpoint with your initialization payload
  2. 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
Template Variables Available: Example with Variables:
Persona Integration: To use {{persona.field}} variables, add initialization_parameters to your Persona’s metadata:
Then reference in payload:

Custom Data

Additional JSON data included in every chat request (for APIs using standard payload format). Format: Valid JSON
How it’s sent:
Note: Only used when NOT using input_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, the test case, and the agent. Format: Valid JSON object with string keys and values
Template Variables Available: Because custom_headers sends string header values, {{test_case.<attribute>}} and {{agent.<attribute>}} should resolve to the exact header text you want to send. If you want a numeric- or boolean-looking header value, store that exact text in the attribute. Objects and arrays are not supported in headers; use input_template instead for structured values. Common Use Cases: Use Case 1: Session ID in Header
Use Case 2: Nested Auth Token
Use Case 3: Mixed Static and Dynamic
Use Case 4: Per-Test-Case State Pass state (e.g. an account or customer ID) into your agent so its backend resolves the right context for each test case. Add the value as a test case attribute (one value per case), then reference it in the header. Coval substitutes each test case’s value at run time:
Field Size Limit: 16kB maximum

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:
Configure the response format by adding response_format to your model configuration:
Coval will respond with the entire chat history in the format specified:
When to use: Only change this if your API explicitly requires the Responses API format for tool calls. Most APIs use the default Chat Completions format.

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:
With wrapper set to "data":
Common Values:
  • data
  • request
  • body
  • payload

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:
  1. Coval calls your initialization endpoint with the initialization payload
  2. The init response is captured
  3. 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}})
When to use:
  • 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
Format: JSON with template variable placeholders Available Template Variables: Example Templates: Example 1: Simple Custom Format
Example 2: Nested Init Response Fields
Example 3: String Substitution
Note: When using input_template, the custom_data field is ignored. Reference custom data using {{custom_data}} or {{custom_data.field}} in your template instead.
Quoting rules for template variables:
  • Object/Array variables ({{messages}}, {{custom_data}}) substitute to valid JSON literals — do not wrap them in quotes.
  • String variables ({{sessionId}}, {{latest_message}}, {{init_response.*}}) substitute to plain text — you must wrap them in quotes.
  • Any variables ({{custom_data.field}}, {{any.nested.path}}, {{test_case.<attribute>}}, {{agent.<attribute>}}) follow the resolved value’s JSON type — quote strings, but leave numbers, booleans, objects, and arrays unquoted.
For example, "conversation_id": {{init_response.conversation.id}} produces invalid JSON because the substituted value is not quoted. Use "conversation_id": "{{init_response.conversation.id}}" 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:
Custom Path Examples: Example 1: Direct Field
Extracts from:
Example 2: Nested Object
Extracts from:
Example 3: Array Index
Extracts from:
Path Notation Rules:
  • 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

Removes timestamp 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):
With stripping enabled:
Common Error Pattern:
If you see this error, enable “Strip Message Timestamps”.

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