Skip to main content
Many metric types are configurable: you supply a prompt, a pattern, or a threshold and Coval runs it like any built-in metric. This page covers the configuration options shared across metrics — how to inject dynamic values, focus a metric on part of a conversation, and give it visibility into your agent’s traces. For prompt-writing technique itself, see Write judge prompts.

Template variables

You can embed dynamic values from agents, test cases, and uploaded conversations into your metric prompts using template variables. The system replaces each placeholder with the actual value for the simulation or conversation being evaluated, so one metric adapts to many configurations.

{{agent.*}} — Agent attributes

Reference custom properties defined on the agent configuration with {{agent.attribute_name}}. The placeholder is replaced with the attribute value from the agent under evaluation.
Given the transcript, did the assistant provide the correct opening hours?

The correct opening hours are: {{agent.opening_hours}}

Return YES if:
• The assistant stated the opening hours as {{agent.opening_hours}}
• The assistant provided hours that match exactly (e.g., "9 AM to 5 PM" matches "9:00am-5:00pm")

Return NO if:
• The assistant provided different opening hours than {{agent.opening_hours}}
• The assistant claimed not to know the opening hours

{{expected_output.*}} — Test case expected outputs

Reference values from a test case’s expected output with {{expected_output.<key>}}. For a test case whose expected output carries source, destination, and ticket_class:
Given the transcript, did the assistant correctly process the flight booking request?

The booking details are:
- Source: {{expected_output.source}}
- Destination: {{expected_output.destination}}
- Ticket Class: {{expected_output.ticket_class}}

Return YES if:
• The assistant confirmed all three details correctly using the exact values:
  {{expected_output.source}}, {{expected_output.destination}}, and {{expected_output.ticket_class}}
You can combine agent and expected-output attributes in the same prompt for context-aware evaluations.

{{customer_metadata.<key>}} — Upload-time values

Reference per-conversation values you provide at upload time with {{customer_metadata.<key>}}. This is useful for evaluating monitored production calls against ground truth known only at upload time — prices, order totals, confirmation numbers, expected outcomes. Each conversation is judged against its own metadata value. See Customer Metadata (Upload-Time Values).
For full documentation — nested paths, array indexing, dynamic keys, and examples — see Attributes.

Transcript scope

Transcript Scope focuses metric evaluation on specific portions of a conversation rather than the entire transcript, reducing noise and improving accuracy for targeted assessments. It is available for all LLM Judge metrics (Binary, Numerical, Categorical) and Multimodal/Audio LLM Judge metrics.

Configuration

Set the Transcript Scope toggle to:
  • Full (default) — Evaluate the entire transcript.
  • Custom — Apply filters to focus on specific messages.
Transcript Scope UI
Limit evaluation to messages from specific speakers:
  • Agent — Only assistant/agent messages
  • User — Only user/customer messages
  • Both — Messages from the selected roles
Useful when you want to assess agent behavior without user input affecting the evaluation, or vice versa.
Limit evaluation to a portion of the conversation:
  • Last N turns — Only the final N message exchanges
  • First N turns — Only the opening N message exchanges
Useful for evaluating specific phases such as greetings, closings, or resolution attempts.
Use caseFilter configuration
Evaluate only agent responsesRole filter: agent
Check the closing of a conversationRange filter: Last 3 turns
Assess user sentiment onlyRole filter: user
Focus on recent contextRange filter: Last N messages
Combine filters for precise control. A Role filter (agent) plus a Range filter (last 5 turns) evaluates just the agent’s closing performance.

Scope for audio metrics

When using Transcript Scope with Multimodal/Audio LLM Judge metrics, Coval automatically:
  1. Filters the transcript to the selected messages.
  2. Uses message timestamps to extract the corresponding audio segments.
  3. Merges adjacent segments (within 0.5 seconds) to avoid artifacts.
  4. Sends only the filtered audio to the LLM.
This enables focused audio evaluations — e.g., the agent’s speech quality in the last 3 turns — while reducing processing time and token cost.

Benefits

  • More accurate — Removes noise from irrelevant messages.
  • Lower cost — Processes less content per evaluation.
  • Faster — Smaller context means quicker LLM responses.

Trace context

Trace Context gives an LLM Judge or Composite Evaluation metric visibility into what your agent actually did — not just what it said — by including OpenTelemetry span data alongside the transcript. When Include Traces is enabled on a custom transcript scope, the judge receives a TRACE CONTEXT: block appended to its prompt. This block summarizes the conversation’s OTel spans: span names, timing windows, and key attributes like tool call names and function arguments. For Composite Evaluation metrics the same block is appended to every per-criterion prompt.

When to enable

Trace context is most useful when the behavior you want to evaluate isn’t visible in the transcript alone:
Use caseWhy traces help
Verify the agent used the right tools in the right orderTool call spans show what functions were invoked and with what arguments
Catch hallucinations — agent claimed to do something it didn’tTrace spans show whether the action actually occurred
Evaluate retrieval qualityRetrieval spans show what data was fetched before the agent responded
Assess error handlingError spans reveal failures the agent may have silently recovered from

How to enable

  1. Open or create a supported metric — LLM Judge (Binary, Numerical, Categorical, or Audio) or Composite Evaluation.
  2. Set Transcript Scope to Custom.
  3. In the custom scope panel, toggle Include Traces on.
The trace context is appended automatically — no prompt changes are required, though referencing it explicitly improves results.

Requirements

  • Your agent must emit OpenTelemetry traces to Coval. See the OpenTelemetry Traces guide for setup.
  • The simulation must have produced trace data. If none is available, the toggle has no effect and the prompt is sent without a trace block.

Writing prompts that use trace context

Reference the trace data explicitly and instruct the judge to reason about both sources. For example, to verify tool usage:
Given the transcript and trace context, did the assistant call the `lookup_account`
function before providing account balance information?

Return YES if:
• The TRACE CONTEXT shows a tool call to `lookup_account` (or equivalent) occurring
  before the agent stated the balance
• The transcript confirms the agent provided balance details

Return NO if:
• The agent mentioned account balance but no `lookup_account` tool call appears in the TRACE CONTEXT
• The tool call appears AFTER the agent stated the balance (out of order)
• The TRACE CONTEXT shows a failed or missing tool call for this operation

Note: If no TRACE CONTEXT is provided, evaluate based on transcript alone.
Add “Note: If no TRACE CONTEXT is provided, evaluate based on transcript alone” to your prompt. This makes the metric degrade gracefully on simulations where traces weren’t captured.