Evals

Filters and sampling

Decide which traffic an eval scores: filters on any trace field (one agent, runs that used a span, one customer) and sampling to score a steady share, or a span eval only when a run eval asks.

An eval scores every trace of its level unless you narrow it. Filters say which traces count; sampling says how much of them to score. Traffic that doesn't match costs nothing and makes no result.

Filters

Set them in the create dialog, or later in ⋯ → Settings → Filters in the editor. A change to the filters is a new version.

Click + Filter, pick a property, an operator and a value:

Property typeOperators
TextIs · Is not · Contains · Does not contain · Starts with · Ends with · Matches regex · Is set · Is not set
NumberEquals · Not equal · Greater than · Greater than or equal to · Less than · Less than or equal to · Is set · Is not set
True / falseIs true · Is false · Is set · Is not set

Rules are joined with AND or OR. What you can filter on depends on the level:

LevelProperties
RunThe run's own fields (agent, status, duration, tokens, cost, error), its metadata keys, and Its spans
SpanThe span's own fields (kind, name, tool, model, status, duration, tokens), its attributes, and its run's fields
ConversationThe thread's fields, and Its runs

One agent

Which agent an eval scores is a filter like any other: run.agent_name Is support-bot. With no agent filter, the eval scores every agent. The agent name is the name you give wrapAgent.

Runs that used a certain span

On a run eval, Its spans adds a block about the run's spans. Pick Span name or Span kind first to say which span it is about, then add conditions on that same span, and say how many must match: Any span, No span, At least N spans, The first span, The last span or The Nth span.

Any span where name is run_sql and status is error

means runs with a run_sql call that errored. A conversation eval can filter on Its runs the same way, with span blocks inside.

Per-customer evals

Anything you set with run.setMetadata({ tenant, plan }) is a filter: run.metadata.tenant Is acme makes an eval for one customer, with its own versions and thresholds.

Sampling

Sampling decides how much of the matching traffic is scored: Every run (span, conversation), or A share as a percentage.

  • A trace's place in the sample is fixed by its id: it is always in or always out, and lowering the share keeps every trace that was already in.
  • Each eval samples on its own, so two evals at 10% see different traffic.
  • Sampling changes the moment you set it and is never a version.

Use it to cap cost on high-volume agents, and to keep a Human review step's queue at a size people can keep up with.

Only when a run eval asks

A span eval has a third choice: Only when a run eval asks. It then scores no live traffic of its own, only the spans a run eval's Score spans step sends it. The canvas trigger reads When a run eval asks: spans, and on its results, Filter → Asked by separates Live traffic from A run eval.

On this page