Skip to main content
A custom metric you author: an LLM judge graded against a prompt, an API check your own endpoint answers, or a threshold that turns another metric into a pass/fail check. Reference any of them from a collector, run plan, alert or dashboard by its name.

LLM judges

  • The prompt is a plain string in TypeScript, inline or read from a file. In YAML it is inline or file://.
  • name, type and scope are immutable once created: changing one fails that resource. To change them, give the metric a new name. Editing the prompt, labels, bounds or options creates a new version.
  • contexts with TURN or SEGMENT must also include CALL, because checks and reports read the call-level value. A metric grades either each exchange or each utterance, not both: [CALL, TURN] and [CALL, SEGMENT] are valid, [TURN] and [CALL, TURN, SEGMENT] are not.
A SCALE judge with bands, graded on each exchange as well as the whole call:

API checks

An API check is a pass/fail metric your own endpoint answers. Set calculationType: HTTP_REQUEST and describe the request Roark sends after each call.
  • URL, headers, and body can use placeholders. A placeholder that doesn’t exist fails that resource’s apply.
  • The file is the source of truth for the request: a header or body you remove from the file is removed from the check, and labels you remove go back to Pass and Fail. Each change creates a new version.
  • name and calculationType are immutable. A metric can’t switch between an LLM judge and an API check: apply fails that resource instead.
  • Headers are stored as you write them. In TypeScript, read tokens from the environment rather than committing them.

Thresholds

A threshold checks another metric against a bar and passes or fails. Set calculationType: THRESHOLD, name the metric it checks in sourceMetric, and give the comparison.
defineThreshold needs @roarkanalytics/sdk 6.0.0 or later.
  • The comparison is immutable. sourceMetric, sourceVariant, operator, value, aggregationMode, countThreshold and sourceParticipantRole can’t change once the threshold exists, as in Roark. To change the bar, give the threshold a new name: apply creates the new one, and removes the old one when you prune. Only the labels can be edited in place. A value written differently but equal, such as 4 and 4.0, is not a change.
  • Roark names the threshold from its comparison (for example Response Time <= 2000 (Agent)), the same as one made in Roark.
  • A threshold and its source can be in the same config. Apply creates the source first, and removes the threshold first when you prune both.
  • If a threshold with the same comparison already exists in the project, apply fails that resource and names the existing one: reference it by its slug instead.
Once applied, a threshold is a metric like any other: list it in a collector’s metrics:, gate a simulation plan on it, alert on it, or chart its pass rate on a dashboard.
System metrics (Roark’s built-in metrics) are managed by Roark, not by you: you never define them in config. To collect one, just reference its slug in a collector’s metrics: list, exactly like a custom metric. The same is true for formulas and patterns, which are not yet definable in config: create them in Studio or through the API, then reference them by slug.
For the full field reference of every kind, see the Config DSL reference schema.