# Evals

Check every week that your team's most important numbers still come out right, however people phrase the question

Source: https://contextflo.com/docs/evals

Evals check every week that the questions your team asks most still get the right answer. Each eval case is one common question with a trusted answer. Contextflo asks it the way your team actually phrases it and flags any answer that no longer matches.

Evals are on every plan. For why we check answers this way, and how it compares with other approaches, read [How to make sure AI agents get data answers right](https://contextflo.com/blog/ai-agent-evals).

## What is an eval case?

Each case has three parts:

- **A trusted query.** The SQL that gives the right answer, usually taken from a metric or saved query. Contextflo keeps a frozen copy, so a later edit to the metric can't quietly change what counts as right.
- **2 to 4 phrasings.** The ways people on your team ask the question, for example "What was revenue last month?" and "How much did we make in October?"
- **A time period.** Like last full month or last full week. Each run fills in the dates, so the case never goes stale.

On each run, Contextflo's agent asks every phrasing on its own, the way a teammate would, and checks the answers against the trusted one and against each other.

![Eval Sets page showing a passed case: the trusted answer for paid ad spend, conversions and CPA by channel, and three phrasings that all matched it](https://assets.contextflo.com/features/eval-sets/eval-sets-page-passed.png)

## How do I set one up?

1. **Ask your agent to create a case.** For example: "Add our net revenue metric to the eval set for last full month, with three ways people on the team would ask it." It drafts the trusted query and phrasings and runs the query once to record the baseline.
2. **Review it.** Check the trusted answer and the phrasings. A draft isn't checked until you approve it.
3. **Approve it.** Ask your agent to approve the case. From then on it runs every week.
4. **Run it any time.** Open **Eval Sets** (under Admin) and click **Run now**, or ask your agent to run it.

Creating and approving cases is admin-only, so what counts as a right answer stays with the people who own the definitions.

## How a weekly run works

Every week, each approved case runs once:

1. **Dates are filled in.** The case's period (say, last full month) becomes real dates, and the same dates go into the trusted query and into every phrasing. The window always ends before today, because today's data is still arriving.
2. **The trusted query runs** on this week's data. That result is the right answer for this run. If the query errors or its result no longer has the same columns, the run stops at **Trusted query failed** and the phrasings aren't asked.
3. **Each phrasing is asked** of the agent as an ordinary team member, so your access rules apply as they would for anyone on the team.
4. **A judge compares the answers** with the trusted answer and with each other, using the tolerance set on the case. The judge is an AI model rather than an exact number match, because many answers are names or rankings rather than one number.

The run also notes when the metric or saved query a case came from has changed since the case was created. The case keeps checking against its frozen copy until you update it, so you decide whether the new definition is the right one.

## Reading the results

**Eval Sets** lists every case with its latest result. Open a case to see the trusted answer, each phrasing's answer, and the agent's steps for each one.

| Status               | What it means                                                                         | What to do                                            |
| -------------------- | ------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| Passed               | Every phrasing matched the trusted answer.                                            | Nothing.                                              |
| Drifted              | At least one phrasing came back with a different answer.                              | Open it and read the agent's steps for that phrasing. |
| Trusted query failed | The trusted query errored or its result changed shape, often because a table changed. | Fix or update the trusted query, then run it again.   |
| Error                | A phrasing couldn't be checked this run.                                              | Run it again. If it repeats, check the agent's steps. |

A drifted answer usually points to missing context: a column the agent misread, or a definition it didn't use. Fix the table description or metric, then click **Run now** to confirm.

## What makes a good case

- **Start with the questions asked most.** Your top 10, or one per metric leadership looks at every week.
- **Anchor to something you already trust.** An approved saved query or metric beats SQL written just for the eval.
- **Write phrasings the way people actually ask.** Mix casual and precise wording, and include the shorthand your team uses ("rev", "last month", "in Q3").
- **Pick a period that has finished.** Last full week or last full month, so the answer can't move while the run is in progress.
- **Set a tolerance that fits the answer.** Zero for counts and names, a small percentage where rounding or late-arriving rows can shift the number.
