Exact Match
Checks whether the agent output is exactly equal to the expected output. Supports case-insensitive comparison, whitespace trimming, and whitespace normalization.
Config
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
case_sensitive | boolean | No | false | Enable case-sensitive comparison |
trim | boolean | No | true | Trim leading and trailing whitespace before comparing |
normalize_whitespace | boolean | No | false | Collapse 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!" → failCase-sensitive match
// Require exact casing
{
"case_sensitive": true
}
// expectedOutput: "OK"
// Output: "OK" → pass
// Output: "ok" → fail
// Output: "Ok" → failWhitespace 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.