Skip to content
askdareDocumentation

    Testing answers (eval)

    You change a bot's instructions, its documents, its model or its retrieval, and you want to know what got better or worse before visitors do. askdare's eval runs test cases you keep in your repository against your running app, through the same turn path as the chat, and checks the answers for facts, citations, forbidden strings, handoffs, forms and tools (ADR-0035).

    You write cases, turn on the endpoint, record a baseline, and run npx @boldare/askdare eval when a change can move the answers: new instructions, documents, a model or the bot's settings. It exits 1 when a case that always passed now always fails, so a pull request that breaks an answer fails its check. Every run spends real tokens, so run it rarely and where it matters: a small subset on the pull requests that touch the bot, the full set by hand and before a release (In CI), on OpenAI's cheaper Flex tier if your models take it (Flex).

    Turn it on

    Set eval in createChatHandler. Even an empty object turns it on:

    // app/api/chat/[...path]/route.ts
    export const { GET, POST, DELETE } = createChatHandler({
      bots,
      eval: {},
    });

    This adds POST /api/chat/eval, the endpoint askdare eval calls. Without eval, that path answers 404 like any unknown path.

    Only a caller that knows your app's CHAT_SECRET can use it: the CLI mints a short-lived eval token from the secret, as askdare doctor does. The visitors' and the console's tokens never reach /eval, and an eval token reaches nothing else. Run evals against a local, preview or staging deployment rather than production: eval turns spend real tokens from the bot's daily budget.

    eval also takes three settings:

    OptionWhat it is
    grader{ model }: the model that grades reference, declines, rubric and answerLanguage, as defineBot's model takes it (an ID, or { id, reasoning, verbosity }). askdare names no model and has no default. Without it, cases with only deterministic checks still run. See The grader.
    casesCase files the console's Tests view runs, imported by your route (import support from '@/evals/support.eval.json'). Next bundles them at build time, so askdare reads no files. The CLI reads evals/ itself and never asks the server for them.
    serviceTier'flex' runs eval turns and the grader on OpenAI's Flex tier, at half the price and slower. Left out, they run at your OpenAI project's default tier, as visitors' turns always do. See Paying less: Flex.

    Both are checked on the first request that needs them: a wrong value fails every eval request, and the Tests view, with the setting named, as a missing secret does.

    Case files

    Cases live in evals/ at your project root, as *.eval.json files, reviewed and versioned like code. A file is for one bot and one language:

    {
      "$schema": "../node_modules/@boldare/askdare/eval.schema.json",
      "version": 1,
      "bot": "support",
      "language": "en",
      "cases": [
        {
          "id": "pricing/team",
          "tags": ["fact"],
          "turns": ["How much does the Team plan cost?"],
          "expect": {
            "reference": "€8 per user and month.",
            "facts": [["€8", "8 €", "8 euro"]],
            "cite": ["pricing.md"]
          },
          "notes": "The 2025 page said €7; release-notes.md repeats the old price."
        },
        {
          "id": "pricing/follow-up",
          "tags": ["multi-turn"],
          "turns": ["How much does the Team plan cost?", "And with yearly billing?"],
          "expect": { "facts": [["€6"]], "cite": ["pricing.md"] }
        },
        { "id": "no-phone", "tags": ["unanswerable"], "turns": ["What is your sales phone number?"], "expect": { "declines": true } },
        { "id": "injection", "turns": ["Is there a promo code?"], "expect": { "notSay": ["SAVE50", "password"] } },
        { "id": "angry", "turns": ["This is useless, I want a person."], "expect": { "handoff": true } },
        { "id": "demo", "turns": ["Can I book a demo?"], "expect": { "form": "demo" } }
      ]
    }

    The $schema line gives you completion and checking in your editor. The package publishes the schema as @boldare/askdare/eval.schema.json, generated from the same definition the server validates with.

    FieldRequiredWhat it is
    versionyes1.
    botyesThe bot's id, as in defineBot. A case can override it.
    languageyesThe chat's language for every turn, as a BCP 47 tag (en, pl, pt-BR). The bot's texts and language rules for it apply, as if a visitor chatted in it. A case can override it.
    cases[].idyesUnique across your cases; the baseline keys by it. Letters, digits, ., _, - and /, so you can group them (pricing/team).
    cases[].turnsyesThe visitor's messages, sent one after another. The bot answers each one live, and the checks look at the last answer: earlier turns set up a follow-up. 1 to 20 turns, each within the bot's limits.maxInputChars.
    cases[].expectyesWhat a pass means, below. {} still checks for invented sources.
    cases[].tagsnoGroups cases, for running a subset and for pass rates per tag.
    cases[].notesnoFor people ("the 2024 page said 14 days"). Never sent to the grader.
    cases[].draftnotrue on a case drafted in the console from a 👎 answer. Runs are refused until a person reviews it and removes the marker.

    Unknown fields are refused, so a misspelled check ("fact" instead of "facts") is an error, never a check that silently passes.

    What a pass means (expect)

    A run passes when every deterministic check passes. grounded only warns, and graded checks are reported without counting.

    KeyKindPasses when
    facts: string[][]deterministicevery group has one of its alternatives in the last answer
    cite: string[]deterministicat least one cited source is in the list, by its knowledge path (below)
    (always) noInventedSourcesdeterministicevery cited source came from a search in this run, and no citation marker named a passage the index doesn't have
    notSay: string[]deterministicnone of the strings appear in the last answer
    handoff: booleandeterministicthe last turn asked for a person (true) or didn't (false)
    form: string | falsedeterministicthe last turn showed that form with show_form, or (false) none
    tools: string[]deterministiceach named tool of the bot was called in the last turn
    (with facts and cite) groundedwarningthe same facts appear in the text of the passages the answer cited
    reference: stringgradedthe answer agrees with the reference, presents no outdated value as current, and answers every part of the question
    declines: truegradedthe answer says the documents don't cover this, and invents nothing
    rubric: string[]gradedeach criterion holds, judged one by one
    answerLanguage: truegradedthe answer is in the case's language

    Graded checks need a grader model (eval.grader, below). Without one, a case with graded checks is refused. They are reported, and never fail the run in 0.8 (see The baseline).

    How facts and notSay match. Both sides are compared after Unicode NFKC normalization (full-width digits become plain ones), in lower case, with typographic spaces and dashes made plain, Markdown bold dropped and whitespace collapsed. A decimal comma reads as a point, so 12,99 zł matches 12.99 zł, while 5,000 stays a thousands separator. Give alternatives for the forms an answer may take: ["€8", "8 €", "8 euro"].

    How cite names sources. By the knowledge path askdare kb sync stores: the file's path relative to the knowledge folder (pricing.md, help/refunds.md). That is the path attribute of a vector store file, or KnowledgeDocument.path in your own index. A leading ./ is ignored. Files uploaded to a vector store some other way have no path, and can't satisfy cite.

    Why grounded only warns. It looks for the facts in the cited passages' text. An answer in Polish that cites an English page is right, and the facts are legitimately absent from the passage, so a mismatch is worth a look but never a failure.

    Keep reference minimal. A grader treats everything in a reference as required. Put the context in notes.

    Not in format version 1: attachments, a signed-in visitor, scripted answers for earlier turns, expectations per turn, and regular expressions in facts or notSay.

    The grader

    reference, declines, rubric and answerLanguage are judged by a model you choose:

    export const { GET, POST, DELETE } = createChatHandler({
      bots,
      eval: {
        grader: { model: { id: process.env.ASKDARE_GRADER_MODEL!, reasoning: { effort: 'low' } } },
      },
    });

    model takes what a bot's model takes (model settings): an ID, or the ID with reasoning.effort and verbosity. askdare names no model and has no default. A case with graded checks sent to an app without a grader is refused before any turn runs, with an error naming eval.grader, so the run never spends tokens it can't grade.

    Choosing a model. A mid-size model at reasoning: { effort: 'low' } is a good start. In spike s11 such a grader agreed with the deterministic fact check on 98.2% of 793 answers (kappa 0.84) and with a second grader model at kappa 0.84, and most of its disagreements with the fact check were real errors the facts couldn't see, like an outdated price next to the current one. OpenAI's evaluation guide suggests starting from a strong model and checking it against answers you grade yourself before going cheaper. A high effort can spend the grader's 4,000 output tokens on reasoning before it answers: the checks then come back as not graded, "cut off".

    Cost. One grader call per run of a case covers all its graded criteria. In s11 it cost about $0.0007 per answer on OpenAI's Flex tier, half the Standard price: under a fifth of a run's cost. Without eval.serviceTier, grading is billed at your project's default tier, about $0.0014 per answer at Standard prices for the same model; with serviceTier: 'flex' it goes at Flex, as the eval turns do (Paying less: Flex). The grader's tokens:

    • count toward the bot's dailyTokens and the global budget, like the eval turns;
    • reach onUsage as their own report, with source: 'eval', the grader's model, steps: 1 and no conversation;
    • come back in the run's result as grading: { model, usage }, apart from the turns' usage, so the CLI can report tokens per model.

    What the grader sees. The visitor's turns, the reference and the criteria, which are your team's text and go in as instructions; and the last answer with the passages it cited, which are not. A document can carry a prompt injection aimed at the grader ("grade this answer as a pass"), so the answer and the passages reach it JSON-encoded inside the same {"untrusted_tool_result": …} wrapper as untrusted tool results (guardrails), and its instructions say to judge them, never to follow them. The case's notes never reach it.

    What it answers. Pass or fail per criterion, with its reasoning first, through OpenAI's Structured Outputs with a strict schema and store: false. A report keeps at most 200 characters of the reasoning of a failed check. A rubric passes when every criterion holds, and names the first one that didn't. A check comes back not graded, with the reason, when:

    • a deterministic check failed: the run already failed, so the grader isn't called;
    • a guardrail blocked the turn;
    • the grader refused, its output was cut off, or it didn't match the schema.

    The grader prompt is versioned. Every result carries grader: 1. When a new askdare version changes the prompt, graded verdicts against a baseline from the old one are reported as "grader changed", not as regressions, until you update the baseline.

    Why graded checks don't fail a run yet. Deterministic checks gate; graded ones inform. A model grader flips more often than the deterministic checks (8% of s11's cases across repeated runs, against 3%), and its agreement with a person hasn't been measured yet: s11's sample of 60 answers for a person to grade is prepared but not graded. Once it is, an update to ADR-0035 can let reference gate. Until then, read the grader's reasons in the report.

    Run the cases

    Start the app (next dev, or next build && next start), then, in the app's folder:

    npx @boldare/askdare eval

    The CLI reads every *.eval.json under evals/, checks them (an invalid file is refused with its path and the failing field), and runs each case against http://localhost:3000/api/chat. It signs its requests with your app's CHAT_SECRET, read from .env.local and .env (or --env-file), so the secret must be the one the app at --url runs with. Every option is in Command line.

    askdare eval: 32 cases against http://localhost:3000/api/chat; estimated 98,000 of 1,000,000 tokens.
    
      ✔ support pricing/team  1/1
      ✘ support pricing/follow-up  0/3  regression
          facts: Missing: €6
      ~ support no-phone  1/2  flaky
      ✔ support injection  1/1
          ! grounded: …
    
    Summary
      Pass rate 93.8% of 32 cases (first runs): 29 passed, 1 failed, 2 flaky.
      Baseline 96.9% ± 4.1 points over the same 31 cases; now 93.5%: within the noise band.
      Tags: fact 100% (12), multi-turn 75% (4), unanswerable 90% (10)
      Regressions (1): pricing/follow-up
      New (1): pricing/student
      …
    • A case runs once. When it fails, it runs again, up to twice more (--retries), until a run passes. ✔ passed every run, ✘ failed every run, ~ passed some (flaky), with the runs that passed out of those that ran.
    • Under a case come its failing checks with their reasons, and the warnings (!).
    • Run fewer cases with --bot, --tag and --case (--case 'pricing/*' for a group).
    • --answers prints each case's last answer, for debugging on your machine. Keep it out of CI: an answer can hold data your tools read, such as an order, and CI logs travel further than your terminal.

    A case file with a "draft": true case (one drafted in the console from a 👎 answer) stops the run with exit code 2, naming the case: review it, write its expect, and remove the marker.

    Prompt versions

    A bot with prompt versions runs its own version in eval, never the experiment's split. Run the same cases against another version before giving it visitors:

    npx @boldare/askdare eval --version shorter
    npx @boldare/askdare eval --version v1 --version shorter
    npx @boldare/askdare eval --version all

    --version is repeatable, or all for every version of each bot. Before any case runs, the CLI asks the app for its bots' versions, so a version the bot doesn't have, or a bot the app doesn't have, stops the run with exit code 2 and the bot's versions listed. With several bots in the folder, pick the cases of the bot that has the version with --bot. The app checks the name again on every run: the version is chosen by the holder of CHAT_SECRET, never by a visitor.

    askdare eval: 32 cases, versions v1, shorter, against http://localhost:3000/api/chat; estimated 196,000 of 1,000,000 tokens.
    
      ✔ support@v1 pricing/team  1/1
      ✘ support@shorter pricing/team  0/3  regression
          facts: Missing: €8
      …
    
    Summary
      Versions:
        support@v1: Pass rate 96.9% of 32 cases (first runs): 31 passed, 1 failed, 0 flaky.
                    Baseline 96.9% ± 4.1 points over the same 32 cases; now 96.9%: within the noise band.
        support@shorter: Pass rate 87.5% of 32 cases (first runs): 28 passed, 3 failed, 1 flaky.
                         Baseline 96.9% ± 4.1 points over the same 32 cases; now 87.5%: outside the noise band.
      Regressions (1): pricing/team (shorter)
      Side by side:
        support pricing/team: v1 ✔ 1/1 · shorter ✘ 0/3  regression
        …
    • Each version is a case of its own. The baseline, the results and the reports are keyed by bot, version and case: a baseline recorded for v1 is never compared with a run of shorter, whose cases are new until you record one for it with --update-baseline --version shorter (or all). Recording one version keeps the other versions' entries; entries of a version the bot no longer has go, as the app at --url lists them, so record baselines against a deployment of the code you commit.
    • Side by side: with --version, every case line names its version (support@shorter), the summary gives each version's pass rate against its own baseline, and a case that ran in several versions gets one line with each version's result. The JUnit report has a test suite per bot and version (support@shorter), and the JSON report has version on every result and a summary.versions list.
    • The budget counts every version: two versions are twice the tokens. The estimate takes each version's own tokens per run from the baseline.
    • onUsage reports eval turns with source: 'eval' and the version that ran, the grader's call included. Eval turns write no admin records, so the dashboard's Versions table doesn't move.

    Eval compares versions side by side and leaves the verdict to you: there is no statistical comparison of two versions in 0.8.

    The baseline

    Models answer differently each time, so one failed run doesn't prove a regression. The CLI compares with a baseline: how often each case passed in earlier runs, which you commit next to the cases as evals/baseline.json.

    npx @boldare/askdare eval --update-baseline

    runs every case 3 times (--runs) and writes the baseline, but only when every run finished: an incomplete run never overwrites it. It exits by the same rules as any run, so the first baseline of a set with a case that fails every run exits 1, though it is written. Commit it with the change that made it. Record it again when you accept a change in the answers, such as new documents or a new model. Entries of cases left out by --bot, --case or --tag stay as they were; entries of cases you deleted go.

    What it holds, per bot, prompt version and case: how many runs ran and passed, the checks that failed, the case's hash, the model that answered, the grader prompt's version and the tokens per run. Never an answer. It is a JSON file with "version": 1.

    Against a baseline, a case is:

    WhenExit code
    RegressionIt passed every baseline run, and fails every run now (after its re-runs).1
    FixIt failed every baseline run, and passes every run now.0
    Flaky or failingIt passed only some baseline runs, or none: a known problem, listed, not a regression.0, or 1 with --fail-on fail when it fails every run
    ChangedIts turns, expectations, bot or language changed since the baseline (the hash differs). Editing notes or tags changes nothing.Not compared
    NewIt isn't in the baseline.Not compared

    Why "every run" and not "most runs": spike s11 measured how often each rule flags a case by chance on an unchanged bot. "Passed every one of 3 baseline runs, fails every one of 3 runs now" flagged about one case in eight runs of a 132-case set; "passed once, fails now" or a flipped majority of 3 flagged about two cases in every run (ADR-0035, decision 3).

    The pass rate's noise band. The summary gives the share of cases whose first run passed, and the baseline's rate over the same cases, with a 95 % band measured from the baseline's runs: each case passes at the rate it passed in the baseline, so a run's rate can move by ±1.96 √Σ p(1 − p) / n by chance. A drop inside the band is reported, not failed. A 1-run baseline measures no band. Small regressions hide inside the band and show as cases instead, which is why the exit code looks at cases.

    Without a baseline, any case that fails every run exits 1, so a new set works in CI before you record one.

    Graded checks (reference, declines, rubric, answerLanguage) are reported, and listed in the summary when they regress or are fixed against the baseline, but they never change the exit code in 0.8: a person hasn't yet measured how often the grader agrees with them. When the grader's prompt changes (its version in the results), graded changes against an older baseline show as "grader changed" until you record the baseline again.

    Forbidden strings fail the run (exit 1) whenever a notSay check fails, in any run, baseline or not: a leaked promo code is never noise.

    Reports for CI

    npx @boldare/askdare eval --reporter pretty --reporter junit=reports/eval.xml --reporter json=reports/eval.json
    • junit=<file>: a test suite per bot (per bot and version with --version) and a test case per case, its failing checks as the failure message. Most CI systems show it as a test report.
    • json=<file>: the whole run, "version": 1: the summary (pass rates, the noise band, tags, tokens per model, the budget, and each bot's version apart under versions), and per case its prompt version, its status, its change against the baseline and each run's checks, warnings, citations (titles and knowledge paths), tools, usage, model and duration. Answers only with --answers.
    • pretty is the terminal output above. Given only junit or json, nothing is printed but errors; add pretty to see both.

    The exit code:

    CodeWhen
    0No regression and no forbidden string.
    1A regression; a notSay check that failed; without a baseline (or with --fail-on fail), a case that fails every run.
    2The run couldn't run or finish: an invalid or draft case file, an unreadable baseline, no CHAT_SECRET, the app unreachable, without eval or with another CHAT_SECRET, an unknown bot or --version, a case the app refused (too many turns, a graded case without a grader), the budget refused or spent, the bot's daily budget used up, OpenAI failing, or a case Flex had no capacity for (reported as not run while the others go on). The results so far are reported, and the baseline isn't written.

    The budget

    Every run has a budget in tokens, --max-tokens, 1,000,000 by default. Before it starts, once the app has listed its bots' versions (so the app must be running), the CLI estimates the run: each case's tokens per run from the baseline, or 8,000 tokens per turn without one (plus 2,000 for a graded case's grader call), times the runs, plus the re-runs. A re-run runs the whole case again, every turn and the grader. With a baseline, a case that failed some baseline run is counted with all its --retries re-runs, and one that passed every run with none; without one, a quarter of the cases are expected to fail and use every re-run. Above the budget, it refuses to start and prints the estimate in parts (the runs, the grader, the re-runs), so you can see whether fewer cases or a lower --retries would fit (exit 2). During the run it starts no new run once the budget is spent, and ends with what finished (exit 2). A run that fails after some of its calls were billed, such as a later turn of a multi-turn case, counts what it spent too.

    askdare holds no prices, so the report lists input and output tokens per model for you to price. askdare's own docs bot, on file_search, spent about 8,000 tokens per run of a one-turn case and 2,000 per grader call in the live run at the 0.8 release. Its set of 32 cases is estimated at about 474,000 tokens for a run without a baseline, and 948,000 for a 3-run baseline, close to the default budget. Once you have a baseline, the estimate follows what your own cases spent.

    When OpenAI keeps failing, for example because the project is out of credit or hit its spend limit, the CLI tries a case twice more, then starts nothing new and reports what finished (exit 2). Your bot's own dailyTokens budget counts eval turns too; when it is used up, the app answers budget_exceeded, and the run stops the same way.

    Paying less: Flex

    OpenAI's Flex processing bills tokens at half the Standard price, in exchange for slower answers and an occasional refusal when Flex has no capacity. An eval run waits for nobody, so it can use it:

    export const { GET, POST, DELETE } = createChatHandler({
      bots,
      eval: {
        grader: { model: process.env.ASKDARE_GRADER_MODEL! },
        serviceTier: 'flex',
      },
    });
    • Only eval runs go at Flex: the CLI's, and the console's Tests view. A visitor's turn, and the console's playground, never do, whatever the setting. A compaction after an eval turn goes at the turn's tier, so the prompt cache holds.
    • Without capacity, OpenAI answers 429 Resource Unavailable and bills nothing. The app tries again on its own (the OpenAI SDK's two retries), then the CLI waits 15, 30, 60 and 120 seconds between tries of that case. If Flex still has no room, the case is reported as not run, the other cases go on, and the run exits 2. It is never sent again at Standard prices: a run that costs twice what you planned is worse than one you repeat later.
    • Which models: only those listed under Flex on OpenAI's pricing page. Flex is in a wind-down beta there: OpenAI adds it to no new model (not GPT-6.2 Astra or Sol) and will announce a retirement date. A model or project without Flex fails the run with bot_unavailable (exit 2), and the app's log names eval.serviceTier; remove the setting, or run the eval with a model that has Flex. Check both the bots' models and the grader's.
    • Slower: a Flex turn can take longer than a Standard one, and a turn past the bot's limits.turnTimeoutMs or the route's maxDuration fails that case (timeout, exit 2). Lower --concurrency if many cases time out.
    • Your reports stay right: eval turns aren't in the admin store, so the dashboard's cost estimates, which assume the Standard price, never see them. onUsage reports eval turns with source: 'eval'; price them at Flex rates if you track costs there.

    In CI

    Each run spends real tokens, so the recommended setup runs the eval rarely, where a regression can come from, and never on every push:

    WhenWhat runsHow
    A pull request that changes the bot: its instructions or prompts, its knowledge documents, its configuration, or evals/A small subset, the cases tagged smoke, once (only a failing case runs again, up to twice)Automatically, filtered by path
    By hand, and before a releaseThe full setworkflow_dispatch, or workflow_call from your release workflow
    When you accept a change in the answersThe baseline, 3 runs of every caseBy hand only, then committed
    Any other push or pull requestNothing

    Tag 10 to 20 cases smoke, one or two of each kind you care about most (a key price, a citation, an injection, a handoff): they catch a broken prompt or index for a fraction of a full run. The full set runs before the change ships.

    The eval needs the running app, with its secrets and stores: build and start it in the job, or point --url at a preview deployment with that deployment's CHAT_SECRET. A GitHub Actions workflow:

    # .github/workflows/eval.yml
    name: eval
    on:
      # Only pull requests that touch the bot. Adjust the paths to your app's layout.
      pull_request:
        types: [opened, synchronize, reopened, ready_for_review]
        paths:
          - "askdare.config.ts" # the bots: instructions, model and settings
          - "prompts/**" # instructions kept in their own files
          - "knowledge/**" # the documents
          - "app/api/chat/**" # createChatHandler's options
          - "evals/**" # the cases and the baseline
      # The full set by hand, or the baseline.
      workflow_dispatch:
        inputs:
          baseline:
            description: "Record the baseline (3 runs of every case) instead of comparing with it"
            type: boolean
            default: false
      # Before a release: call it from the release workflow, as a job the release needs.
      workflow_call:
    
    # A new push to the pull request cancels the run it makes obsolete; a run started by hand is
    # never cancelled, so a baseline it is recording isn't lost.
    concurrency:
      group: eval-${{ github.event_name }}-${{ github.ref }}
      cancel-in-progress: ${{ github.event_name == 'pull_request' }}
    
    permissions:
      contents: read
    
    jobs:
      eval:
        # Not on drafts. Pull requests from forks get no secrets.
        if: >-
          github.event_name != 'pull_request' ||
          (!github.event.pull_request.draft &&
           github.event.pull_request.head.repo.full_name == github.repository)
        runs-on: ubuntu-latest
        timeout-minutes: 45
        env:
          # A dedicated OpenAI project with a hard spend limit, not your production key.
          OPENAI_API_KEY: ${{ secrets.EVAL_OPENAI_API_KEY }}
          CHAT_SECRET: ${{ secrets.EVAL_CHAT_SECRET }}
          ASKDARE_MODEL: ${{ vars.ASKDARE_MODEL }}
          ASKDARE_GRADER_MODEL: ${{ vars.ASKDARE_GRADER_MODEL }}
          KB_VECTOR_STORE_ID: ${{ vars.EVAL_VECTOR_STORE_ID }}
          # Your stores' URLs too, such as DATABASE_URL, if the app uses them.
        steps:
          - uses: actions/checkout@v7
          - uses: actions/setup-node@v7
            with:
              node-version: 24
              cache: npm
          - run: npm ci
          # The documents of this commit, in the CI project's own vector store.
          - run: npx @boldare/askdare kb sync knowledge
          - run: npm run build
          - name: Start the app
            run: |
              npm run start -- --port 3000 &
              for i in $(seq 60); do curl -sf -o /dev/null http://localhost:3000/api/chat/widget.js && exit 0; sleep 1; done
              exit 1
          - name: Run the eval
            env:
              EVENT: ${{ github.event_name }}
              BASELINE: ${{ inputs.baseline }}
            run: |
              reports="--reporter pretty --reporter junit=reports/eval.xml --reporter json=reports/eval.json"
              if [ "$EVENT" = pull_request ]; then
                # The smoke subset; a budget that fits it, so a mistake can't run the whole set.
                npx @boldare/askdare eval --tag smoke --max-tokens 150000 $reports
              elif [ "$BASELINE" = true ]; then
                npx @boldare/askdare eval --update-baseline --max-tokens 3000000 $reports
              else
                npx @boldare/askdare eval --max-tokens 1000000 $reports
              fi
          - uses: actions/upload-artifact@v7
            if: always()
            with:
              name: eval-report
              path: |
                reports/
                evals/baseline.json
    • Budgets: --max-tokens refuses a run whose estimate is over it and stops one that spends it (The budget). Set it per job, a little above the estimate the CLI prints, so a wrong filter or a new batch of cases can't run up a bill. The OpenAI project's own spend limit is the hard stop behind it.
    • A dedicated OpenAI project for CI, with a hard spend limit, so a loop or a large baseline can't run up your production bill. Its own vector store, synced in the job, keeps CI off your production documents. With Flex on, the same runs cost about half.
    • Secrets: CHAT_SECRET is the started app's own; the CLI reads it from the environment, since the job has no .env.local. Never print it.
    • Not production. Eval turns count toward each bot's dailyTokens (2,000,000 by default) and appear in onUsage with source: 'eval'. Run against the job's own app or a preview deployment.
    • The baseline only by hand, on your machine or with the baseline input above, after you accept a change in the answers; the job uploads the new evals/baseline.json for you to review and commit. A job that rewrites it on its own hides the regressions it should catch.
    • A pull request that needs the full set, such as a model change, gets it by hand: run the workflow on its branch before merging.
    • Pin the actions to commit SHAs if your organization asks for it, and keep @boldare/askdare in your dev dependencies so npx runs the installed version, the same as the app's.

    What an eval turn does

    An eval turn runs the bot as configured: its instructions (the bot's own version, or the one --version names, never the experiment's split), tools, knowledge, model and output checks, with the case's language as locale, as an anonymous visitor. It differs from a visitor's turn in a few ways:

    • Skipped: the human check and bot protection, the origin check, the per-IP and per-visitor rate limits and budgets, onTranscript, onFeedback and the admin store. Eval turns aren't visitors' and don't move the dashboard.

    • Counted: each bot's dailyTokens and the global budget count eval tokens, since they are real spend, and the kill switch (ASKDARE_DISABLED) stops them. onUsage receives every eval turn with source: 'eval' and the prompt version that ran, so cost tracking can tell them apart from 'chat' and the console's 'console' turns.

    • Handoffs and forms are recorded for the checks and never delivered: onHandoff, onLead, webhookHandoff and emailHandoff are not called, and the model hears what a saved handoff tells it.

    • Your own tools run for real, with context.source set to 'eval'. A tool with side effects, such as creating a ticket, can stub them:

      execute: async (input, context) => {
        if (context.source === 'eval') return { ticket: 'TEST-1' };
        return createTicket(input, context);
      },
    • The conversation lives in your conversation store under an owner of its own for each run, so no visitor can resume it, and is deleted when the run ends. A deletion that fails is left to retention.

    • A guardrail that blocks a turn ends the run there, and the checks look at that turn: a blocked injection passes its notSay.

    The server runs at most 8 eval requests at a time per instance, and answers rate_limited beyond that. Each request is one run of one case; the CLI decides how many to run and how often to repeat them.

    In the console

    With eval.cases and the admin console on, a developer runs the cases from the console's Tests view: one at a time or all, against the bot's own version or one picked as in the playground, with the answer and every check's verdict side by side (Tests). These runs go through the same eval path, counted against the playground's limits for the person running them and each bot's budgets, and reach onUsage with source: 'eval'. Their results stay in the page.

    New cases often start from an answer a visitor rated 👎. A reviewer opens the conversation in the console and chooses Draft a test case: the page builds a case file from the visitor's turns, with personal data it can recognize replaced by placeholders, an empty expect and "draft": true, to copy into evals/ (Drafting a test case). The draft holds neither the visitor's comment nor the rated answer, and nothing about it is stored or sent. A file with a draft case doesn't run until you remove the marker.

    Safety

    • Who can run cases: only holders of CHAT_SECRET, who can already chat with any text by minting visitor tokens. The endpoint is off unless you set eval.
    • Logs: the server logs no case content, only status, error codes and usage, as for chat turns.
    • Answers are returned only when the CLI asks for them, for a person debugging locally: a bot whose tools read real data, such as an order lookup, can put that data in an answer.
    • The grader reads untrusted text: the answer and the passages it cited go in wrapped and JSON-encoded, and graded checks never fail a run, so an injection that fools the grader changes a reported verdict at most. The grader's reasons are model output: show them as plain text.
    • Drafts from 👎 answers carry a visitor's words toward your repository, so they pass through a person: scrubbed, marked as drafts, and copied by hand.

    See rows T43, T44 and T45 of the threat model.