PR Eval Gate

Gate pull requests on evaluation regressions — set up with AI, a deterministic PR, or by hand.

The PR Eval Gate runs your LLM app over a pinned dataset on every pull request, scores the outputs with a metric collection, and posts a GitHub check-run that passes, fails, or is neutral depending on whether your metric scores regressed against your base branch (within your configured tolerance).

It needs two things in your repository:

  1. .github/workflows/confident-eval-gate.yml — a workflow that sets up your app (Python + dependencies) and runs Confident’s published runner Action.
  2. confident_eval.py — a run(input) function that calls your app and returns its output as a string. Confident calls this once per golden in your dataset.

The GitHub App is required either way — it posts the check-run on every pull request. The setup options below differ only in how those two files get added to your repo.

Configure the gate

1

Connect GitHub and configure

Go to Settings → Integrations → PR Eval Gate, install the Confident GitHub App on your repository, then choose the repository, dataset, metric collection, and regression tolerance (the maximum average score drop per metric before the gate fails). Click Save.

2

Open the setup pull request

Click Open setup pull request and pick a setup method (below). Saving only stores your configuration; this step is what wires the two files into your repo.

Setup methods

AI-assisted

An agent reads your repository to tailor confident_eval.py and the workflow to your app, then opens the setup pull request. Fastest.

Manual (deterministic)

Confident opens a pull request with template files — no AI reads your code. You fill in run() and adjust the workflow before merging.

Fully manual

Add the two files yourself. Confident never opens a PR for you — the App only posts check-runs. Follow the steps below.

Set it up yourself

If you’d rather Confident never open a PR for you, add both files by hand. This is the most locked-down option; you also add the API key secret yourself.

1

Add the CI workflow

Create .github/workflows/confident-eval-gate.yml. Set up your app’s runtime (Python + dependencies) in earlier steps, then invoke the runner Action — keep the final Confident PR Eval Gate step’s uses: ref and its four with: inputs.

.github/workflows/confident-eval-gate.yml
1name: Confident PR Eval Gate
2
3on:
4 pull_request:
5 push:
6 branches: ["<your-default-branch>"]
7
8permissions:
9 contents: read
10
11jobs:
12 eval-gate:
13 runs-on: ubuntu-latest
14 env:
15 # Any runtime secrets your app needs to run, referencing repo secrets, e.g.:
16 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
17 steps:
18 - uses: actions/checkout@v4
19 - uses: actions/setup-python@v5
20 with:
21 python-version: "3.12" # match the version your app targets
22 - name: Install dependencies
23 run: pip install -r requirements.txt # match your project (poetry/uv/etc.)
24 - name: Confident PR Eval Gate
25 uses: confident-ai/deepeval-tracer/actions/eval-gate@v1
26 with:
27 base_url: "<your-region-api-base-url>"
28 dataset_alias: "<your-dataset-alias>"
29 dataset_version: "latest"
30 confident_api_key: ${{ secrets.CONFIDENT_API_KEY }}

base_url is region-specific: use https://api.confident-ai.com for US and https://eu.api.confident-ai.com for EU. Set dataset_alias (and optionally dataset_version) to the dataset you configured the gate against.

2

Add the eval callback

Create confident_eval.py at the repository root. run(input) receives one dataset input, calls your app, and returns its output — Confident runs it for every golden in your dataset and scores the results.

confident_eval.py
1def run(input):
2 """Return your LLM app's output for a single dataset input."""
3 from my_app import agent # import your application
4
5 return agent(input) # return the output as a string
3

Add the repository secrets

Create a project API key in Settings → API Keys, then add it as a repository secret named CONFIDENT_API_KEY (Settings → Secrets and variables → Actions in GitHub). Add any runtime secrets your app needs (for example OPENAI_API_KEY) the same way.

Once the workflow and confident_eval.py are on your default branch, every future pull request runs the gate and posts the Confident PR Eval Gate check-run with the score comparison against your base branch.

Troubleshooting

Most misconfigurations fail loudly — the runner reports the reason on the Confident PR Eval Gate check-run and in the workflow’s Actions logs. A few fail silently; those are called out below.

SymptomLikely causeFix
Gate never runs on a PR (silent)The on: triggers were changed, or the workflow was moved out of .github/workflows/Keep the pull_request trigger and leave the file in .github/workflows/
Scores look meaningless — everything compared against “None” (silent)run() returned None or a non-string valueReturn your app’s output as a string from run()
could not import confident_eval.runconfident_eval.py isn’t at the repo root, or the function isn’t named runKeep the file at the repository root and the function named run
app raised while producing outputsrun() doesn’t take a single input argument, or an app runtime secret is missingMatch the run(input) signature; add your app’s secrets (e.g. OPENAI_API_KEY) to the workflow env:
could not pull datasetCONFIDENT_API_KEY is missing/rotated/revoked, or the dataset alias, version, or base_url is wrongRe-add the secret and verify the dataset alias, version, and region base_url
No check appears at all (silent)The GitHub App was uninstalled, Actions is disabled, or the install step failed before the runner ranReinstall the App / enable Actions, and check the workflow logs for an install failure
Errors on some or all rowsThe dataset contains multi-turn goldensv1 supports single-turn datasets — point the gate at a single-turn dataset