Metrics

Create a metric

Changed on

Create a quality metric. type is llm_judge or custom_code. eval_type is one of binary, continuous_qualitative, numeric, enum. Set add_to_rubric=true to include the metric in the project's call-success rubric.

post/test_framework/v2/metrics/

Request

  • Base URL
    https://api.cekura.ai
  • URL
    https://api.cekura.ai/test_framework/v2/metrics/
  • Auth
    • API key in header X-CEKURA-API-KEY
    • or HTTP bearer
    • or HTTP bearer
    • or HTTP bearer

Request body

idinteger
slugstring nullable

URL-friendly unique identifier in snake_case format

projectinteger nullable
agentinteger nullable
agentsinteger[]
assistant_idstring
namestring required

Name of the metric. Example: "Customer Satisfaction" or "Appointment Booking"

descriptionstring

Description of what the metric measures. Example: "Measures how satisfied customers are with the service provided"

type'basic' | 'custom_prompt' | 'custom_code' | 'llm_judge'

Type of metric

  • basic - Basic (Deprecated in favor of LLM Judge)
  • custom_prompt - Custom Prompt ( Deprecated in favor of LLM Judge)
  • custom_code - Custom Code
  • llm_judge - LLM Judge
eval_type'binary' | 'continuous_qualitative' | 'numeric' | 'enum'
  • binary - Binary
  • continuous_qualitative - Continuous Qualitative
  • numeric - Numeric
  • enum - Enum
audio_enabledboolean

Whether this metric requires audio analysis. Example: true or false

observability_enabledboolean

Enable this metric for observability. Example: true or false

simulation_enabledboolean

Enable this metric for simulations. Example: true or false

sampling_enabledboolean

Enable sampling for this metric using its sample_rate, or the project sample rate when unset

sample_ratenumber double nullable

Sampling rate for this metric (0.0 to 1.0). Overrides the project sample rate when set.

promptstring

Evaluation prompt for the metric. Example: "Evaluate customer satisfaction based on conversation"

function_namestring nullable

Predefined function name Example: "get_latency" or "check_critical_deviations"

enum_valuesstring[]
display_orderinteger

Display order for the metric. Example: 1

custom_codestring

Python custom code for the metric. Example:

_resul = True
_explanation = None
if  "call_end_reason" in data and data["call_end_reason"] == "customer_satisfaction":
    _result = True
    _explanation = "Customer expressed satisfaction with service"
evaluation_trigger'always' | 'automatic' | 'custom'
  • always - Always
  • automatic - Automatic
  • custom - Custom
trigger_type'llm_judge' | 'custom_code'
  • llm_judge - LLM Judge
  • custom_code - Custom Code
evaluation_trigger_promptstring

Evaluation trigger prompt for the metric. Example: "Evaluate metric only if call ended reason is main-agent-ended-call"

evaluation_trigger_custom_codestring

Python custom code to determine metric relevance. Code should set _result (bool) and _explanation (str). Example:

_result = True
_explanation = "Metric is relevant"
if "call_end_reason" in data and data["call_end_reason"] == "customer-hung-up":
    _result = False
    _explanation = "Customer hung up, metric not applicable"
llm_provider'openai' | 'gemini' | 'dspy-gepa-gemini-flash' | 'deepseek-v4-flash'
  • openai - OpenAI
  • gemini - Gemini
  • dspy-gepa-gemini-flash - Dspy Gepa Gemini Flash
  • deepseek-v4-flash - DeepSeek V4 Flash
relevance_llm_provider'openai' | 'gemini' | 'dspy-gepa-gemini-flash' | 'deepseek-v4-flash'
  • openai - OpenAI
  • gemini - Gemini
  • dspy-gepa-gemini-flash - Dspy Gepa Gemini Flash
  • deepseek-v4-flash - DeepSeek V4 Flash
vocera_defined_metric_codestring

Vocera defined metric code for the metric. Example: "7fd534f5"

priority_assignment_promptstring

Priority assignment prompt for the metric.

configurationunknown
scenariosunknown
overall_scorestring
total_scorestring
kb_file_idsunknown
knowledge_base_filesstring
metric_description_programunknown
evaluation_trigger_programunknown
alert_enabledboolean

Enable alerts for this metric when it fails (value=false). Only applicable to binary metrics (eval_type=binary). For other metric types, use significant_change_alert_status instead. Example: true or false

alert_type'disabled' | 'normal' | 'significant_change'
  • disabled - Alerts Disabled
  • normal - Normal Alerts
  • significant_change - Significant Change Alerts
window_sizeinteger
std_multipliernumber double
ewma_alphanumber double
significant_change_alert_status'enabled' | 'disabled'

Alert status: enabled or disabled.

  • enabled - Enabled
  • disabled - Disabled
significant_change_alert_direction'' | 'increase' | 'decrease'

Alert direction: increase only, decrease only, or both (empty = both). Example: "increase", "decrease", or "both"

  • `` - Both (Increase and Decrease)
  • increase - Increase Only
  • decrease - Decrease Only
add_to_new_agentsboolean nullable

When enabled, this metric is automatically assigned to new agents created in the project.

alert_filtersunknown
slack_workspaceinteger nullable

Slack workspace to send alerts to

slack_channel_idstring nullable

Override channel ID for this metric's alerts

apply_to_all_agentsboolean

For observability_dropoff: when true, copies the dropoff_nodes from configuration to every other agent in the project.

add_to_rubricboolean

If true, this metric is added to the project's call-success rubric on save (a sensible default rule is chosen by eval_type). If false on an existing rubric metric, it's removed from the rubric.

dependency_warningsstring[]

Warnings about prerequisites, such as inputs disabled for a source this metric runs on.

Response

idinteger
slugstring nullable

URL-friendly unique identifier in snake_case format. Example: "customer_satisfaction_1562"

projectinteger nullable
agentsinteger[]
namestring required

Name of the metric. Example: "Customer Satisfaction" or "Appointment Booking"

descriptionstring

Description of what the metric measures. Example: "Measures how satisfied customers are with the service provided"

type'basic' | 'custom_prompt' | 'custom_code' | 'llm_judge'

Type of metric

  • basic - Basic (Deprecated in favor of LLM Judge)
  • custom_prompt - Custom Prompt ( Deprecated in favor of LLM Judge)
  • custom_code - Custom Code
  • llm_judge - LLM Judge
eval_type'binary' | 'continuous_qualitative' | 'numeric' | 'enum' required
  • binary - Binary
  • continuous_qualitative - Continuous Qualitative
  • numeric - Numeric
  • enum - Enum
enum_valuesunknown
audio_enabledboolean

Whether this metric requires audio analysis. Example: true or false

promptstring

Evaluation prompt for the metric. Example: "Evaluate customer satisfaction based on conversation"

evaluation_trigger'always' | 'automatic' | 'custom'
  • always - Always
  • automatic - Automatic
  • custom - Custom
trigger_type'llm_judge' | 'custom_code'

Type of trigger evaluation: LLM judge or custom code. Only used when evaluation_trigger is CUSTOM. Example: "llm_judge" or "custom_code"

  • llm_judge - LLM Judge
  • custom_code - Custom Code
evaluation_trigger_promptstring

Evaluation trigger prompt for the metric. Example: "Evaluate metric only if call ended reason is main-agent-ended-call"

evaluation_trigger_custom_codestring

Python custom code to determine metric relevance. Code should set _result (bool) and _explanation (str). Example:

_result = True
_explanation = "Metric is relevant"
if "call_end_reason" in data and data["call_end_reason"] == "customer-hung-up":
    _result = False
    _explanation = "Customer hung up, metric not applicable"
priority_assignment_promptstring

Priority assignment prompt for the metric.

configurationunknown
overall_scorestring

The overall score for this metric across all test sets

total_scorestring

The total score for this metric

knowledge_base_filesstring

Knowledge base files associated with this metric

observability_enabledboolean

Enable this metric for observability. Example: true or false

simulation_enabledboolean

Enable this metric for simulations. Example: true or false

sampling_enabledboolean

Enable sampling for this metric using its sample_rate, or the project sample rate when unset

sample_ratenumber double nullable

Sampling rate for this metric (0.0 to 1.0). Overrides the project sample rate when set.

alert_enabledboolean

Enable alerts for this metric when it fails (value=false). Only applicable to binary metrics (eval_type=binary). For other metric types, use significant_change_alert_status instead. Example: true or false

alert_type'disabled' | 'normal' | 'significant_change'
  • disabled - Alerts Disabled
  • normal - Normal Alerts
  • significant_change - Significant Change Alerts
alert_filtersunknown
slack_workspaceinteger nullable

Slack workspace to send alerts to

slack_channel_idstring nullable

Override channel ID for this metric's alerts

significant_change_alert_status'enabled' | 'disabled'

Alert status: enabled or disabled.

  • enabled - Enabled
  • disabled - Disabled
significant_change_alert_direction'' | 'increase' | 'decrease'

Alert direction: increase only, decrease only, or both (empty = both). Example: "increase", "decrease", or "both"

  • `` - Both (Increase and Decrease)
  • increase - Increase Only
  • decrease - Decrease Only
function_namestring nullable

Predefined function name Example: "get_latency" or "check_critical_deviations"

custom_codestring

Python custom code for the metric. Example:

_resul = True
_explanation = None
if  "call_end_reason" in data and data["call_end_reason"] == "customer_satisfaction":
    _result = True
    _explanation = "Customer expressed satisfaction with service"
vocera_defined_metric_codestring

Vocera defined metric code for the metric. Example: "7fd534f5"

scenariosunknown
window_sizeinteger

Window size for rolling statistics calculation. Example: 50

std_multipliernumber double

Standard deviation multiplier for threshold calculation. Example: 2.0

ewma_alphanumber double

Alpha value for exponentially weighted moving average (EWMA) calculation. Example: 0.1

add_to_new_agentsboolean nullable

When enabled, this metric is automatically assigned to new agents created in the project.

pending_optimisation_proposalunknown

Changes