Skip to main content
PATCH
/
test_framework
/
v2
/
metrics
/
{id}
/
Update a metric (partial)
curl --request PATCH \
  --url https://api.cekura.ai/test_framework/v2/metrics/{id}/ \
  --header 'Content-Type: application/json' \
  --header 'X-CEKURA-API-KEY: <api-key>' \
  --data '
{
  "slug": "<string>",
  "project": 123,
  "agent": 123,
  "agents": [
    123
  ],
  "assistant_id": "<string>",
  "name": "<string>",
  "description": "<string>",
  "observability_enabled": true,
  "simulation_enabled": true,
  "sampling_enabled": true,
  "prompt": "<string>",
  "enum_values": [
    "<string>"
  ],
  "display_order": -1,
  "custom_code": "<string>",
  "evaluation_trigger_prompt": "<string>",
  "evaluation_trigger_custom_code": "<string>",
  "priority_assignment_prompt": "<string>",
  "configuration": "<unknown>",
  "scenarios": "<unknown>",
  "kb_file_ids": "<unknown>",
  "metric_description_program": "<unknown>",
  "metric_description_variables": [
    "<unknown>"
  ],
  "evaluation_trigger_program": "<unknown>",
  "evaluation_trigger_variables": [
    "<unknown>"
  ],
  "alert_enabled": true,
  "alert_type": "disabled",
  "window_size": 50,
  "std_multiplier": 2,
  "ewma_alpha": 0.1,
  "add_to_new_agents": true,
  "alert_filters": "<unknown>",
  "slack_workspace": 123,
  "slack_channel_id": "<string>",
  "apply_to_all_agents": false,
  "add_to_rubric": false
}
'
import requests

url = "https://api.cekura.ai/test_framework/v2/metrics/{id}/"

payload = {
"slug": "<string>",
"project": 123,
"agent": 123,
"agents": [123],
"assistant_id": "<string>",
"name": "<string>",
"description": "<string>",
"observability_enabled": True,
"simulation_enabled": True,
"sampling_enabled": True,
"prompt": "<string>",
"enum_values": ["<string>"],
"display_order": -1,
"custom_code": "<string>",
"evaluation_trigger_prompt": "<string>",
"evaluation_trigger_custom_code": "<string>",
"priority_assignment_prompt": "<string>",
"configuration": "<unknown>",
"scenarios": "<unknown>",
"kb_file_ids": "<unknown>",
"metric_description_program": "<unknown>",
"metric_description_variables": ["<unknown>"],
"evaluation_trigger_program": "<unknown>",
"evaluation_trigger_variables": ["<unknown>"],
"alert_enabled": True,
"alert_type": "disabled",
"window_size": 50,
"std_multiplier": 2,
"ewma_alpha": 0.1,
"add_to_new_agents": True,
"alert_filters": "<unknown>",
"slack_workspace": 123,
"slack_channel_id": "<string>",
"apply_to_all_agents": False,
"add_to_rubric": False
}
headers = {
"X-CEKURA-API-KEY": "<api-key>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {'X-CEKURA-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
slug: '<string>',
project: 123,
agent: 123,
agents: [123],
assistant_id: '<string>',
name: '<string>',
description: '<string>',
observability_enabled: true,
simulation_enabled: true,
sampling_enabled: true,
prompt: '<string>',
enum_values: ['<string>'],
display_order: -1,
custom_code: '<string>',
evaluation_trigger_prompt: '<string>',
evaluation_trigger_custom_code: '<string>',
priority_assignment_prompt: '<string>',
configuration: '<unknown>',
scenarios: '<unknown>',
kb_file_ids: '<unknown>',
metric_description_program: '<unknown>',
metric_description_variables: ['<unknown>'],
evaluation_trigger_program: '<unknown>',
evaluation_trigger_variables: ['<unknown>'],
alert_enabled: true,
alert_type: 'disabled',
window_size: 50,
std_multiplier: 2,
ewma_alpha: 0.1,
add_to_new_agents: true,
alert_filters: '<unknown>',
slack_workspace: 123,
slack_channel_id: '<string>',
apply_to_all_agents: false,
add_to_rubric: false
})
};

fetch('https://api.cekura.ai/test_framework/v2/metrics/{id}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cekura.ai/test_framework/v2/metrics/{id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'slug' => '<string>',
'project' => 123,
'agent' => 123,
'agents' => [
123
],
'assistant_id' => '<string>',
'name' => '<string>',
'description' => '<string>',
'observability_enabled' => true,
'simulation_enabled' => true,
'sampling_enabled' => true,
'prompt' => '<string>',
'enum_values' => [
'<string>'
],
'display_order' => -1,
'custom_code' => '<string>',
'evaluation_trigger_prompt' => '<string>',
'evaluation_trigger_custom_code' => '<string>',
'priority_assignment_prompt' => '<string>',
'configuration' => '<unknown>',
'scenarios' => '<unknown>',
'kb_file_ids' => '<unknown>',
'metric_description_program' => '<unknown>',
'metric_description_variables' => [
'<unknown>'
],
'evaluation_trigger_program' => '<unknown>',
'evaluation_trigger_variables' => [
'<unknown>'
],
'alert_enabled' => true,
'alert_type' => 'disabled',
'window_size' => 50,
'std_multiplier' => 2,
'ewma_alpha' => 0.1,
'add_to_new_agents' => true,
'alert_filters' => '<unknown>',
'slack_workspace' => 123,
'slack_channel_id' => '<string>',
'apply_to_all_agents' => false,
'add_to_rubric' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-CEKURA-API-KEY: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.cekura.ai/test_framework/v2/metrics/{id}/"

payload := strings.NewReader("{\n \"slug\": \"<string>\",\n \"project\": 123,\n \"agent\": 123,\n \"agents\": [\n 123\n ],\n \"assistant_id\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"observability_enabled\": true,\n \"simulation_enabled\": true,\n \"sampling_enabled\": true,\n \"prompt\": \"<string>\",\n \"enum_values\": [\n \"<string>\"\n ],\n \"display_order\": -1,\n \"custom_code\": \"<string>\",\n \"evaluation_trigger_prompt\": \"<string>\",\n \"evaluation_trigger_custom_code\": \"<string>\",\n \"priority_assignment_prompt\": \"<string>\",\n \"configuration\": \"<unknown>\",\n \"scenarios\": \"<unknown>\",\n \"kb_file_ids\": \"<unknown>\",\n \"metric_description_program\": \"<unknown>\",\n \"metric_description_variables\": [\n \"<unknown>\"\n ],\n \"evaluation_trigger_program\": \"<unknown>\",\n \"evaluation_trigger_variables\": [\n \"<unknown>\"\n ],\n \"alert_enabled\": true,\n \"alert_type\": \"disabled\",\n \"window_size\": 50,\n \"std_multiplier\": 2,\n \"ewma_alpha\": 0.1,\n \"add_to_new_agents\": true,\n \"alert_filters\": \"<unknown>\",\n \"slack_workspace\": 123,\n \"slack_channel_id\": \"<string>\",\n \"apply_to_all_agents\": false,\n \"add_to_rubric\": false\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("X-CEKURA-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://api.cekura.ai/test_framework/v2/metrics/{id}/")
.header("X-CEKURA-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"slug\": \"<string>\",\n \"project\": 123,\n \"agent\": 123,\n \"agents\": [\n 123\n ],\n \"assistant_id\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"observability_enabled\": true,\n \"simulation_enabled\": true,\n \"sampling_enabled\": true,\n \"prompt\": \"<string>\",\n \"enum_values\": [\n \"<string>\"\n ],\n \"display_order\": -1,\n \"custom_code\": \"<string>\",\n \"evaluation_trigger_prompt\": \"<string>\",\n \"evaluation_trigger_custom_code\": \"<string>\",\n \"priority_assignment_prompt\": \"<string>\",\n \"configuration\": \"<unknown>\",\n \"scenarios\": \"<unknown>\",\n \"kb_file_ids\": \"<unknown>\",\n \"metric_description_program\": \"<unknown>\",\n \"metric_description_variables\": [\n \"<unknown>\"\n ],\n \"evaluation_trigger_program\": \"<unknown>\",\n \"evaluation_trigger_variables\": [\n \"<unknown>\"\n ],\n \"alert_enabled\": true,\n \"alert_type\": \"disabled\",\n \"window_size\": 50,\n \"std_multiplier\": 2,\n \"ewma_alpha\": 0.1,\n \"add_to_new_agents\": true,\n \"alert_filters\": \"<unknown>\",\n \"slack_workspace\": 123,\n \"slack_channel_id\": \"<string>\",\n \"apply_to_all_agents\": false,\n \"add_to_rubric\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.cekura.ai/test_framework/v2/metrics/{id}/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["X-CEKURA-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"slug\": \"<string>\",\n \"project\": 123,\n \"agent\": 123,\n \"agents\": [\n 123\n ],\n \"assistant_id\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"observability_enabled\": true,\n \"simulation_enabled\": true,\n \"sampling_enabled\": true,\n \"prompt\": \"<string>\",\n \"enum_values\": [\n \"<string>\"\n ],\n \"display_order\": -1,\n \"custom_code\": \"<string>\",\n \"evaluation_trigger_prompt\": \"<string>\",\n \"evaluation_trigger_custom_code\": \"<string>\",\n \"priority_assignment_prompt\": \"<string>\",\n \"configuration\": \"<unknown>\",\n \"scenarios\": \"<unknown>\",\n \"kb_file_ids\": \"<unknown>\",\n \"metric_description_program\": \"<unknown>\",\n \"metric_description_variables\": [\n \"<unknown>\"\n ],\n \"evaluation_trigger_program\": \"<unknown>\",\n \"evaluation_trigger_variables\": [\n \"<unknown>\"\n ],\n \"alert_enabled\": true,\n \"alert_type\": \"disabled\",\n \"window_size\": 50,\n \"std_multiplier\": 2,\n \"ewma_alpha\": 0.1,\n \"add_to_new_agents\": true,\n \"alert_filters\": \"<unknown>\",\n \"slack_workspace\": 123,\n \"slack_channel_id\": \"<string>\",\n \"apply_to_all_agents\": false,\n \"add_to_rubric\": false\n}"

response = http.request(request)
puts response.read_body
{
  "name": "<string>",
  "id": 123,
  "slug": "<string>",
  "project": 123,
  "agents": [
    123
  ],
  "description": "<string>",
  "enum_values": "<unknown>",
  "audio_enabled": true,
  "prompt": "<string>",
  "evaluation_trigger_prompt": "<string>",
  "evaluation_trigger_custom_code": "<string>",
  "priority_assignment_prompt": "<string>",
  "configuration": "<unknown>",
  "overall_score": "<string>",
  "total_score": "<string>",
  "knowledge_base_files": "<string>",
  "observability_enabled": true,
  "simulation_enabled": true,
  "sampling_enabled": true,
  "alert_enabled": true,
  "alert_type": "disabled",
  "alert_filters": "<unknown>",
  "slack_workspace": 123,
  "slack_channel_id": "<string>",
  "function_name": "<string>",
  "custom_code": "<string>",
  "vocera_defined_metric_code": "<string>",
  "reviews": [
    {
      "metric": 123,
      "id": 123,
      "test_set": {
        "agent": 123,
        "id": 123,
        "name": "<string>",
        "transcript": "<string>",
        "voice_recording_url": "<string>",
        "call_end_reason": "<string>",
        "duration": "<string>",
        "source_id": "<string>",
        "created_at": "2023-11-07T05:31:56Z",
        "updated_at": "2023-11-07T05:31:56Z"
      },
      "expected_value": "<unknown>",
      "actual_value": "<unknown>",
      "explanation": "<unknown>",
      "feedback": "<string>",
      "created_at": "2023-11-07T05:31:56Z",
      "updated_at": "2023-11-07T05:31:56Z"
    }
  ],
  "window_size": 123,
  "std_multiplier": 123,
  "ewma_alpha": 123,
  "add_to_new_agents": true,
  "pending_optimisation_proposal": "<unknown>"
}
{
"field_name": [
"<string>"
]
}
{
"detail": "<string>"
}

Authorizations

X-CEKURA-API-KEY
string
header
required

API Key Authentication. It should be included in the header of each request.

Path Parameters

id
integer
required

A unique integer value identifying this metric.

Body

slug
string | null

URL-friendly unique identifier in snake_case format

Maximum string length: 255
project
integer | null
agent
integer | null
agents
(integer | null)[]
assistant_id
string
write-only
name
string

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

Maximum string length: 255
description
string

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

type
enum<string>

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
Available options:
basic,
custom_prompt,
custom_code,
llm_judge
eval_type
enum<string>
  • binary - Binary
  • continuous_qualitative - Continuous Qualitative
  • numeric - Numeric
  • enum - Enum
Available options:
binary,
continuous_qualitative,
numeric,
enum
observability_enabled
boolean

Enable this metric for observability. Example: true or false

simulation_enabled
boolean

Enable this metric for simulations. Example: true or false

sampling_enabled
boolean

Enable sampling for this metric using project-level sample rate

prompt
string

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

enum_values
string[]
display_order
integer

Display order for the metric. Example: 1

Required range: -2147483648 <= x <= 2147483647
custom_code
string

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
enum<string>
  • always - Always
  • automatic - Automatic
  • custom - Custom
Available options:
always,
automatic,
custom
trigger_type
enum<string>
  • llm_judge - LLM Judge
  • custom_code - Custom Code
Available options:
llm_judge,
custom_code
evaluation_trigger_prompt
string

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

evaluation_trigger_custom_code
string

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_prompt
string

Priority assignment prompt for the metric.

configuration
any

Custom configuration parameters for specific metrics if metric supports it. Example:

  • For Infrastructure issues
{
"infra_issues_timeout": 10
}
scenarios
any
kb_file_ids
any

List of knowledge base file IDs for the metric. Example: [123, 456]

metric_description_program
any
metric_description_variables
any[]
evaluation_trigger_program
any
evaluation_trigger_variables
any[]
alert_enabled
boolean

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
enum<string>
default:disabled
  • disabled - Alerts Disabled
  • normal - Normal Alerts
  • significant_change - Significant Change Alerts
Available options:
disabled,
normal,
significant_change
window_size
integer
default:50
std_multiplier
number<double>
default:2
ewma_alpha
number<double>
default:0.1
significant_change_alert_status
enum<string>

Alert status: enabled or disabled.

  • enabled - Enabled
  • disabled - Disabled
Available options:
enabled,
disabled
significant_change_alert_direction
enum<string>

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
Available options:
,
increase,
decrease
add_to_new_agents
boolean | null

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

alert_filters
any | null

Filters to apply before computing alerts (CallLogQueryFilter format)

slack_workspace
integer | null

Slack workspace to send alerts to

slack_channel_id
string | null

Override channel ID for this metric's alerts

Maximum string length: 255
apply_to_all_agents
boolean
default:false
write-only

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

add_to_rubric
boolean
default:false
write-only

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.

Response

name
string
required

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

Maximum string length: 255
eval_type
enum<string>
required
  • binary - Binary
  • continuous_qualitative - Continuous Qualitative
  • numeric - Numeric
  • enum - Enum
Available options:
binary,
continuous_qualitative,
numeric,
enum
id
integer
read-only
slug
string | null

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

Maximum string length: 255
project
integer | null
agents
(integer | null)[]
description
string

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

type
enum<string>

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
Available options:
basic,
custom_prompt,
custom_code,
llm_judge
enum_values
any

List of possible enum values for enum type metrics. Example: ["satisfied", "unsatisfied"]

audio_enabled
boolean

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

prompt
string

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

evaluation_trigger
enum<string>
  • always - Always
  • automatic - Automatic
  • custom - Custom
Available options:
always,
automatic,
custom
trigger_type
enum<string>

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
Available options:
llm_judge,
custom_code
evaluation_trigger_prompt
string

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

evaluation_trigger_custom_code
string

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_prompt
string

Priority assignment prompt for the metric.

configuration
any

Custom configuration parameters for specific metrics if metric supports it. Example:

  • For Infrastructure issues
{
"infra_issues_timeout": 10
}
overall_score
string
read-only

The overall score for this metric across all test sets

total_score
string
read-only

The total score for this metric

knowledge_base_files
string
read-only

Knowledge base files associated with this metric

observability_enabled
boolean

Enable this metric for observability. Example: true or false

simulation_enabled
boolean

Enable this metric for simulations. Example: true or false

sampling_enabled
boolean

Enable sampling for this metric using project-level sample rate

alert_enabled
boolean

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
enum<string>
default:disabled
  • disabled - Alerts Disabled
  • normal - Normal Alerts
  • significant_change - Significant Change Alerts
Available options:
disabled,
normal,
significant_change
alert_filters
any | null

Filters to apply before computing alerts (CallLogQueryFilter format)

slack_workspace
integer | null

Slack workspace to send alerts to

slack_channel_id
string | null

Override channel ID for this metric's alerts

Maximum string length: 255
significant_change_alert_status
enum<string>

Alert status: enabled or disabled.

  • enabled - Enabled
  • disabled - Disabled
Available options:
enabled,
disabled
significant_change_alert_direction
enum<string>

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
Available options:
,
increase,
decrease
function_name
string | null

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

Maximum string length: 255
custom_code
string

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_code
string

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

Maximum string length: 255
reviews
object[]
read-only

Reviews associated with the metric

window_size
integer
read-only

Window size for rolling statistics calculation. Example: 50

std_multiplier
number<double>
read-only

Standard deviation multiplier for threshold calculation. Example: 2.0

ewma_alpha
number<double>
read-only

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

add_to_new_agents
boolean | null

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

pending_optimisation_proposal
any | null

Unsaved proposal from a metric-optimiser cron run. Shape: {description, evaluation_trigger, type, custom_code, score, baseline_score, cron_job_id, cron_job_name, proposed_at}.