Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

Evaluation MetricsBeta

Beta
This is coming — this page describes a feature that's still being rolled out and may not be available to you yet.

Metrics are how Evaluation measures your pipeline.


A metric is a question you ask about every session, answered the same way each time. For example:

  • Did the answer stay grounded in the retrieved documents?
  • Did the agent call the search tool before answering?
  • How polite was the reply, on a scale from 0 to 1?
  • How many tokens did the conversation use?

A metric returns a value and a rationale: the measurement and the reason for it. The rationale lets you check whether the metric judged correctly, which is how you learn to trust it.

A rationale, or the reason of a not applicable answer, can be up to 2,000 characters long. If it's longer, for example because a rationale lists every failed tool call in a long session, the platform cuts it to 2,000 characters and ends it with …[truncated]. The metric still succeeds and keeps its score or label. Only the explanation is cut. Scores, labels, ranges, and vocabularies are never cut: a value outside what the metric declares still makes the session end in error.

Scores and Labels​

Each metric returns a score, which is a number, or a label, which is one value from a list you define. A metric can also report that it doesn't apply to a session. For scores, you can declare a range and which direction counts as better, and for labels, a scale. For details, see Evaluation Metric Values and Direction.

Session, Turn, or Component​

A metric can answer once for the whole session, once for each turn, or for a component within a turn. A component is one building block of your pipeline, such as the retriever, which finds documents. Choose the level that matches your question:

  • Per session: "Did the conversation reach a resolution?"
  • Per turn: "Was this answer grounded?"
  • Per component: "Did the retriever return relevant documents?"

When a metric answers per turn, you can roll the results up per session using the average or the lowest-scoring turn. The lowest-scoring turn is useful when a single bad answer ruins the conversation.

Versions and Archiving​

Each time you save a metric with new code, you get a new version. Experiments use the latest version and record which version produced each result, so past results stay readable. Metrics belong to your workspace, and you can archive one you no longer use. For details, see Evaluation Metric Versions and Archiving.

LLM-as-a-Judge and Code​

LLM-as-a-judge asks a language model to rate the session against criteria you describe in plain language. Use it for qualities that need judgment: groundedness, helpfulness, tone, or whether the answer addresses the question. You write the criteria, choose the answers the model can give, and pick the model, without writing code. For how a judge works, see LLM-as-a-Judge Metrics.

A code evaluation relies on a Python function that reads the session and computes the value. Use it for things you can check exactly: whether a tool was called, whether a turn failed, how many tokens the conversation used, or whether the answer contains a required phrase. Code is fast, cheap, and gives the same result every time. For the helpers that read a session, see Session Readers for Code Metrics.

Many teams combine both: code for the facts and an LLM judge for the qualities.

Both methods produce one metric that the platform stores as code. To turn a metric into a pass rule for a pipeline, define an Evaluation goal. See Evaluation Goals.