Evals
Grade one example with fagi eval test, and gate CI on a JSONL file of cases with fagi eval suite and a minimum match rate
Use fagi eval test to grade one input and output example with a judge model, and fagi eval suite to grade every case in a JSONL file and fail a CI job when the match rate drops. Running Evaluations covers evaluations in the dashboard.
- Signed in to the CLI (see Sign in);
--dry-runneeds no sign-in - Criteria for the judge, inline or in an eval file (see From an eval file)
- A judge model your workspace can use (see Evaluator models). Each judge call is a model call and can be charged
Grade one example
fagi eval test --criteria 'Does {{output}} correctly answer {{input}}?' \
--var input='What is the capital of France?' --var output='Paris.' \
--model JUDGE_MODEL --output-type pass-fail --json
JUDGE_MODEL is the name shown in the evaluator model picker when you create an eval on the platform. Every {{name}} in the criteria needs a value from --var, --var-json or the eval file’s config.mapping. When you pass --criteria, --var or --var-json, a missing one exits 2 before anything is sent; a run from --data-file alone, and every fagi eval suite case, is not checked locally, so the call is sent and charged.
| Flag | What it does |
|---|---|
--model JUDGE_MODEL | Judge model (required); replaces any model in the file |
--output-type TYPE | pass-fail, score, numeric, choices or reason (required) |
--criteria TEXT | Judge instructions; overrides the file’s criteria. Single-quote it so the shell leaves $ and ! alone |
--var KEY=VALUE | One input variable, taken verbatim after the first =; repeatable |
--var-json KEY=JSON | One structured input variable, such as --var-json 'context={"docs":["a","b"]}'; repeatable |
--data-file FILE | An eval file, or - for stdin (max 16 MiB) |
--name NAME | Eval name (default cli-eval-test) |
--dry-run | Validate and print the request without signing in, sending anything or charging; sensitive fields are redacted |
--timeout DURATION | Network deadline (default 2m); server work may continue after it |
Without --data-file, you need --criteria and at least one --var or --var-json. Command lines can show up in process listings and shell history, so never pass a secret in --var; put it in an eval file and use --data-file -.
From an eval file
An eval file holds one JSON object with template_type set to exactly Llm, a name, the criteria and a config.mapping of the example’s values:
{
"template_type": "Llm",
"name": "answer-correctness-example",
"criteria": "Does {{output}} correctly answer {{input}}?",
"config": {
"mapping": {
"input": "What is the capital of France?",
"output": "Paris."
}
},
"reason_column": true
}
fagi eval test --data-file case.json --model JUDGE_MODEL --output-type pass-fail --dry-run --json
fagi eval test --data-file case.json --model JUDGE_MODEL --output-type pass-fail --timeout 2m --json
--criteria, --name and each --var or --var-json override or add to the file’s values. The mapping values are the example itself, not file paths or dataset column names.
To grade your own application’s answer, keep the criteria and the other values in the eval file and pass the output straight in. Every criteria token other than output must already be a key in the file’s config.mapping:
fagi eval test --data-file rubric.json \
--var output="$(./my-agent 'refund for order 42')" \
--model JUDGE_MODEL --output-type score --json
fagi eval test grades with your own criteria only. To test a built-in Future AGI evaluator or a code evaluator, use fagi api evaluations test (see Call any endpoint).
Read the result
{
"log_id": "11111111-1111-4111-8111-111111111111",
"output": "Passed",
"reason": "The answer is correct.",
"result": {
"log_id": "11111111-1111-4111-8111-111111111111",
"output": "Passed",
"reason": "The answer is correct."
}
}
Example output. output depends on the output type and the judge: a string such as "Passed", a number or a list. result holds the full server result. Table output shows LOG_ID, OUTPUT and REASON.
Exit 0 means the call completed, not that the answer passed; fagi eval test never exits 5. Other codes are the same as every command; see Exit codes.
A timeout does not cancel or refund the call. Before rerunning, check whether it completed, so you are not charged twice.
Gate CI with a suite of cases
fagi eval suite takes an eval file and a JSONL file of cases. --template takes the same eval file as fagi eval test --data-file, except that config.mapping is optional. Save it as eval.json:
{
"template_type": "Llm",
"name": "refund-answers",
"criteria": "Does {{output}} correctly answer {{input}}?",
"reason_column": true
}
Save the cases as golden.jsonl, one JSON object per line:
{"id": "refund-1", "input": "Can I get a refund after 30 days?", "output": "No, refunds close after 30 days.", "expected": "Passed"}
{"id": "refund-2", "input": "How do I return a gift?", "output": "Use the gift receipt at any store.", "expected": "Passed"}
Preview the requests and the number of charged calls without signing in, then run the suite and fail below 90%:
fagi eval suite --template eval.json --cases golden.jsonl \
--model JUDGE_MODEL --output-type pass-fail \
--id-column id --expect-column expected --dry-run
fagi eval suite --template eval.json --cases golden.jsonl \
--model JUDGE_MODEL --output-type pass-fail \
--id-column id --expect-column expected \
--min-match-rate 0.9 --junit-file reports/evals.xml -o jsonl
Every key on a case line, except the ID and expectation keys, is merged over the eval file’s config.mapping. To use dataset rows as cases, pull the dataset to a JSONL file whose column names match the criteria’s {{name}} tokens, as Turn failing traces into an eval set shows.
| Flag | What it does |
|---|---|
--template FILE | The eval file, or - for stdin (required). --template and --cases can’t both read stdin (exit 2) |
--cases FILE | JSONL cases, or - for stdin (required); at most 16 MiB per file and 1 MiB per line |
--model JUDGE_MODEL | Judge model (required) |
--output-type TYPE | pass-fail, score, numeric, choices or reason (required) |
--expect JSON | Expected output for every case, as JSON; quote strings, as in --expect '"Passed"' |
--expect-column KEY | Case key holding that case’s expected value; overrides --expect when the key is present |
--id-column KEY | Case key used as the case ID (default: the line number) |
--min-match-rate RATE | Exit 5 when matched/scored cases is below RATE (0 to 1). Needs --expect or --expect-column; a run with no scored cases fails the gate |
--max-cases N | Cap on charged calls, 1 to 500 (default 20); a longer file exits 2 before any call |
--junit-file PATH | Also write a JUnit XML report, replacing the file. The parent folder must exist, and the path must not be a symlink or folder |
--timeout DURATION | Deadline for each call (default 2m) |
--dry-run | Validate and print the call count and requests without signing in, sending anything or charging; sensitive fields are redacted |
How a case matches
Run fagi eval test --json once and copy its output as your expected value; for pass-fail that is "Passed". A case with an expected value is scored, and it matches when output is equal to that value as JSON: strings compare exactly and numbers by exact decimal value, so 1 and 1.0 are equal. A rate exactly equal to --min-match-rate passes. Treat the rate as a regression signal, not a measure of accuracy.
Calls run one at a time. The first failed call (an API or network error, or a response the CLI can’t read) stops the suite. The partial report is still printed (and written to --junit-file), and the command exits with that error’s code. Cases before the failure were already charged, so rerunning charges them again.
Read the report
Planned 2 model calls (charged).
CASE OUTPUT EXPECTED MATCH REASON
refund-1 "Passed" "Passed" yes The answer is correct.
refund-2 "Failed" "Passed" no The answer is incomplete.
Matched 1 of 2 scored cases (50.0%); required 90%: failed.
Next: check the rows with MATCH no, then fix the app or prompt; change
--min-match-rate only intentionally.
MATCH is yes, no, - for an unscored case or error. With -o jsonl the suite streams one case line per call and a closing suite_finished line with match_rate, passed and stop_reason; --json prints only the summary, with every case in its results array. In the JUnit file a mismatch is a <failure>, the case that stopped the suite is an <error>, and unscored cases and cases not run are <skipped>. A mismatch is a failure even when the rate meets the threshold, so gate on the exit code, not the JUnit result. The results are not stored on the platform as a dataset or experiment.
Exit 5 means the match rate was below --min-match-rate. Other codes are the same as every command; see Exit codes.
Python eval files
fagi eval run will run Python eval files through the Future AGI Python SDK. It is not available yet: it exits 2 with details.code sdk_runner_unavailable or capability_disabled. Use fagi eval test or fagi eval suite instead.
Dive deeper
Questions & Discussion