Skip to main content
Create a custom diagnoser when the existing checks cannot express your requirement. For built-in rules and specialist trials that require no prompt or Python, see Start with existing diagnosers. Creating custom diagnosers is available to team-space administrators and developers. Personal spaces use platform-provided built-in capabilities.

Start with existing checks

First consult the existing diagnoser catalog before deciding to create a custom check. Rules suit explicit fields and conditions. LLM checks suit semantic questions requiring context and need an available model connection.

Try a specialist check for an explicit requirement

Answer relevance, follow-up reasonableness, numeric consistency, response language, and protected markers have an independent specialist entry. Follow the specialist trial steps with one Trace before deciding whether to save the configuration and add it to a team task.

Configure a custom rule

For isolated execution, first configure a connection and Space policy using the Sandbox guide, then choose the execution mode in the rule form. Sandbox is optional: without a selected connection or a Space requirement, local execution remains available for restricted rules. Enhanced Python requires a compatible sandbox. Use the form’s “output exists” example to practice the complete workflow:
  1. In a team space, select Diagnosers → New diagnoser, choose the rule type, and enter a name, category, and scenario.
  2. Select View Trace Structure and choose or enter a real Trace ID whose Agent output you have already confirmed. Find that output field under spans.
  3. Copy the generated Python expression and replace the empty string on the right of output = "" in the example. The unchanged example returns bad; do not save it for batch checks without this replacement.
  4. Keep the declared metric and returned name aligned as quality. Under Test and Validate, select the same Trace and choose Run Diagnosis. Compare the valid verdict, reason, and output_length evidence with the original content. Resolve missing samples, missing fields, or execution failures first.
  5. Test the bad branch with a sample whose output field exists but is confirmed empty, then select Create. Return to the diagnoser list and confirm the configuration appears.
This example verifies field access and rule execution, not answer correctness or task completion. The current entry point is evaluate(trace), with raw spans available through trace.spans. Arbitrary import statements are not supported. Declare unique metric names in the editor. The returned object’s metrics array must contain exactly one entry per declared metric:

Complete rule template

The following shows the complete result shape from the current form example. This is a template that still needs a real field expression, not a finished diagnosis rule. First declare one metric named quality in the editor and copy an expression from a real Trace as described above.
The unchanged output = "" always returns bad. If the field is absent, the wrong field is selected, or Privacy masks the content, resolve the material and applicability first. Missing data does not prove that the Agent actually produced empty output. Once the field is confirmed to represent the intended output, validate both branches with one non-empty sample and one confirmed empty sample. Do not reuse an older rule that returns only a score between 0 and 1. Trial the rule on a known good example and a confirmed problem, including missing fields, retries, and long executions. If a trial reports invalid metric names or result formatting, first match the declared metrics[].name values to the returned entries, then check the shape of reason and evidence. This is an execution-contract error, not evidence of poor Agent quality.

Configure a custom LLM diagnoser

1

State what you need to verify

In a team space, open Diagnosis → Diagnosers → New Diagnoser and choose LLM. Define the subject, what counts as a problem, and the evidence the check should cite. For example, to detect a claim of success after a tool failure, compare the final answer with the original tool result and check whether a later retry succeeded.
2

Select fields from a real Trace

Under Diagnosis Logic, select View Trace Structure. Open a sample you have already examined. Under Select span, find the request root and the relevant tool span. Choose a recorded input or output field and use Expression and value → Evaluate to check its value before copying the expression. Distinguish the request, the visible final answer, and intermediate tool results. Field names vary by Agent and collection method. If the value is empty, check the original Trace.
3

Verify the field against a second sample

Copy the expression you want to reuse, then select another Trace or enter its ID in the structure dialog. Switching samples resets field selection. Enter the same path under Expression and select Evaluate again. Once both samples contain the expected material, use Copy to copy the double-brace expression into Diagnosis Logic. The actual value replaces the expression at runtime.
4

Choose a judge model and test two outcomes

Under Runtime Model, select a connection in this space that passed Diagnostic validation. Use Manage Connections to configure and validate a connection in place, then close the dialog to continue editing the draft. Under Test and Validate, select a reference Trace and choose Run Diagnosis. Check the verdict, reason, and evidence, then run a second Trace with a different expected result. Each trial uses the selected Trace and current draft.

Switch samples, find the output on the request root, and evaluate the field value. Demo data, Chinese interface.

The video searches Select field for attributes.langfuse.observation.output, enters an expression for that field, and selects Evaluate. The highlight shows the sample answer, and the counter shows one matching value. Confirm that your selected field contains the evidence you need, then run Test and Validate. Use the field recorded by your collection method. Save the diagnoser to persist its model and instructions. The connection is shared within the space, while the prompt and generation settings belong to the diagnoser. Basic diagnostic validation cannot substitute for testing against a real Trace.

Verify after saving

Confirm the configuration appears in the list. To produce a result you can revisit, open Agent Traces → Run diagnosis → Saved diagnosers, select the saved configuration, run it, then select View quality results. To repeat the check over a fixed scope, add it to a diagnosis task and confirm execution in its history. Run another trial after changing the reference Trace, instructions, or model. Changes affect subsequent execution; compare historical results with their original configuration and data scope. For checks requiring original content, inspect applicability and missing evidence when using Privacy data. Failure or skipping does not mean the task had no problem.