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.

{{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:
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.
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:

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:
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.