Evaluate an agent from the command line with the MorganaBench CLI
In this tutorial we will evaluate an agent's answers against a MorganaBench benchmark, entirely from the command line using the mb CLI. We will start from a file of agent responses, submit it for scoring, watch the evaluation run, and download a results file containing per-metric scores. Along the way we will become familiar with the mb login, mb metrics list, mb eval create, mb eval get, and mb eval download commands.
By the end of this tutorial, you will have a results.json file containing the evaluation scores for an agent that answered questions about U.S. presidential inaugural speeches.
Prerequisites
-
The MorganaBench CLI installed (
mb). If you don't have it yet, install it with:Note
You will probably need to enter your machine's password to authorize the installation.
-
A MorganaBench account (email as username and password).
- The URL of your MorganaBench server, e.g.,
https://morganabench.example.com.
Step 1: Confirm the CLI is installed
First, check that the mb binary is on your path:
The output should look something like:
api: {
"git_hash": "a12916e9",
"version": "0.1.0"
}
cli_version: 0.2.4
commit: bcf8dcafa1a17ee535241fcff070ce48c3f8cb8d
date: 2026-04-05T10:22:01Z
server_url: https://morganabench.morganalabs.ai
If instead you see command not found: mb, the CLI is not installed yet — return to the CLI Guide and install it before continuing.
Step 2: Log in
Now, log in with your email and password:
The output should look something like:
Login successful
Email: you@example.com
Profile: default
URL: https://morganabench.example.com
Token expires in: 86400s
You will notice a new file appears at ~/.morganabench/tokens.yaml. This holds your access token, so every command from here on authenticates automatically — you won't need to pass your password again.
Let's check that the login worked:
The output includes several of your credentials and should look something like:
created_at: 2026-05-03T05:33:52.965234Z
email: you@example.com
full_name: your name
id: <your id>
last_login_at: 2026-07-21T08:07:33.355992Z
organization_id: <your organization id>
role: your role
server_url: https://morganabench.example.com
status: active
updated_at: 2026-07-21T08:07:33.355992Z
Step 3: Get the agent's answers
For this tutorial we will use a ready-made file of agent responses so you can focus on the evaluation itself. The file contains 50 test cases about U.S. inaugural speeches, each already answered by an agent (see agent response for a simple agent execution for generating the file).
Download it into your current directory:
curl -o Inaugural_speeches_benchmark_executed.jsonl \
https://raw.githubusercontent.com/morganalabs/mb-resources/refs/heads/main/Inaugural_speeches_benchmark_executed.jsonl
Let's check that the file arrived and see how many cases it holds:
The output should look something like:
Notice that there are ~50 lines — each line is one test case, in JSONL format (one JSON object per line). Let's peek at the very first one:
You will notice each case has three important parts:
inputs— the question that was askedexpectations— the reference (ground-truth) answeroutputs— the answer the agent produced
That last part, outputs.response, is what we are about to have MorganaBench score.
Step 4: See which metrics are available
Before we score anything, let's see the metrics MorganaBench can measure:
The output should look something like:
Built-in metrics:
id name direction range
-------------------------------------------------------------------------------
ground_truth_alignment ground_truth_alignment higher_is_better 0-1
ground_truth_contradiction ground_truth_contradiction lower_is_better 0-1
faithfulness faithfulness higher_is_better 0-1
query_relevance query_relevance higher_is_better 0-1
context_sufficiency context_sufficiency higher_is_better 0-1
refusal refusal lower_is_better 0-1
tool_call_correctness tool_call_correctness higher_is_better 0-1
no_tool_call_correctness no_tool_call_correctness higher_is_better 0-1
Custom metrics:
No items found.
Total: 8
The built-in metrics are the ones MorganaBench ships; custom metrics are the ones your organization has authored, so yours may list some. To see what each metric measures, add --output json: every row then carries a description.
For this tutorial we will use two of them. ground_truth_alignment: The degree to which the reference answer is covered by the response. It is scored from 0.0 to 1.0, and higher is better. refusal: The rate at which the agent refuses requests it was expected to answer. Each case scores 0 or 1, and lower is better. For a full description of each metric and how to read its scores, see Metrics.
Step 5: Create the evaluation
Now for the main event. We will submit the file for scoring against our two chosen metrics:
mb eval create "Inaugural speeches CLI eval" \
--file Inaugural_speeches_benchmark_executed.jsonl \
--metrics ground_truth_alignment,refusal
The command will print progress to your terminal while it works. You will notice that it does not return immediately — by default mb eval create waits, polling the server until scoring finishes. This may take a few minutes, since the server is scoring all 50 cases across both metrics.
When it completes, the output should look something like:
Uploading Inaugural_speeches_benchmark_executed.jsonl...
Evaluation created: cde79124223a48ecb923c7265063197a
Waiting for evaluation cde79124223a48ecb923c7265063197a...
Status: pending
Status: processing
Status: processing
...
Status: processing
Status: ready
Notice the status line marching through pending → processing → ready. That final ready is the signal that scoring is complete.
Copy that evaluation ID — we will use it in the next steps. To keep it handy, run the command again capturing the ID into a shell variable:
EVAL_ID=$(mb eval create "Inaugural speeches CLI eval 2" \
--file Inaugural_speeches_benchmark_executed.jsonl \
--metrics ground_truth_alignment,refusal \
--output json --quiet | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
echo "$EVAL_ID"
Note
If your session has expired since you logged in (the token lasts 24 hours), run mb login again to renew it before continuing.
You will notice this run is quieter — the --quiet flag suppresses the progress lines, and --output json gives us machine-readable output we can pull the ID from. The echo prints just the bare ID, which should look something like:
Step 6: Look at the scores
Let's check the results. Ask for the evaluation by its ID:
The results field of the output should look something like:
{
"ground_truth_alignment": {
"confidence_interval": [
0.5244326316839827,
0.7585091164438398
],
"mean_score": 0.6414708740639112,
"n_errors": 1,
"n_ineligible": 0,
"n_scored": 49,
"n_total": 50
},
"refusal": {
"confidence_interval": [
0,
0
],
"mean_score": 0,
"n_errors": 0,
"n_ineligible": 0,
"n_scored": 50,
"n_total": 50
}
}
Notice the two numbers that matter most:
ground_truth_alignmentmean score is~0.641— on average, the agent's responses were a fairly good match for the reference answers (scores run from0.0to1.0).refusalmean score is0.000— the agent never refused a request it was expected to answer.
Remember that for ground_truth_alignment higher is better, while for refusal lower is better. Our agent did well on both.
Step 7: Download the detailed results
The summary is useful, but the full results — including a score and explanation for every individual case — live in a downloadable file. Let's get it:
The output should look something like:
Let's check what's inside. Look at the scores for the first case:
head -n 1 results.json | python3 -c 'import json,sys; print(json.dumps(json.loads(sys.stdin.readline())["assessments"], indent=2, ensure_ascii=False))'
You will notice each case now carries an assessments object, with one entry per metric, which should look something like:
[
{
"name": "ground_truth_alignment",
"value": 0.7058823529411765,
"error": null,
"ineligible": null,
"source": {
"source_type": "JUDGE_LLM",
"source_id": null
},
"rationale": "The agent correctly identified both the telegraph and steam as the two methods. The response is accurate and directly answers the question, with only minor formatting differences from the reference.",
"fragments": null
},
{
"name": "refusal",
"value": 0.0,
"error": null,
"ineligible": null,
"source": {
"source_type": "JUDGE_LLM",
"source_id": null
},
"rationale": "The agent provided a substantive answer without refusing.",
"fragments": null
}
]
Notice that every score may come with an rationale telling you why it was assigned. This is where you go to understand individual successes and failures, not just the averages. If rationale is null, no explanation was recorded for that score.
Conclusion
You have evaluated an agent end to end from the command line interface (CLI). Starting from a file of agent answers, you logged in, chose your metrics, submitted the file for scoring, read the summary scores, and downloaded a detailed results.json with a score and explanation for every case — all without leaving your terminal.
This same sequence — mb eval create → mb eval get → mb eval download — is exactly what you would drop into a CI pipeline to score your agent automatically on every change.
Next steps
- Score your own agent's answers by pointing
--fileat your own executed benchmark. To produce one, see Evaluate your agent via the web UI, which walks through running an agent and collecting its responses. - Learn what each metric measures and how to read confidence intervals in Metrics.
- Automate the whole flow — corpus, benchmark, and evaluation — with the CI pipeline example.
- Explore every
mb evalflag in the CLI Guide: Evaluation.