WebSocket
A persistent WebSocket connection.
A2A (JSON-RPC)
The A2A v2 JSON-RPC protocol.
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:- Chat Endpoint - The URL where your agent receives messages
- Authorization Header - Authentication credentials for your API
Configuration reference
The standard connection has two required fields; everything else is optional. Jump to any field for details.| Field | Required | Description |
|---|---|---|
| Chat Endpoint | Yes | URL where Coval sends conversation messages |
| Authorization Header | Yes | Auth credentials sent with every request |
| Initialization Endpoint | No | Called once before the conversation to set up session state |
| Initialization Payload | No | JSON body sent to the initialization endpoint |
| Custom Data | No | Extra JSON included in every chat request |
| Custom Headers | No | Extra HTTP headers, with dynamic template values |
| Response Format | No | Chat Completions (default) or Responses API for tool results |
| Tool Calls | No | Include tool/function calls in the Responses format |
| Payload Wrapper | No | Nest the payload under a field name your API requires |
| Input Template | No | Reshape the request body for non-standard APIs |
| Response Message Path | No | Where to read the agent’s reply in a non-standard response |
| Strip Message Timestamps | No | Remove timestamps if your API rejects them |
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
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.| Field | Required | Description |
|---|---|---|
| Chat Endpoint | Yes | URL of the OpenAI-compatible chat completions API (e.g. https://api.openai.com/v1/chat/completions) |
| Authentication Token | Yes | API key for the endpoint (stored encrypted) |
| Model | No | Which model to use (default gpt-4o) |
| System Prompt | No | System instructions defining the agent’s behavior |
| Temperature | No | Response randomness, 0.0–2.0 (default 1.0) |
| Max Tokens | No | Maximum tokens to generate (≤ 100,000) |
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: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, the test case, and the agent. 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}} |
{{test_case.<attribute>}} | A test case attribute — per-test-case state, injected into the header at run time | {{test_case.account_id}} |
{{agent.<attribute>}} | An agent attribute — shared across all test cases for this agent | {{agent.region}} |
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
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 |
{{test_case.<attribute>}} | Any | A test case attribute — per-test-case state; quote it only when the resolved value is a string |
{{agent.<attribute>}} | Any | An agent attribute — shared across all test cases for this agent; quote it only when the resolved value is a string |
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
| Symptom | Likely cause | Fix |
|---|---|---|
Failed to run simulation due to an unexpected error | Invalid input template — unquoted string variables, malformed JSON, or bad field references | Check the template for valid JSON and wrap string variables in quotes (see quoting rules) |
Invalid JSON response from endpoint | API returned a non-JSON response | Return Content-Type: application/json |
Could not extract message from path 'X' in response | Response message path doesn’t match your response structure | Verify the dot-notation path matches your actual response |
messages.0.property timestamp should not exist | API rejects timestamp fields | Enable Strip Message Timestamps |
| Tool calls not showing in transcript | Tool-call extraction not configured | Ensure the API returns OpenAI-compatible format, or contact support for custom extraction |
| Session ID not working in headers | Template variable isn’t being substituted | Confirm the init endpoint returns a sessionId field and check custom headers |