Create metric
Create a new custom evaluation metric.
Required fields vary by metric type:
| Metric Type | Required Fields |
|---|---|
| METRIC_AGENT_JUDGE | prompt |
| METRIC_AGENT_JUDGE_CATEGORICAL | prompt, categories |
| METRIC_AGENT_JUDGE_NUMERICAL | prompt, min_value, max_value |
| METRIC_LLM_BINARY | prompt |
| METRIC_CATEGORICAL | prompt, categories |
| METRIC_NUMERICAL_LLM_JUDGE | prompt, min_value, max_value |
| METRIC_AUDIO_LLM_BINARY | prompt |
| METRIC_AUDIO_LLM_CATEGORICAL | prompt, categories |
| METRIC_AUDIO_LLM_NUMERICAL | prompt, min_value, max_value |
| METRIC_TOOLCALL | prompt |
| METRIC_METADATA_FIELD | metadata_field_type, metadata_field_key |
| METRIC_TRANSCRIPT_REGEX | regex_pattern |
| METRIC_PAUSE_ANALYSIS | min_pause_duration_seconds |
Authorizations
API key for authentication
Headers
Workspace that scopes this operation. When omitted, the organization's active default workspace is used when one can be resolved.
1 - 26Body
Create metric request
Display name
1 - 200Metric description
1 - 1000Metric evaluation type.
METRIC_AGENT_JUDGE- Agentic binary evaluation with bounded evidence toolsMETRIC_AGENT_JUDGE_CATEGORICAL- Agentic categorical evaluation with bounded evidence toolsMETRIC_AGENT_JUDGE_NUMERICAL- Agentic numerical evaluation with bounded evidence toolsMETRIC_LLM_BINARY- Yes/no LLM evaluationMETRIC_CATEGORICAL- Multi-class classificationMETRIC_NUMERICAL_LLM_JUDGE- Numerical scoring (1-N)METRIC_AUDIO_LLM_BINARY- Audio-based yes/noMETRIC_AUDIO_LLM_CATEGORICAL- Audio-based classificationMETRIC_AUDIO_LLM_NUMERICAL- Audio-based scoringMETRIC_TOOLCALL- Tool/function call evaluationMETRIC_METADATA_FIELD- Extract metadata fieldMETRIC_TRANSCRIPT_REGEX- Regex pattern matchingMETRIC_PAUSE_ANALYSIS- Speech pause detectionMETRIC_SQL_FLOAT- Custom SQL query over the simulation's data (setsql_query)METRIC_COMPOSITE_EVALUATION- Judges a list of criteria independently and reports how many were met (setcriteria_source, andcriteria_pathorcriteriato match)
METRIC_LLM_BINARY, METRIC_AGENT_JUDGE, METRIC_AGENT_JUDGE_CATEGORICAL, METRIC_CATEGORICAL, METRIC_AUDIO_LLM_BINARY, METRIC_AUDIO_LLM_CATEGORICAL, METRIC_TOOLCALL, METRIC_METADATA_FIELD, METRIC_AGENT_JUDGE_NUMERICAL, METRIC_NUMERICAL_LLM_JUDGE, METRIC_AUDIO_LLM_NUMERICAL, METRIC_TRANSCRIPT_REGEX, METRIC_USER_FRUSTRATION, METRIC_AGENT_REFUSAL, METRIC_PAUSE_ANALYSIS, METRIC_SQL_FLOAT, METRIC_COMPOSITE_EVALUATION, METRIC_LLM_TTFB, METRIC_TTS_TTFB, METRIC_STT_TTFB, METRIC_LLM_TOKEN_USAGE, METRIC_TOOL_CALL_RATE, METRIC_TRACE_STT_WER, METRIC_TRACE_AUDIO_UPLOAD_STT_WER, METRIC_CUSTOM_TRACE, METRIC_VOICE_QUALITY, METRIC_PHONEME_STRETCH, METRIC_SYLLABLE_RATE, METRIC_LOOP_DETECTION, METRIC_CODEC_ARTIFACT, METRIC_CLIPPING_ARTIFACT, METRIC_DROPOUT_ARTIFACT, METRIC_TIMBRE_DRIFT, METRIC_SPEECH_ARTIFACT_ANOMALY, METRIC_PITCH_VARIABILITY, METRIC_NON_EXPRESSIVE_PAUSES, METRIC_ABRUPT_PITCH_CHANGES, METRIC_TERMINAL_CONTOUR, METRIC_LUFS, METRIC_VOLUME, METRIC_VOCAL_FRY, METRIC_DERIVED_STRICT_LOGIC, METRIC_DERIVED_AGGREGATE, METRIC_IVR_FLOW_ADHERENCE, METRIC_CUSTOM_AGENT_FAILS_TO_RESPOND, METRIC_CUSTOM_AGENT_NEEDS_REPROMPTING, METRIC_CUSTOM_AUDIO_FREQUENCY, METRIC_CUSTOM_AUDIO_SENTIMENT, METRIC_CUSTOM_END_REASON, METRIC_MATCH_EXPECTED_OUTPUT, METRIC_SPEAKING_TIME_PERCENTAGE, METRIC_SPECTROGRAM_PITCH_ANALYSIS, METRIC_VOLUME_PITCH_MISALIGNMENT, METRIC_WORDS_PER_MESSAGE_WITH_THRESHOLD LLM Judge execution mode. Agentic mode is available for text LLM Judges only.
STANDARD, AGENTIC LLM evaluation prompt. Required for LLM-based metrics.
Agentic LLM Judge tools. Omit to use V1 defaults; pass an empty list to disable all tools.
Evidence tool available to an Agent Judge metric.
get_transcript, search_transcript, search_transcript_regex, get_trace_spans, query_simulation_frames, get_run_context, get_evidence_manifest, get_simulation_outcome, get_dependency_metric_outputs Agent Judge metric dependencies. Omit for none; dependencies must be selected explicitly in runs.
101Categories for classification. Required for categorical metrics.
2 - 50 elementsMinimum score. Required for numerical metrics.
Maximum score. Required for numerical metrics.
Field type. Required for METRIC_METADATA_FIELD.
STRING, NUMBER, BOOLEAN Metadata key. Required for METRIC_METADATA_FIELD.
Regex pattern. Required for METRIC_TRANSCRIPT_REGEX.
Speaker role filter. Aliases user and assistant are normalized on write.
agent, persona, user, assistant Min pause duration in seconds. Required for METRIC_PAUSE_ANALYSIS.
x >= 0.5x > 0x > 0x > 0above, below 1Neutral, Happy, Angry, Sad 0 <= x <= 1001UNKNOWN, IDLE_TIMEOUT, DURATION_LIMIT, PERSONA_DISCONNECTED, AGENT_DISCONNECTED, PIPELINE_ERROR, REPETITION_LOOP, AUDIO_UPLOAD_PLAYBACK_COMPLETED, SCRIPT_COMPLETED, SCRIPT_DIVERGED 11Optional dot path; brackets must contain an integer index or comma-separated key=value filters.
1x > 0x >= 0<, <=, >, >=, ==, != IVR flow definition (required for METRIC_IVR_FLOW_ADHERENCE). The same flow tree the flow builder in the Coval UI produces; binding it here makes the metric runnable without a UI step.
Show child attributes
Show child attributes
{ "start_node": "greeting", "nodes": [ { "id": "greeting", "prompt": "Welcome to Acme Support. Press 1 for sales, 2 for support." }, { "id": "sales", "prompt": "Connecting you to our sales team.", "terminal": true }, { "id": "support", "prompt": "Please describe your issue after the tone.", "terminal": true } ], "edges": [ { "source": "greeting", "destination": "sales", "input": "1" }, { "source": "greeting", "destination": "support", "input": "2" } ] }
SQL query run against the simulation's data. Required for METRIC_SQL_FLOAT.
The query returns one row per timestamp with a numeric value and a
start_offset_milliseconds; set aggregation_method (SUM, AVERAGE, MIN, MAX,
or COUNT; default AVERAGE) to reduce those rows to a single value, and unit
for the reported unit. SQL metric units use exact result-unit identifiers: s for
seconds, ms for milliseconds, count, percent, or another supported result unit.
Do not use seconds or milliseconds. Omit unit for a unitless result; an
unsupported SQL unit is rejected before the metric is saved.
50000"SELECT start_offset_milliseconds, latency_milliseconds AS value FROM events"
Aggregation method for custom trace values, or SUM, AVERAGE, MIN, MAX, or COUNT for METRIC_SQL_FLOAT (default AVERAGE).
Optional display unit. For METRIC_SQL_FLOAT, use a result-unit identifier such as s, ms, count, or percent; null selects a unitless result.
32Where the metric reads its criteria from. Required for METRIC_COMPOSITE_EVALUATION.
test_case reads a field off each test case (most commonly its expected behaviors),
test_case_attribute reads from the test case's attributes, and metric_metadata
uses the fixed list in criteria.
test_case, test_case_attribute, metric_metadata "test_case"
Path to the criteria on the source. Required when criteria_source is test_case
or test_case_attribute.
200"expected_behaviors"
Literal list of criteria. Required when criteria_source is metric_metadata.
["The agent confirms the appointment time"]
How per-criterion verdicts aggregate into the metric's value. Each criterion is judged
independently as met or not met; percentage_of_criteria_met scores the fraction met
among the criteria the judge could evaluate.
percentage_of_criteria_met, count_of_criteria_met, all_criteria_met "percentage_of_criteria_met"
Custom prompt template used to evaluate each criterion. Include a {criterion}
placeholder; if it is omitted the criterion is appended to the prompt.
50000Inject OTel trace context into the LLM judge prompt during evaluation.
Supported for LLM judge metric types and METRIC_COMPOSITE_EVALUATION (METRIC_LLM_BINARY,
METRIC_CATEGORICAL, METRIC_NUMERICAL_LLM_JUDGE, METRIC_AUDIO_LLM_BINARY,
METRIC_AUDIO_LLM_CATEGORICAL, METRIC_AUDIO_LLM_NUMERICAL, METRIC_COMPOSITE_EVALUATION).
Restrict an audio metric to part of the recording, for example only the caller with
{"include": [{"type": "speaker", "speakers": ["persona"]}]}. Omit or send null to use the metric's
default scope. Supported for METRIC_ABRUPT_PITCH_CHANGES, METRIC_AUDIO_LLM_BINARY, METRIC_AUDIO_LLM_CATEGORICAL, METRIC_AUDIO_LLM_NUMERICAL, METRIC_CLIPPING_ARTIFACT, METRIC_CODEC_ARTIFACT, METRIC_CUSTOM_AGENT_NEEDS_REPROMPTING, METRIC_CUSTOM_AUDIO_FREQUENCY, METRIC_CUSTOM_AUDIO_SENTIMENT, METRIC_DROPOUT_ARTIFACT, METRIC_LOOP_DETECTION, METRIC_LUFS, METRIC_NON_EXPRESSIVE_PAUSES, METRIC_PAUSE_ANALYSIS, METRIC_PHONEME_STRETCH, METRIC_PITCH_VARIABILITY, METRIC_SPEAKING_TIME_PERCENTAGE, METRIC_SPECTROGRAM_PITCH_ANALYSIS, METRIC_SPEECH_ARTIFACT_ANOMALY, METRIC_SYLLABLE_RATE, METRIC_TERMINAL_CONTOUR, METRIC_TIMBRE_DRIFT, METRIC_VOCAL_FRY, METRIC_VOICE_QUALITY, METRIC_VOLUME, METRIC_VOLUME_PITCH_MISALIGNMENT; rejected with 400 for any other type.
Show child attributes
Show child attributes
{ "include": [ { "type": "speaker", "speakers": ["persona"] } ] }
Override the LLM model used for metric evaluation. If omitted, the platform default
model is used. Use GET /v1/models/metric to list available models.
Not supported for audio metric types (METRIC_AUDIO_LLM_BINARY,
METRIC_AUDIO_LLM_CATEGORICAL, METRIC_AUDIO_LLM_NUMERICAL),
which always use the platform-default audio model.
Show child attributes
Show child attributes
Target condition for metric evaluation
- Option 1
- Option 2
Show child attributes
Show child attributes
{ "comparison_operator": "in", "target_values": ["YES"] }
Tags to associate with this metric. Null or omitted creates the metric with no tags. Pass [] for an empty tag list.
["production"]
Apply case-insensitive matching (default: false)
METRIC_ABRUPT_PITCH_CHANGES / METRIC_NON_EXPRESSIVE_PAUSES / METRIC_VOCAL_FRY preset (recommended). 'strict' flags more, 'normal' is the default, 'lenient' flags fewer. Omit to use 'normal'.
strict, normal, lenient Advanced (dB): offset below baseline HNR under which a frame is fry (less negative flags more).
-25 <= x < 0Advanced: multiple of baseline jitter above which a frame is fry (lower flags more).
x > 1Advanced (dBFS): level at/above which audio is flagged loud. Must exceed soft_threshold_db.
-60 <= x <= 0Advanced: pitch fraction of baseline below which a frame is fry (higher flags more).
0 < x < 1Advanced: override the preset's MAD modified z-score threshold.
x > 0Match mode: 'presence' (default) returns 1.0 if found, 'absence' returns 1.0 if NOT found
presence, absence Span attribute key to measure (required for METRIC_CUSTOM_TRACE)
200Derived metric config. For METRIC_DERIVED_STRICT_LOGIC: {derived_type, conditions, join_operator, met_value, not_met_value}. For METRIC_DERIVED_AGGREGATE: {derived_type, aggregation_type, parent_metric_ids, count_where_target?}.
Advanced (s): minimum kept fry-run duration (lower flags more).
0 <= x <= 1Anomaly detection preset (recommended). 'strict' flags more pauses (MAD threshold 2.0), 'normal' is balanced (3.0, default), 'lenient' is conservative (4.0). Omit to use 'normal'.
strict, normal, lenient Advanced (Hz): pitch movement near a pause above which the pause counts as expressive.
x > 0Position constraint: 'any' (default), 'first', or 'last' message of the role
any, first, last Advanced (Hz): pitch jump above which a change counts as abrupt (lower flags more).
x > 0Advanced (dBFS): level at/below which audio is flagged soft.
-60 <= x <= 0OTel span name to query (required for METRIC_CUSTOM_TRACE)
200METRIC_VOLUME threshold preset (recommended). 'strict' flags more level outliers, 'normal' is the default, 'lenient' flags fewer. Omit to use 'normal'.
strict, normal, lenient Source of the aggregated value for METRIC_CUSTOM_TRACE: 'attribute' (default) reads the configured span attribute; 'duration' aggregates the span's own duration in seconds.
Response
Metric created
Metric resource
Show child attributes
Show child attributes
Was this page helpful?