Skip to content

Modify Evaluator



POST /api/v1/agent_eval/evaluator/{evaluator_uuid}/modify

Overview

Partially updates a custom evaluator in the current Workspace.

Before Calling and Usage Steps

Use the DF-API-KEY of the target Workspace; even for read-only access, the Application Configuration Management permission for Agent Monitoring is required. Only custom evaluators in the current Workspace are operated on; built-in system evaluators are not exposed. Place parameters only in the corresponding query, path, or JSON body; do not use body parameters in the URL. First get details, and submit only the JSON fields that need to be changed; at least one field is required. Omitted fields are preserved; nullable text can be cleared with an empty string; the numeric value 0 has actual meaning. Objects/arrays are validated as complete values. In particular, when schemaConfig is explicitly passed, omitted subfields fall back to the template defaults rather than being merged with the original object. evalType cannot be changed, and Schema fields must not be submitted for Prompt or mixed in the reverse direction. Version 1 uses inputTemplateVersion=1 and userPromptTemplate; variables are derived from the template, and selectedInputFields is not passed. The template only references data paths and does not support executing expressions; root is the root record, and spans are execution records ordered by time. Paths such as spans[*].output can be used. In the legacy custom mode, a non-empty selectedInputFields must be passed; in the legacy builtin mode, it can be omitted, and the system input is used. Submitting the same configuration repeatedly does not update the record or generate a change audit. Changing only name/description does not reset scan progress; if other configurations of an enabled evaluator actually change, lastScanAt is set to the current time in milliseconds, so the evaluation scope should be confirmed first. This API does not enable the evaluator; the existing status is preserved; the samplingRate=0 example on this page only stops new sampling. On failure/timeout, read back first and then retry to avoid overwriting concurrent modifications by others; this API has no configuration version conflict token. appName only saves the application display name and writes it to the evaluation result label; it is not used as a filter condition for candidate Traces. To restrict the target LLM application, appID must be set.

Route Parameters

Parameter Type Required Description
evaluator_uuid string Y UUID of a custom evaluator in the current Workspace. UUIDs of built-in system evaluators and other Workspaces are treated as nonexistent.
Example: aeve_0123456789abcdef0123456789abcdef
How to obtain or specify: Obtain from content.uuid in Create Evaluator or content.data[].uuid in List Evaluators.

Request Headers

Parameter Type Required Description
DF-API-KEY string Y OpenAPI credential for the target Workspace. Both read and write require the Application Configuration Management permission for Agent Monitoring; the associated role must be owner, wsAdmin, or general.
Example: <DF-API-KEY>
How to obtain or specify: Create and authorize it in API Key Management of the target Workspace, and pass it using the DF-API-KEY request header; do not put a real Key in URLs or examples.

Body Request Parameters

Parameter Type Required Description
schemaConfig.schema object JSON Schema Draft 7 object that defines the data structure to be evaluated. Only resolvable $refs within the document are allowed; remote/file references are prohibited. It can be omitted to use the Schema of the selected system template. This object describes the collected data, not the Schema of this API's request body.
Example: {"type": "object", "required": ["answer"], "properties": {"answer": {"type": "string", "minLength": 1}}}
How to obtain or specify: Design a JSON Schema from the collected Agent output/tool data structure; you can also copy content.schemaConfig.schema from the details and modify it completely.
schemaConfig.missingPolicy string Handling policy when the input to be validated is missing; only fail is supported. If omitted, the system template default fail is used.
Example: fail
How to obtain or specify: Enter the fixed value fail; unsupported policies such as ignore and skip cannot be used.
name string Evaluator name that is unique within the Workspace. It must have content after trimming leading and trailing whitespace and can be up to 128 characters. Required on creation; omitted on modification to preserve the existing value.
Allows null: False
Minimum length: 1
Maximum length: 128
Example: LLM Answer Completeness
How to obtain or specify: Name it by the caller; first check existing names using List Evaluators.
description string Evaluator description, up to 512 characters. Omitted on creation to be empty; omitted on modification to preserve the existing value; an empty string clears it; the server trims leading and trailing whitespace.
Allows null: False
Maximum length: 512
Allows empty string: True
Example: Check customer service application answer completeness
How to obtain or specify: The caller provides a description of the business objective.
targetType string For prompt, agent or llm is supported; omitted on creation to default to agent; for schema, only agent is allowed. Omitted on modification to preserve the existing value.
Allows null: False
Allowed values: ['agent', 'llm']
Example: llm
How to obtain or specify: Select agent for Agent Monitoring data and llm for LLM application Traces.
promptOrigin string Only applicable to the prompt type. builtin uses a built-in Prompt template in the current Workspace, and custom uses a custom instruction. Omitted on creation to default to builtin; omitted on modification to preserve the existing value.
Allows null: False
Allowed values: ['builtin', 'custom']
Example: custom
How to obtain or specify: Select custom for a custom instruction; select builtin for a built-in template and provide the template UUID.
promptUUID string Used only for prompt when promptOrigin=builtin. Required on creation and must be the UUID of a built-in Prompt template in the current Workspace, up to 48 characters. Do not pass it in custom mode.
Allows null: False
Minimum length: 1
Maximum length: 48
Example: aepm_0123456789abcdef0123456789abcdef
How to obtain or specify: Select a built-in Prompt template from the evaluator configuration in Agent Monitoring in the console, or read content.promptUUID from the details of an existing built-in Prompt evaluator in the same Workspace; the current OpenAPI does not provide a template catalog API, and an evaluator UUID cannot be used instead.
promptContent string Only for the prompt type. Required on creation, 1–65535 characters, and the server trims leading and trailing whitespace; both custom and built-in template modes must submit the actual evaluation instruction. Omitted on modification to preserve the existing value.
Allows null: False
Minimum length: 1
Maximum length: 65535
Example: Determine whether the answer fully responds to the user's question. Provide a pass/fail result and the reason.
How to obtain or specify: In custom mode, the caller writes it; in built-in mode, confirm the evaluation instruction after selecting a template in the console, or reuse content.promptContent from the details of an existing evaluator.
inputTemplateVersion integer Only for the prompt type. Optional integer 1, indicating variable input template mode. If omitted on creation, the legacy field selection mode is used; if omitted on modification, the saved version is retained, and null is not supported to revert to the legacy version.
Allows null: False
Allowed values: [1]
Example: 1
How to obtain or specify: Pass 1 when you want to explicitly select original Trace paths, and provide userPromptTemplate at the same time; for an existing version 1 evaluator, read the details first.
userPromptTemplate string Input template used only by version 1, 1–65535 characters, and must contain 1–100 deduplicated valid variable paths. Supports root and spans paths and common aliases, and does not execute expressions; it cannot be submitted together with selectedInputFields. Required when creating version 1; omitted on modification to retain the existing template.
Allows null: False
Minimum length: 1
Maximum length: 65535
Example: "Input: {{root.input}}\nOutput: {{root.output}}"
How to obtain or specify: Confirm fields in Traces already collected by the target application; use {{root.input}} and {{root.output}} for raw LLM input/output, and {{root.gen_ai_input_messages}} and {{root.gen_ai_output_messages}} for Agent. Arrays support spans[*] and indexes; see the version 1 example on this page.
selectedInputFields array Only applicable to the legacy prompt input mode. Required on creation in custom mode, and must be 1–5 unique fields; in builtin mode, omit it to use the built-in input. For version 1, it is derived from the template and must not be passed explicitly; omitted on modification to preserve the existing value.
Allows null: False
Minimum length: 1
Maximum length: 5
Example: ["gen_ai_input", "gen_ai_output"]
How to obtain or specify: Select the required evidence from gen_ai_input, gen_ai_output, trace_context, tool_calls, and span_context. The first two are root input/output, and the rest are execution process, tool calls, and Span context.
selectedInputFields[*] string Legacy input field name; it must be one of the five items above and must not be duplicated in the array.
Allowed values: ['gen_ai_input', 'gen_ai_output', 'trace_context', 'tool_calls', 'span_context']
Example: gen_ai_input
How to obtain or specify: Select a fixed field according to the evidence required for evaluation; do not enter arbitrary Trace paths.
generationDescription string Only for the prompt type. Records the original business description used when generating the template, up to 4000 characters; omitted on creation to be empty, omitted on modification to preserve the existing value, and an empty string clears it. This field itself does not trigger template generation.
Allows null: False
Maximum length: 4000
Allows empty string: True
Example: Determine whether the answer meets the goal explicitly stated by the user
How to obtain or specify: The caller fills in and saves the template generation context, or reads content.generationDescription from the details.
templateKey string Only for the schema type. Required on creation; omitted on modification to preserve the existing value. Supports four system template identifiers: structured_output_compliance, tool_call_arguments_completeness, citation_evidence_structure, and agent_task_result_compliance, up to 64 characters.
Allows null: False
Minimum length: 1
Maximum length: 64
Example: structured_output_compliance
How to obtain or specify: Select according to the target check: structured output, basic structure of tool arguments, citation evidence structure, or task result compliance; it can be obtained from content.templateKey in the details of an existing Schema evaluator. Do not use a Prompt template UUID.
schemaConfig object Configuration object only for the schema type; omitted on creation or an empty object uses the default configuration of the selected system template. Omitted on modification to keep the existing value; when explicitly submitted, it is re-normalized as a complete input, and items for which schema/missingPolicy are not provided fall back to the defaults of the currently selected template rather than being merged item by item with the old object.
Allows null: False
Example: {"schema": {"type": "object", "required": ["answer"], "properties": {"answer": {"type": "string", "minLength": 1}}}, "missingPolicy": "fail"}
How to obtain or specify: The caller assembles it according to the schemaConfig.schema and missingPolicy descriptions on this page, or reads content.schemaConfig from the details first and then modifies it.
evalScope string Only for the prompt type; trace evaluates the entire Trace, and span evaluates a Span; omitted on creation to default to trace, omitted on modification to preserve the existing value. Do not pass it for the schema type.
Allows null: False
Allowed values: ['trace', 'span']
Example: trace
How to obtain or specify: Select the fixed value according to the evaluation scope.
resultType string For prompt, boolean or score is supported, and creation defaults to boolean; schema supports only boolean. Omitted on modification to preserve the existing value; when the type is changed, resultConfig is rebuilt by the server. boolean produces pass/fail, and score produces an integer score from 0–100.
Allows null: False
Allowed values: ['boolean', 'score']
Example: boolean
How to obtain or specify: Select according to whether the business requires scoring; do not submit resultConfig.
agentRuntime string Agent runtime filter condition. Request values up to 256 characters are normalized, and at most 128 characters are actually saved; an empty string means no restriction. Common aliases are mapped to standard names, for example ClaudeCode to claude. Omitted on modification to preserve the existing value; an empty string clears it.
Allows null: False
Maximum length: 256
Allows empty string: True
Example: codex
How to obtain or specify: Obtain from the agent_runtime field of Agent Monitoring Traces in the current Workspace, such as codex, claude, and opencode; do not assume the examples are existing values in this Workspace.
agentID string Agent instance filter condition, up to 256 characters. Omitted on creation to be empty; omitted on modification to preserve the existing value; an empty string clears it.
Allows null: False
Maximum length: 256
Allows empty string: True
Example: agent_checkout_01
How to obtain or specify: Obtain from the agent_id field of Agent Monitoring Traces in the current Workspace or from the instance details in the console.
appID string Filter condition for the target LLM application, up to 256 characters. Omitted on creation to be empty; omitted on modification to preserve the existing value; an empty string clears it.
Allows null: False
Maximum length: 256
Allows empty string: True
Example: support_assistant
How to obtain or specify: Obtain from content.data[].appId in List LLM Applications or from the LLM application details in the current Workspace. Enter the public appId, not the configuration record uuid.
appName string LLM application display name, up to 256 characters. After being saved, it is written to the app_name label of evaluation results; it does not participate in online candidate Trace filtering. Use appID to filter applications. Omitted on modification to preserve the existing value; an empty string clears it.
Allows null: False
Maximum length: 256
Allows empty string: True
Example: Customer Service Assistant
How to obtain or specify: Obtain from the target application name in the console or the app_name field of collected Traces, and use it as a result display label; fill in appID separately for actual target application filtering.
language string Evaluation output language. A non-empty string of up to 32 characters. Omitted on creation to use the language of this request; omitted on modification to preserve the existing value. The request language for reads only affects the legacy input template displayed/generated and does not change the saved evaluation output language.
Allows null: False
Minimum length: 1
Maximum length: 32
Example: zh
How to obtain or specify: Enter the desired evaluation result language, for example zh or en; for the existing value, see content.targetConfig.language in the details.
samplingRate integer Online sampling percentage, integer 0–100, default 20 on creation; 0 stops new sampling but does not change the enabled/disabled status. Omitted on modification to preserve the existing value.
Allows null: False
$minValue: 0
$maxValue: 100
Example: 20
How to obtain or specify: The caller sets it based on cost and coverage; read the details first to confirm the current value.
dailyCallLimit integer Daily call limit, integer 1–1000000, default 10000 on creation; omitted on modification to preserve the existing value. It is not the number of historical results, and 0 does not mean unlimited.
Allows null: False
$minValue: 1
$maxValue: 1000000
Example: 10000
How to obtain or specify: The caller sets it according to the budget and checks actual execution in the console.
timeoutSeconds integer Timeout for a single online evaluation, in seconds, integer 5–300, default 30 on creation; omitted on modification to preserve the existing value. It is not the timeout of this HTTP request.
Allows null: False
$minValue: 5
$maxValue: 300
Example: 30
How to obtain or specify: The caller sets it according to the execution duration of the target evaluation.
maxRetries integer Maximum number of retries for an online evaluation task, integer 0–5, default 2 on creation; 0 means no additional retries. Omitted on modification to preserve the existing value. It is not the retry count for this API request.
Allows null: False
$minValue: 0
$maxValue: 5
Example: 2
How to obtain or specify: The caller sets it according to evaluation fault tolerance and budget.

Additional Parameter Notes

The JSON request body must contain at least one configuration field. Only fields present in the request are updated. Object or array fields are replaced as a whole, and omitted fields retain their original values. An explicit 0 updates the numeric value, and nullable text fields can be cleared by passing an empty string. The evaluation type evalType is determined at creation.

After modification, the updated configuration is returned. The example below sets the sampling rate to 0, and the evaluator status remains unchanged.

Request Example

curl 'https://openapi.guance.com/api/v1/agent_eval/evaluator/aeve_0123456789abcdef0123456789abcdef/modify' \ --request POST \ --header 'DF-API-KEY: ' \ --header 'Content-Type: application/json' \ --data-binary ' { "samplingRate": 0 } '

Response

HTTP 200, application/json. The success wrapper and fields are as follows; for failures, see Common Errors and the exception handling on this page.

Field Type Description
code integer Business response status; 200 on success.
errorCode string Empty on success; a specific error code on failure.
message string Empty on success; an error message on failure.
success boolean Whether the request succeeded.
traceId string Trace identifier for this request; retain it when troubleshooting.
content object Complete evaluator configuration saved or read.
content.uuid string Evaluator UUID, used for subsequent details, modification, enable/disable, and deletion.
content.name string Evaluator name.
content.description string Business description; may be an empty string.
content.evalType string prompt or schema.
content.templateKey string Schema system template identifier; empty for the Prompt type.
content.schemaConfig object Normalized Schema configuration; an empty object for the Prompt type.
content.schemaConfig.templateVersion integer Schema template version, currently 1; present only when the Schema configuration is non-empty.
content.schemaConfig.schemaDialect string Schema dialect draft-07; present only when the Schema configuration is non-empty.
content.schemaConfig.validationSource string Source of the Schema value: output or tool_calls.
content.schemaConfig.targetField string Schema validation target field, such as gen_ai_output_messages or tool_calls.
content.schemaConfig.missingPolicy string Schema missing policy, currently fail.
content.schemaConfig.schema object Actual JSON Schema. Its structure is determined by the system template and custom configuration, and internal keys are standard Draft 7 keywords and business custom attributes.
content.promptUUID string Built-in Prompt template UUID; empty for custom Prompt and Schema.
content.promptName string Template display name; when no Prompt is associated, Schema may return its system template name.
content.promptDescription string Template description; empty when no template is associated.
content.promptContent string Actual evaluation instruction; empty for the Schema type.
content.promptOrigin string Prompt source, builtin or custom; Schema may also return the compatible default builtin, which does not mean a Prompt is used.
content.selectedInputFields array<string> or null Input fields selected by the legacy version or common aliases derived for version 1; may be null when not configured, and may be an empty array in version 1 when only original paths are selected.
content.selectedInputFields[] string Input evidence alias, such as gen_ai_input; not an arbitrary original Trace path.
content.generationDescription string Original template generation description; may be empty.
content.inputTemplateVersion integer or null Returns 1 for version 1; null for the legacy version and when not configured.
content.userPromptTemplate string For version 1, the saved input template; for the legacy Prompt, the input template generated according to the read language; empty for Schema.
content.targetType string agent or llm; Schema supports only agent.
content.evalScope string For Prompt, trace or span; an empty string for Schema.
content.resultType string boolean or score; Schema supports only boolean.
content.resultConfig object Output configuration determined by resultType; it cannot be written directly through this API.
content.resultConfig.values array<string> Present for the boolean type; fixed to pass and fail.
content.resultConfig.values[] string Boolean evaluation result label, pass or fail.
content.resultConfig.min integer Present for the score type; fixed to 0.
content.resultConfig.max integer Present for the score type; fixed to 100.
content.sourceType string The APIs in this group manage only custom evaluators.
content.targetConfig object Saved filtering, language, and input configuration; some subfields vary by type and input version.
content.targetConfig.agentRuntime string Normalized Agent runtime filter value; empty means unrestricted.
content.targetConfig.agentID string Agent instance filter value; may be empty.
content.targetConfig.appID string Public appId filter value of the LLM application; may be empty.
content.targetConfig.appName string Saved LLM application display name, used for the app_name label of evaluation results; it does not participate in online candidate Trace filtering. Set appID to filter applications. May be empty.
content.targetConfig.language string Saved evaluation output language.
content.targetConfig.promptOrigin string Source saved for the Prompt type, builtin or custom; Schema usually does not have this key.
content.targetConfig.selectedInputFields array<string> Present when legacy field selection or version 1 is configured; the semantics are the same as top-level selectedInputFields.
content.targetConfig.selectedInputFields[] string Saved or derived common input field name.
content.targetConfig.generationDescription string Generation description saved for the Prompt type.
content.targetConfig.inputTemplateVersion integer Present for version 1, with a value of 1.
content.targetConfig.inputVariables array<string> Present for version 1; deduplicated variable paths parsed from userPromptTemplate, up to 100 items.
content.targetConfig.inputVariables[] string Original variable path or common alias, such as root.input, spans[*].output.
content.status string Saved status; enabled on creation, and the status API can set enabled or disabled. Historical data may be draft.
content.samplingRate integer Online sampling percentage, 0–100.
content.dailyCallLimit integer Daily call limit, 1–1000000.
content.timeoutSeconds integer Evaluation execution timeout, in seconds.
content.maxRetries integer Maximum retries for online evaluation, 0–5.
content.publishedAt integer Publish/enable time, Unix seconds; unpublished historical values may be -1.
content.lastScanAt integer Latest scan progress time, Unix milliseconds; historical unset values may be -1. Actual configuration modifications may reset it; it is not the completion time of this HTTP request.
content.createAt integer Creation time, Unix seconds.
content.updateAt integer Modification time, Unix seconds.
content.declaration object or null Public declaration of this Workspace; may be an empty object or null when not configured; in lists, it is carried only at the content level and is not supplemented item by item in data[].
{
    "code": 200,
    "content": {
        "uuid": "aeve_0123456789abcdef0123456789abcdef",
        "name": "LLM Answer Completeness",
        "description": "",
        "evalType": "prompt",
        "templateKey": "",
        "schemaConfig": {},
        "promptUUID": "",
        "promptName": "",
        "promptDescription": "",
        "promptContent": "Determine whether the answer fully responds to the user's question. Provide a pass/fail result and the reason.",
        "promptOrigin": "custom",
        "selectedInputFields": [
            "gen_ai_input",
            "gen_ai_output"
        ],
        "generationDescription": "",
        "inputTemplateVersion": null,
        "userPromptTemplate": "gen_ai_input:\n{{gen_ai_input}}\n\ngen_ai_output:\n{{gen_ai_output}}",
        "targetType": "llm",
        "evalScope": "trace",
        "resultType": "boolean",
        "resultConfig": {
            "values": [
                "pass",
                "fail"
            ]
        },
        "sourceType": "custom",
        "targetConfig": {
            "agentRuntime": "",
            "agentID": "",
            "appID": "support_assistant",
            "appName": "",
            "language": "zh",
            "promptOrigin": "custom",
            "selectedInputFields": [
                "gen_ai_input",
                "gen_ai_output"
            ],
            "generationDescription": ""
        },
        "status": "enabled",
        "samplingRate": 0,
        "dailyCallLimit": 10000,
        "timeoutSeconds": 30,
        "maxRetries": 2,
        "publishedAt": 1795226400,
        "lastScanAt": 1795226400000,
        "createAt": 1795226400,
        "updateAt": 1795226400,
        "declaration": {}
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "example-trace-id"
}

Error Responses

For authentication, rate limiting, and common request errors, see Common Error Definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed Request fields, types, or constraints do not conform to the declaration; the version 1 template format or variable path is invalid Parameter parsing failed; for template parsing errors, message describes the specific reason. Correct according to the parameter table; use valid paths and complete double curly braces in the template, and do not send undeclared fields.
406 ft.InvalidParameterV2 Body is empty, the field combination or reserved configuration validation fails, Prompt/Schema-specific fields are mixed, the template version combination or Schema configuration/reference is invalid; body parameters are carried in the URL The value {} of parameter {} is invalid; a specific reason may also be returned, for example userPromptTemplate requires inputTemplateVersion 1 or OpenAPI Schema evaluation requires valid local Draft 7 references. Correct the JSON body according to the field combinations on this page; for version 1, do not pass selectedInputFields at the same time; for Schema, use only resolvable in-document Draft 7 references; do not submit using URL body parameters.
404 ft.ObjectNotExists The target evaluator does not exist, belongs to another Workspace, or is a built-in system evaluator; the built-in Prompt or Schema template referenced during modification does not exist Agent evaluator does not exist; template-related messages are Agent evaluation Prompt does not exist, Agent evaluation Prompt template does not exist, or Agent Schema evaluation template does not exist. First list evaluators using the Key for this Workspace to verify the target UUID; if modifying a template, verify the built-in Prompt template UUID or Schema template identifier in this Workspace according to the sources on this page.
400 ft.InvalidAction Renaming conflicts with an existing evaluator name in the Workspace, including concurrent modifications Evaluator name already exists First list existing evaluators and choose an unused name; after a failure, read back the details to confirm the status before retrying.
500 ft.InternalServerError An unhandled exception occurs while saving the database record, writing the audit, or in another dependency Internal error Retain traceId, read back the target configuration or list to confirm the actual saved state, and then decide whether to retry; do not assume that a failed response means nothing was saved.

Feedback

Is this page helpful?