Skip to main content

Evaluator operations

An evaluator is an online scoring rule: it picks a share of your live traffic and grades each answer, often with a judge model. Evaluator operations are the tools that let you change a rule without guessing. You can try a rule on real requests before it goes live, see what it will cost each day, find out why a particular request was or was not graded, go back to an earlier version of the rule when a change made things worse, grade last week's traffic so a new rule has history from day one, and check how often the judge agrees with people who graded the same answers by hand. This is an enterprise feature that needs the evals licence feature, like the rest of evals.

Everything here works on the rules you already have. Nothing changes how live scoring runs, and live requests are never slowed down by any of it.

A real-world scenario​

A support team grades 5 percent of its chatbot's answers with a g_eval judge that asks "is the reply polite and does it solve the problem". They want a stricter judge model and a higher threshold. Before saving, an admin pastes ten request ids from the logs page into Try it before saving and sees that two good answers would now fail, so they lower the threshold a little. Preview cost says the new judge will cost about 3 dollars a day, under the 5 dollar budget. They save, which keeps the old settings as version 1 and the new ones as version 2, and version 2 grades traffic from then on. Answers version 1 already graded keep their version 1 scores, because a backfill only fills in requests the rule has not graded yet. Their review team labels 50 production answers a week in a review queue, so two weeks later Judge versus human agreement shows that version 2 agrees with the reviewers 91 percent of the time against 78 percent for version 1, each measured on the reviewed answers that version graded. A month later a model update makes the judge too strict, and one click on Restore puts the earlier settings back.

Steps​

  1. In the Admin UI open Evals, then the Online tab. You need to be a proxy admin to change rules. Admin viewers can read everything described here except the test and the cost preview.
  2. Click New rule, or open a rule's row menu and click Edit. Fill in the match, the sample percentage and the scorers as described in online scoring.
  3. In the Try it before saving box pick Logged requests, paste up to 10 request ids from the logs page, and click Run test. Each request shows its scores, the judge's reasons and whether the rule's match selects it. Then click Preview cost.
  4. Click Create rule or Save rule. Every save keeps a numbered version.
  5. Click the rule's row. Under the 7 day summary you find three cards: Versions, Backfills and Judge versus human agreement.
  6. In Backfills pick Logged requests in a time window, keep Days back at 7 and Score only what live sampling would pick on, set a judge budget if the rule uses a judge, and click Start backfill. The table shows its progress every few seconds.
  7. In Judge versus human agreement pick the review queue your team labels production answers in and click Compare.

The same steps with curl, where $SPANWAY_PROXY_URL is your gateway and $SPANWAY_ADMIN_KEY a proxy admin key:

curl -X POST "$SPANWAY_PROXY_URL/eval/online/rules/test" \
-H "Authorization: Bearer $SPANWAY_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{"match": {"tags": ["support"]},
"scorers": [{"type": "g_eval", "judge_model": "gpt-5.5", "name": "tone",
"criteria": "The reply is polite and resolves the question.", "threshold": 0.6}],
"samples": {"type": "requests", "request_ids": ["chatcmpl-8d2f", "chatcmpl-91aa"]},
"max_judge_cost": 0.5}'

curl -X POST "$SPANWAY_PROXY_URL/eval/online/rules/cost_preview" \
-H "Authorization: Bearer $SPANWAY_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{"match": {"tags": ["support"]}, "sample_percentage": 5, "daily_judge_budget": 5,
"scorers": [{"type": "g_eval", "judge_model": "gpt-5.5", "name": "tone",
"criteria": "The reply is polite and resolves the question."}],
"judge_cost_per_request": 0.006}'

curl -X POST "$SPANWAY_PROXY_URL/eval/online/rules/$RULE_ID/backfills" \
-H "Authorization: Bearer $SPANWAY_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{"source": {"type": "spend_logs", "start": "2026-11-14T00:00:00Z", "end": "2026-11-21T00:00:00Z"},
"max_requests": 200, "apply_sampling": true, "judge_budget": 2}'

curl "$SPANWAY_PROXY_URL/eval/online/rules/$RULE_ID/agreement?queue_id=$QUEUE_ID" \
-H "Authorization: Bearer $SPANWAY_ADMIN_KEY"

Expected result​

The test answers with one entry per sample and one score per scorer, and stores nothing. The cost preview answers with the matching requests a day, how many would be scored and the judge cost a day. The backfill answers at once with a backfill record whose status is running, and its scores appear in the rule's summary under the original request times. The agreement answers with one row per scorer and rule version, for example "scorer_key": "0:g_eval@v2" with "agreement": 0.91.

Test a rule before you save it​

POST /eval/online/rules/test runs every scorer of a rule on up to 10 samples exactly the way live scoring would, and writes nothing to the database. It is how you catch a criterion that confuses the judge, or a threshold that fails good answers, before real traffic is graded.

Samples come in three kinds:

  • requests takes logged request ids. The gateway uses the prompt and answer it stored for each one, so this needs store_prompts_in_spend_logs on. For each request the answer also says whether the rule's match selects it (matched). When you send rule_id of a saved rule, it also says whether live sampling picks that request (sampled).
  • lens takes up to 10 Lens trace ids. The conversation of each trace's main model call is graded, and its final answer is the reply. This needs Lens to be set up and your key to be allowed to read traces.
  • items takes questions and answers you type, which works on every gateway.

A request without a stored prompt and chat answer, a missing request or an unreadable trace is listed under skipped with the reason.

Judge calls in a test are billed to your own key and go through your key's budgets and guardrails. The data policy of each logged request still applies, so a judge can only run on a deployment the original request was allowed to use. max_judge_cost (default 1 dollar, at most 10) stops judge calls once the test spent that much, and later scorers are marked over_budget. Remote scorers are called with the target they are registered at now, just as live scoring would call them. A test never sends a remote scorer alert and never counts against the rule's daily remote call cap, so a remote scorer that cannot be reached shows up only as that sample's error. judge_cost_per_request in the answer is what one graded sample cost on average, which you can hand to the cost preview.

In the Admin UI the Try it before saving box at the bottom of the rule dialog does the same. Its controls:

ControlWhat it does
SamplesPicks logged requests, a question and answer you type, or Lens traces. Logged requests need prompt storage on, Lens traces need Lens.
Request IDs or Trace IDsUp to 10, comma separated. Copy them from the logs page or the Lens trace list.
Question, Answer to scoreOne typed sample, shown when you pick the typed kind.
Most to spend on judges (USD)Default 1. Judge calls stop once the test spent this much, so a test can never run up a bill.
Run testRuns the scorers and lists each sample's verdicts and reasons, and the test's judge cost.
Preview costShows the cost preview below, using the test's measured cost per request when you ran one.

Preview the cost​

POST /eval/online/rules/cost_preview estimates how many requests a rule would grade each day and what its judge calls would cost, before you turn it on. It counts the successful requests the rule's match selected over the last lookback_days days (1 to 31, default 7), and multiplies by the sample percentage. Sampling spreads evenly over request ids, so the expected share it picks is exactly the percentage.

The judge cost per graded request comes from one of these, named in basis:

basisMeaning
measuredYou sent judge_cost_per_request, for example the figure a test returned. This is the most accurate.
token_estimateEstimated from the judge model's price, assuming each judged scorer makes 2 judge calls that read the request and its answer (the traffic's mean token counts) plus about 600 tokens of judge instructions, and write about 200 tokens.
unpricedA judge model has no price in the gateway's price list, so no cost is guessed. Run a test and send its measured cost.
no_judgeNo scorer uses a judge, so the rule has no judge cost.

budget_binding is true when the expected daily spend is above daily_judge_budget, and scored_per_day_within_budget says how many requests a day the budget pays for. Once a day's budget is spent, judged scorers stop until the next UTC day and the requests count as over budget. Nothing is stored and no model is called.

Check why a request was or was not scored​

Sampling is decided by a fingerprint of the rule id and the request id, not by chance. Every gateway pod therefore makes the same choice for the same request, a retried request gets the same answer, and different rules pick independent slices of traffic. GET /eval/online/rules/{rule_id}/sampling?request_id=... shows the decision for one request: position is where the request falls from 0 to 100, and it is sampled when that is below the rule's percentage. The answer also says whether the request is in the spend logs, whether the rule's match selects it, whether a score was stored, and an explanation in plain words. A sampled request without a score was most likely shed under load, over the judge budget or unscorable, which the rule's daily funnel counts.

In the Admin UI paste the request id into Why was a request scored or not? at the bottom of the Judge versus human agreement card and click Check.

Versions and restore​

Every time a rule is created, changed or restored, the gateway saves a numbered copy of its settings: name, description, match, sample percentage, scorers with their judge models, criteria and thresholds, budgets and alert settings. Rules created before versions were kept start at version 1 with nothing saved, and the first change saves their settings as version 1 before it moves on, so those settings can still be restored. The rule's own version field says which one runs now, and every score row records the rule_version that produced it, so charts and agreement figures never mix two judges.

  • GET /eval/online/rules/{rule_id}/versions lists the saved versions, newest first.
  • POST /eval/online/rules/{rule_id}/versions/{version}/restore puts a saved version's settings back and saves the result as a new version, so a restore can itself be undone. You can send {"reason": "..."}, which is written to the audit log.

A restore follows three rules. Scores are kept by scorer position, so scorers that were added after the version you restore stay on the rule with their current settings. The rule stays switched on or off as it is now, so a restore never starts or stops scoring behind your back. The saved settings are checked again before anything changes: a judge model that is no longer served, a remote scorer that was removed, a judged rule without a daily budget, or a name another rule took since is refused, and the rule is left as it was.

In the Admin UI the Versions card lists each version with what changed, its scorers, its sampling and who saved it. Proxy admins get a Restore button on every version except the current one, which asks for confirmation first.

Backfill past traffic​

A backfill grades traffic that already happened, with a saved rule, in the background. It gives a new rule a history to chart and compare from day one, and fills in requests a changed rule has not graded yet. A backfill never grades a request again once the rule scored it, under any version, so it cannot show how a new judge version would have graded answers an earlier version already scored. To see that, paste those request ids into Try it before saving, which runs the new settings and stores nothing.

POST /eval/online/rules/{rule_id}/backfills takes:

FieldMeaning
sourceEither {"type": "spend_logs", "start": ..., "end": ...}, the successful logged requests the rule's match selects in a window of at most 31 days, read newest first up to 20,000 of them, or {"type": "lens", "trace_ids": [...]}, up to 200 Lens traces you pick.
max_requestsThe most requests to grade, 1 to 500, default 100.
apply_samplingDefault true. Only the requests live sampling would have picked are graded, so backfilled and live scores form one consistent sample. Set it to false to grade every matching request up to max_requests, which builds history faster but costs more judge calls.
judge_budgetRequired when the rule uses a judge. The most this backfill may spend on judge calls, separate from the rule's daily budget.

Requests the rule already scored, under any of its versions, are skipped and counted as already_scored, so running a backfill again is safe and never grades a request twice. Logged requests without a stored prompt and chat answer, and traces without a final answer, are counted as unreadable. Judge calls are billed exactly like live scoring, to the rule's creator as online eval spend, and the data policy of each request applies. Scores are stored with the original request time, the rule version the backfill started with and the backfill id, so they show up in the rule's summary for the days they belong to.

One backfill per rule runs at a time. GET /eval/online/rules/{rule_id}/backfills lists the 50 newest with their counters, and GET /eval/online/rules/{rule_id}/backfills/{backfill_id} reads one. A backfill whose gateway pod stopped stays running in the database, so one that has been silent for 10 minutes is shown with "interrupted": true, and starting a new backfill marks it as failed. POST /eval/online/rules/{rule_id}/backfills/{backfill_id}/cancel stops a running backfill before it scores another request, and the scores it already wrote stay.

In the Admin UI the Backfills card has these controls for proxy admins:

ControlWhat it does
What to scoreLogged requests in a time window or Lens traces I pick.
Days backFor logged requests, how many days before now to read, at most 31. Default 7.
Trace IDsFor Lens, up to 200 trace ids, comma separated.
Most requests to scoreDefault 100, at most 500.
Score only what live sampling would pickOn by default. On keeps backfilled and live scores one consistent sample. Off grades every matching request up to the limit, which costs more.
Judge budget for this backfill (USD)Required when the rule uses a judge. Judge calls stop once the backfill spent this much.
Start backfillStarts it in the background.
CancelShown on a running backfill.

Judge versus human agreement​

A judge is only useful if it agrees with people. GET /eval/online/rules/{rule_id}/agreement?queue_id=... compares the rule's stored verdicts with the labels your reviewers gave the same production requests in a review queue. Requests reach a review queue when you add production traffic to it, as the review queue page describes. Every request both the rule and the reviewers judged is compared, and only items whose labels are all in and do not tie count.

Each scorer and rule version is a separate row, named like 0:g_eval@v2 (scorer position, type and version), so a judge change never pools with the judge it replaced. Each row has the agreement (the share of requests where judge and humans agree), Cohen's kappa (agreement corrected for chance, where 1 is perfect and 0 is no better than chance), the confusion counts, the mean score error, the version's threshold and a suggested threshold that would have agreed best. Fewer than 30 compared requests is marked low_sample. Send version to compare one version only. Reading it changes nothing.

In the Admin UI the Judge versus human agreement card has a Review queue picker, an optional Rule version, and a Compare button.

Permissions and audit​

Testing, the cost preview, restoring, and starting or cancelling a backfill are for proxy admins, because they spend on judges or change what grades production traffic. Listing versions and backfills, the sampling check and the agreement figures are also open to proxy admin viewers. Rules cover every team, so callers scoped to a team or an organization, custom role holders included, get 403.

Every change writes an audit log row with who made it, the key, and the values before and after, never a prompt or an answer:

ActionTableRow
Creating or changing a ruleSpanway_OnlineEvalRuleTablecreated or updated, the rule before and after. Its saved version is written in the same database transaction.
Restoring a versionSpanway_OnlineEvalRuleTableupdated, the rule before and after with change set to restored from version <n> and your reason.
Running a testSpanway_OnlineEvalRuleTableinvoked, on the rule id or draft, with the sample kind, the number of samples and the judge cost.
Starting a backfillSpanway_OnlineEvalBackfillTablecreated, the backfill record.
Cancelling a backfillSpanway_OnlineEvalBackfillTableupdated, the record before and after with change set to cancelled and your reason.

Saved versions and backfill records hold settings and counts only, and are deleted together with their rule. See database tables.

Errors​

Every error body has the shape {"detail": {"error": "<message>"}}.

Status and messageMeaningFix
400 scorers[<n>]: ...A scorer cannot run on live traffic, its judge model is not served, or its settings are wrong. The rest of the message names the problem, as in online scoring.Fix the scorer the message names.
400 unknown model group(s): <names> or no key has the alias or hash: <keys>The match names something the gateway does not have.Fix the match.
400 Lens traces cannot be read: Lens is not configured on this gatewayLens samples or a Lens backfill were asked for, but Lens is not set up.Set up Lens, or use logged requests.
400 Lens traces cannot be read: your key may not read tracesYour key has no trace read access.Use a key that can read Lens traces.
400 a rule with a judged scorer needs judge_budgetA backfill of a rule that uses a judge was started without a budget.Send judge_budget.
400 a rule with a judged scorer needs daily_judge_budgetThe version you restore uses a judge but has no daily budget.Edit the rule instead, or restore a version that has one.
400 the rule has a scorer that no longer parsesA stored scorer cannot be read any more, so the rule cannot score.Edit the rule and fix its scorers.
400 no request in queue <id> was scored by this ruleThe review queue and the rule have no request in common.Add production requests the rule scored to the queue, or run a backfill over them.
403 online rules cover every team, so only proxy admins and admin viewers can read themA team-scoped caller asked for rule data.Use a proxy admin or admin viewer key.
404 rule_id=<id> not found, version <n> of rule <id> not found, backfill_id=<id> not found or queue_id=<id> not foundNothing has that id.Check the id.
409 a backfill of this rule is already runningOne backfill per rule runs at a time.Wait for it, or cancel it.
409 the backfill is <status>, not runningA cancel arrived after the backfill ended.Nothing to do.
409 a rule named '<name>' already existsThe version you restore has a name another rule took since.Rename the other rule first.
422A field is out of range, such as more than 10 test samples, a backfill window over 31 days, or a reason with control characters.Fix the field the message names.

The error reference lists these too.

Logs​

LevelLineMeaningAction
INFOonline scoring: backfill <id> of rule <rule_id> ended, <n> scored, <n> already scored, <n> unreadable, <cost> USD judgeA backfill finished or was cancelled.None.
WARNINGonline scoring: backfill <id> of rule <rule_id> failed: <error type>A backfill stopped on an error. Its record has status failed and the full error.Read the backfill's error, fix the cause, and start it again. Requests it already scored are skipped.

The log reference lists every eval log line.