Skip to main content
Pass scorers into evaluate(...) to grade each case. On the experiment sheet they show up as scorecard evaluators (Contains, Trajectory, and the rest). Thresholds, weights, and the overall score work the same as Scorecards in Tables. The underlying check types are documented in Column Types.

Scorers at a glance

Every typed helper also accepts shared scoring options — weight, required, and thresholds.

Shared scoring options

Every scorer produces a score in [0, 1]. These three options — accepted by every typed helper — control how much a scorer counts and where its pass/fail line sits. They behave exactly like Scorecards in Tables.
  • Weight — how much this scorer contributes to the overall score. The scorecard is a weighted mean, so weight=2 pulls twice as hard as the default weight=1. Use it to make the checks you care about most dominate the result.
  • Required — if true, this scorer failing fails the whole scorecard, no matter how well the weighted average comes out. Use it for must-pass checks (e.g. the agent called the right tools).
  • Thresholds — the per-scorer cutoffs that decide pass vs. warn vs. fail, each in [0, 1] (default pass 0.8, warn 0.6). Raise the pass threshold for a stricter bar on that check.
This support agent example weights the trajectory check higher, marks it required, and sets a pass threshold:

Scorer types

Each helper below maps to a scorecard check type in Column Types. All of them accept the shared scoring options above.

Compare

Compare two columns. By default that is Output vs Expected as strings. Pass exactly two column titles in sources. Behavior matches the Compare type in Column Types. Set how they compare with comparison_type / comparisonType: Number operators: EQ, NE, GT, GTE, LT, LTE.

Contains

Check whether a column contains a literal or another column’s value. Pass exactly one of value or value_source / valueSource.

Regex

Match a column against a regular expression.

Count

Score by character, word, sentence, or paragraph count bounds. Require at least one of min_count / minCount or max_count / maxCount. Backend type values: chars, words, sentences, paragraphs.

Assert Valid

Validate a column as object, number, or SQL. There is no json / boolean / string assert type.

LLM Assertion

Score a column with an LLM judge prompt. Pass exactly one of prompt or prompt_source / promptSource.

Trajectory

Scores Tool: <name> spans from the imported Trace against accepted scenarios. Any runner works if those spans exist — emit them with a framework helper or traceTool (see Runner), or copy a harness from the Quickstart. Pass exactly one of inline accepted_scenarios / acceptedScenarios, or expected_source / expectedSource (usually "Expected Trace"). Inline accepted_scenarios:
Or read scenarios from an Expected Trace column. Cell JSON:
Put that JSON on each case as expected_trace / expectedTrace (or on a dashboard dataset sheet). Local helpers: score_trajectory / scoreTrajectory, diagnose_trajectory_failure / diagnoseTrajectoryFailure, and JS-only extractTrajectoryToolNames.

Custom Code

Prefer passing a named function by reference in scorers. The SDK serializes it to a CODE_EXECUTION scorecard step. Parameter names map to columns: Any other param name is looked up as a column title of the same name. Return a number (or {"score": x}, which is normalized to x).
  • Use a named function — no lambdas / anonymous functions.
  • Sync only — async scorers are rejected.
  • Default title is the function name with _ → spaces. Override with scorer_from_function(fn, title=...) / scorerFromFunction(fn, { title }) when needed.

code_execution_column / codeExecutionColumn

Use this when you want a raw code string instead of a function. code is required. Default language is PYTHON (Python helper) or JAVASCRIPT (JS helper). Row values are available as data.