Grader: assistant-contains-tool-output
Taxonomy
Section titled “Taxonomy”| Property | Value |
|---|---|
| Determinism | static |
| Cost | free |
| Reference | reference-free |
| Temporal scope | trajectory-level |
| Score kind | code |
Config
Section titled “Config”graders: - type: assistant-contains-tool-output config: tools: [tool-catalog-lookup_release_train] # one or more tool names pattern: '"release_id":"(rt_[0-9a-f]{16})"' # regex; group 1 (or full match) is the needle| Field | Type | Required | Default | Description |
|---|---|---|---|---|
tools |
string[] | Yes | — | Tool name(s) whose output is captured. Matches exactly or on a name. prefix (namespaced tools) |
pattern |
string | Yes | — | Regex matched against the tool output; capture group 1 (or the full match if no group) is the needle |
Turn scoping
Section titled “Turn scoping”Use the pipeline’s standard turn: field on the grader wrapper to restrict the
check to a specific conversation turn. When turn: 0 is set, the pipeline slices
the trajectory to that turn before the grader runs.
graders: - type: assistant-contains-tool-output turn: 0 config: tools: [tool-catalog-lookup_release_train] pattern: '"release_id":"(rt_[0-9a-f]{16})"'What it does
Section titled “What it does”Unlike transcript-contains — which matches an
author-supplied literal — this grader is dynamic: the needle is whatever a
tool actually returned at runtime. It runs the pattern regex against a tool’s
result to capture a value, then asserts that a subsequent assistant message
contains that exact value.
A typical use: a tool returns a computed identifier (a release id, an owner, a token) and you want to assert the agent surfaced that exact value to the user rather than inventing a plausible-looking one.
Behavior
Section titled “Behavior”The grader walks the trajectory in order:
- For each tool result whose tool name matches
tools(exactly, or as aname.prefix), it applies thepatternregex to the result. When the regex has a capture group, group 1 is the captured value; otherwise the full match is used. An empty capture (e.g. an unmatched optional group) is skipped. - It then looks for an assistant message after that tool result whose content contains the captured value. Matching is a plain case-sensitive substring test.
Passes when some captured value is echoed by a later assistant message.
Fails when:
- no tool output matched the
patternregex (nothing was captured), or - a value was captured but no subsequent assistant message echoed it, or
- the
patternregex is invalid (reported as failing evidence rather than throwing).
Evidence examples
Section titled “Evidence examples”✔ assistant echoed captured value "rt_0123456789abcdef"✘ no "lookup_release_train" output matched "\"release_id\":\"(rt_[0-9a-f]{16})\""✘ assistant did not echo 2 captured value(s)