Exact Match

Checks whether the agent output is exactly equal to the expected output. Supports case-insensitive comparison, whitespace trimming, and whitespace normalization.

Config

FieldTypeRequiredDefaultDescription
case_sensitivebooleanNofalseEnable case-sensitive comparison
trimbooleanNotrueTrim leading and trailing whitespace before comparing
normalize_whitespacebooleanNofalseCollapse consecutive whitespace characters into a single space

Use Cases

  • Classification tasks — Verify that an agent returns the exact expected label (e.g. "positive", "negative", "spam") for a given input.
  • Deterministic outputs — Assert that structured responses such as IDs, codes, or formatted strings match the ground truth exactly.
  • Regression testing — Ensure that agent outputs haven't drifted from known-good answers across model updates or prompt changes.
  • Data extraction — Confirm that extracted values (dates, numbers, names) match expected outputs precisely.

Examples

Basic case-insensitive match

// Pass if output equals "positive" (case-insensitive)
{
  "case_sensitive": false
}
// expectedOutput: "positive"
// Output: "Positive" → pass
// Output: "POSITIVE" → pass
// Output: "positive!" → fail

Case-sensitive match

// Require exact casing
{
  "case_sensitive": true
}
// expectedOutput: "OK"
// Output: "OK" → pass
// Output: "ok" → fail
// Output: "Ok" → fail

Whitespace normalization

// Collapse whitespace before comparing
{
  "normalize_whitespace": true
}
// expectedOutput: "Hello World"
// Output: "Hello   World" → pass (collapsed to "Hello World")
// Output: "Hello\nWorld" → pass (collapsed to "Hello World")

Scoring

Returns 1.0 (pass) or 0.0 (fail). No intermediate scores. Returns 0.0 if no expectedOutput is provided.

Performance

Exact Match performs a simple string equality check with no external API calls. Execution time is under 1ms regardless of output length, making it ideal for high-volume pipelines where you need to evaluate every trace without adding latency or cost.

Have questions? Join our community!

Connect with other developers and the 2Signal team.

Join Discord