> ## Documentation Index
> Fetch the complete documentation index at: https://docs.decimal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Regression Check (GitHub Action)

> See which production traces a change to your agent touches on every PR, and find which version broke a metric after a deploy.

The regression check is a GitHub Action. On each pull request it compares your agent's new setup with the one in production, finds the production traces the change touches, and posts a report as a PR comment.

The setup it compares is a **manifest**: a snapshot of the agent's tools, model, prompts and skills ([Manifests](https://docs.decimal.ai/guides/manifests.md) has the details). The difference between two manifests is the test, and your recorded traffic is the test set. You write no eval cases, and the check makes no model calls.

Every report gives two verdicts:

* **Structural:** did the change touch traffic, and how badly? HIGH, MEDIUM or LOW IMPACT.
* **Eval:** was that traffic working? REGRESSION LIKELY, EXPECTED IMPACT or CLEAN.

The check doesn't run your agent, replace evals or deploy anything. Once a change has shipped, [Find what broke](#find-what-broke) shows how each version really performed.

## See a sample report

You can see the report before you instrument anything.

**Seed a demo into your workspace.** It needs no agent code or model key:

```bash theme={null}
pip install decimalai
export DECIMAL_API_KEY="dai_sk_..."
decimalai demo regression
```

This seeds a demo support agent with two manifest versions and 120 traces, runs the check, and prints a link to the impact report. The change between the versions bumps the model version, renames and removes a tool, and rewrites the prompt. Everything it creates is prefixed `[Demo] `, and `decimalai demo reset` removes it.

![Impact report for the seeded demo agent: summary cards above a HIGH IMPACT / REGRESSION LIKELY verdict banner and a what-this-means next step.](https://mintcdn.com/decimal/PX7CxuNhhOlaPSUJ/images/tutorials/demo-impact-report.png?fit=max\&auto=format\&n=PX7CxuNhhOlaPSUJ\&q=85\&s=76a3634172823db9cad5bc3cbd0f89b8)

The seeded impact report

**Or run the Action with no key.** Leave out `api-key` and the Action runs in fixture mode: it posts the comment on your PR from a committed sample report, labelled as sample data, with no signup. The job never fails in this mode. A workflow with one step, `uses: decimal-labs/regression-check@v1`, and the `pull-requests: write` permission is enough.

## Setup

Trace your agent in production first ([Tracing](https://docs.decimal.ai/guides/tracing.md)). Until traces exist, the check has nothing to measure against.

> [!TIP]
>
> In Claude Code, `/decimalai:check` writes Steps 1 and 2 for you. Step 3 is still yours. See the [Claude Code plugin guide](https://docs.decimal.ai/guides/claude-code.md).

### Step 1: Add a thin init entry point

The Action doesn't build the manifest itself. A step before it runs your agent's setup code and uploads the result, so the manifest comes from the same objects production uses.

Create `scripts/init_for_decimal.py`:

```python theme={null}
"""Registers this PR's candidate manifest for the regression check."""
import decimalai
from myapp.agent import build_agent  # adjust to your agent factory


def main() -> None:
    decimalai.init()  # reads DECIMAL_API_KEY and DECIMALAI_MODE from the environment

    agent = build_agent()  # builds the agent and never runs it, so no model is called

    result = decimalai.flush_manifest_for_ci(
        agent_name="support-agent",  # must match the Action's `agent-name` input
        chain=agent,                 # LangChain/LangGraph: reads tools, prompts and models
    )
    print(f"Manifest registered: {result['manifest_id']} -> {result['output_path']}")


if __name__ == "__main__":
    main()
```

> [!WARNING]
>
> Building the agent alone registers nothing. `flush_manifest_for_ci()` uploads the candidate manifest and writes its ID. Without it, the Action stops with **"No candidate-manifest-id provided or discoverable"**.

If your factory doesn't return a LangChain or LangGraph object, drop `chain=` and pass `tools`, `prompts`, `models` and `output_schema` yourself, the same arguments [`register_manifest()`](https://docs.decimal.ai/sdk/python/manifests) takes. With LangGraph's `create_react_agent`, `chain=` finds the tools but not the model or prompt, so pass `prompts` and `models` as well.

### Step 2: Add the GitHub Action workflow

Create `.github/workflows/decimal.yml`:

```yaml theme={null}
name: Agent Regression Check
on: [pull_request]

permissions:
  contents: read
  pull-requests: write  # lets the Action post and update its PR comment

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'

      - name: Install dependencies
        run: pip install -e .

      - name: Manifest extraction
        id: manifest  # required: the next step reads this step's output
        env:
          DECIMALAI_MODE: manifest_only
          PYTHONPATH: .  # lets the script import from the repo root
          DECIMAL_API_KEY: ${{ secrets.DECIMAL_API_KEY }}
          OPENAI_API_KEY: dummy_for_init  # placeholder for keys your init code requires
        run: python scripts/init_for_decimal.py

      - name: Agent Regression Check
        uses: decimal-labs/regression-check@v1
        with:
          api-key: ${{ secrets.DECIMAL_API_KEY }}
          agent-name: support-agent  # the name your production agent passes to agent_config(...)
          candidate-manifest-id: ${{ steps.manifest.outputs.decimal_manifest_id }}
```

`$GITHUB_OUTPUT` is per step, so the Action can't see what an earlier step wrote unless you pass it through. A workflow without the `id:` and `candidate-manifest-id:` lines fails with the same "No candidate-manifest-id" error, whichever template it came from.

### Step 3: Add the secret

In your GitHub repo, open **Settings → Secrets and variables → Actions → New repository secret**.

* Name: `DECIMAL_API_KEY`
* Value: your API key from [Settings → API keys](https://app.decimal.ai/settings/api-keys)

From now on, a PR that changes the model, a tool or a skill gets a report in the PR comment, which updates in place on every push.

## Read the report

If the agent has no earlier manifest, the first PR records its manifest as the baseline, posts **FIRST RUN**, and passes. Later PRs get a report like this one, shortened from the sample report that fixture mode uses:

```text theme={null}
🔍 Agent Regression Check — support-agent

Manifest changes:
- 🟡 Tool renamed — lookup_price
- 🟡 Model changed — gpt-4o-mini · moderate (version bump)
- 🟡 Prompt section rewritten — system_prompt · major (88.6% changed)
- 🟢 Optional param added — check_inventory
- 🟢 Tool added — refund_order
- 🔴 Tool removed — compare_competitors

Impact on last 120 production traces:

| Severity         | Affected | Currently passing eval | Currently failing | Unscored |
| all              | 120      | 15                     | 5                 | 100      |
| 🔴 HIGH IMPACT   | 2        |
| 🟡 MEDIUM IMPACT | 118      |
| 🟢 LOW IMPACT    | 0        |

Top affected:
- 2 traces called the removed compare_competitors tool. These will error or
  fall back when this change ships. (2 failing)

---
🔴 HIGH IMPACT — review before merging
⚠️ REGRESSION LIKELY — affects traffic that was passing eval

Behavioral verification — model change detected; the structural check can't
confirm whether outputs differ.
- 120 recorded calls can be replayed against the new model. Add
  behavioral-check: real to verify (spends tokens), or use post-deploy bisect.

View full report →
```

Each trace counts once, at its worst severity. A comment can also carry **Training-data policy** and **Downstream impact** blocks, which show what your [compatibility policy](https://docs.decimal.ai/guides/compatibility-policies.md) would do with these traces and what else the change reaches. They don't change the verdict.

**View full report** opens the impact report in the dashboard. **Agents → your agent → More → Regression checks** lists every check for the agent.

### The structural verdict

| In the comment | `verdict` output | What it means | Fails the job when |
| - | - | - | - |
| HIGH IMPACT | `high_risk` | At least one trace hit a high-severity change | `fail-on` is `high` or `medium` |
| MEDIUM IMPACT | `medium_risk` | The worst hit was medium severity | `fail-on` is `medium` |
| LOW IMPACT | `low_risk` | Only low-severity changes reached traces | Never |
| NO CHANGE | `no_change` | Nothing changed, or traces exist but none used what changed | Never |
| UNVERIFIED | `unverified` | The manifest changed and the window has no traces. Nothing was measured, so this isn't a pass | See [Blocking behavior](#blocking-behavior) |
| FIRST RUN | `first_run` | No earlier manifest to compare with | Never |
| CHECK DID NOT RUN | `unavailable` | The check couldn't run and `on-error` is `warn` | Never |

### The eval verdict

| In the comment | What it means |
| - | - |
| REGRESSION LIKELY | At least one affected trace was passing eval |
| EXPECTED IMPACT | Affected traces include failing ones and no passing ones |
| CLEAN | No affected trace has a pass or fail score: nothing was affected, or only unscored traces were |

The eval verdict never changes the job result. Scores come from your [evaluators](https://docs.decimal.ai/guides/evaluations.md), so with no scored traces it always reads CLEAN.

### How severity is determined

| Severity | Change |
| - | - |
| HIGH | Tool removed. Tool gains a required parameter, or its schema changes with none added or removed. Skill removed. Model moves to a new family or provider under the same manifest name, such as the `default` name `chain=` uses |
| MEDIUM | Tool renamed or loses a parameter. Skill modified. Prompt text 5% or more changed. Model version bump, or a model under a new manifest name |
| LOW | Tool added or gains an optional parameter. Prompt text under 5% changed. Model settings change |

Tool changes count the traces that called the tool, and skill changes count the traces that activated the skill. Prompt and model changes count every trace in the window: the check can say they may all change, but not whether answers get better or worse. For a model swap, [`behavioral-check`](#behavioral-verification) answers part of that.

Only these changes move the verdict. Changing a sub-agent or the output schema creates a new version, but the check doesn't grade it.

## What to do with the result

### How the two verdicts combine

| Structural | Eval | What it means and what to do |
| - | - | - |
| HIGH IMPACT | REGRESSION LIKELY | A breaking change reaches working traffic. Fix the PR, or ship it on purpose |
| HIGH IMPACT | EXPECTED IMPACT | Scored traffic was already failing, as when you remove a broken tool. Check the traces and merge |
| MEDIUM IMPACT | Any | Traces may behave differently. Merge if you meant that reach. If not, revert that part and push |
| LOW IMPACT | REGRESSION LIKELY | A small change lands on working traffic. Read the affected traces before merging |
| LOW IMPACT or NO CHANGE | CLEAN | No scored traffic was touched. Merge |
| UNVERIFIED | None | Nothing was measured. Connect production, or widen `trace-window-days` |

### When the job fails

With the default `fail-on: high`, a HIGH IMPACT verdict fails the job. You can:

* **Fix it.** Restore the tool, parameter or skill and push.
* **Ship it on purpose.** Set `fail-on: none` in the PR's workflow file for that run, say why in the PR, and put it back afterwards.

**Mark intentional** on the impact report records your decision for the team. It doesn't change the job result or carry over to later runs.

### After merge

When your deployed agent registers the merged manifest and sends traces, that manifest becomes the baseline for later PRs.

## Find what broke

A change can pass the PR check and still hurt production, because a model swap or prompt rewrite changes behavior that a structural diff can't predict. This view shows how each shipped version really performed, from traces you already recorded, and spends no tokens. The PR comment calls this post-deploy bisect.

Open **Agents → your agent → More → Regression checks**. **Live performance timeline** is at the top, above the impact reports. It has one bar per manifest version, and you choose the metric and a window of 1, 7, 14 or 30 days:

| Metric | What it measures |
| - | - |
| Pass rate (default) | Share of scored traces that passed your [evaluators](https://docs.decimal.ai/guides/evaluations.md) |
| Error rate | Share of traces that didn't succeed |
| Avg tokens / trace | Tokens used per trace |
| Latency P95 | 95th percentile latency of model calls |

**Regression detected** appears when the most recent version is more than 10% worse than the version before it, and both have at least 50 traces. With fewer, a note says there isn't enough data and thin bars are hatched. Only the latest pair is tested, so if you shipped three versions today, compare the bars by eye. To see it populated, open `[Demo] support-agent` after running the demo above.

**1. See what changed**

**view what changed** in the banner opens **Code changes** at the diff between those two versions.

**2. Raise an alert**

**Mark as regression** in the banner, or a click on any bar, creates an alert and fires your webhook if you've configured one. A background job also does this about once a day, for pass rate only, over the last 7 days.

**3. Decide**

* **Revert.** **View revert checklist** on the alert lists what to undo in your code and links the PR that introduced the version, when there is one. DecimalAI doesn't deploy your code. For a prompt or skill it serves, see [roll back](https://docs.decimal.ai/guides/agent-setup-versions.md).
* **Fix forward.** A new PR gets a check as usual, and its version gets its own bar once deployed.
* **Accept.** **Resolve** closes the alert. **Acknowledge** says someone is looking at it.

Neither button changes the data, so the banner stays while the numbers show the drop. After a revert, traffic joins the earlier version's bar, because a matching manifest reuses its version. The banner can stay on the later version until its traces leave the window, so set the window to 1 day to see only recent traffic.

Over REST, `GET /api/v1/agents/{agent}/regression-timeline` takes `metric` and `window_days` (up to 90). `POST /api/v1/regression-alerts` takes `agent_name`, `manifest_id`, and optionally `metric` and `reason`.

## Configuration options

### Inputs

| Input | Default | What it does |
| - | - | - |
| `api-key` | None | Your DecimalAI API key. Omit it for fixture mode |
| `agent-name` | None | Required with `api-key`. The name your production traces are filed under: the first argument of `agent_config(...)`, or `decimalai.init(agent_name=...)` with no agent config |
| `candidate-manifest-id` | None | The manifest to check, from the extraction step. If omitted, the Action looks in `./decimal_manifest_id.txt` |
| `fail-on` | `high` | When to fail the job: `high`, `medium` (MEDIUM or worse), or `none` (report only) |
| `on-error` | `warn` | What to do when the check couldn't run: `warn` or `fail` |
| `comment-mode` | `update` | `update` edits one comment on each push. `new` posts a new one |
| `trace-window-days` | `30` | How far back to look for affected traces, from 1 to 365 |
| `behavioral-check` | `off` | `off`, `mock` or `real`. See [Behavioral verification](#behavioral-verification) |
| `github-token` | `github.token` | Token for the PR comment. Override it to comment on forked PRs |

### Outputs

| Output | Value |
| - | - |
| `mode` | `live`, or `fixture` when no `api-key` was supplied |
| `verdict` | A value from [the structural verdict](#the-structural-verdict) table |
| `high-risk-count`, `medium-risk-count`, `low-risk-count` | Traces at each severity |
| `regression-check-id`, `report-url` | The saved check and a link to it. Not set when the verdict is `unavailable` |

### Blocking behavior

| Situation | Job result |
| - | - |
| Verdict reaches the `fail-on` level | Fails |
| `unverified` | Ranked by how severe the manifest change is, so deleting a tool fails under `fail-on: high` even with no traffic to score it |
| The check couldn't run: an outage, a 5xx, a network error, a timeout, or the plan's monthly quota (HTTP 429) | `on-error: warn` posts a "CHECK DID NOT RUN" comment and passes. `on-error: fail` fails |
| A bad API key (401, 403), an unknown agent or manifest (400, 404), an invalid input value, or no candidate manifest ID | Always fails |
| The PR comment can't be posted | Logs a warning and doesn't change the result |

A failed job blocks the merge only if GitHub branch protection requires it. Each check counts against your plan's monthly limit ([Pricing](https://docs.decimal.ai/pricing.md)).

### Behavioral verification

`behavioral-check` tests whether a model swap really changes answers. It takes a small sample of the affected traces (at most 10), re-sends one recorded model call from each to the new model, and compares the answers. This is a single stateless model call, not your agent, so no tools run.

| Value | What it does |
| - | - |
| `off` | The default. Nothing runs. If the PR changes the model, the comment suggests `real` |
| `mock` | Free. Counts the eligible calls and verifies nothing |
| `real` | Live calls using DecimalAI's provider keys, plus an LLM judge that rates changed answers. Needs the Core plan or above ([Pricing](https://docs.decimal.ai/pricing.md)) |

It runs only when the diff contains a model change, and it never fails the job. It works only when the old and new models share a provider, and that provider is OpenAI or Gemini. Otherwise the comment says so.

## Running outside CI

You can run the same analysis from your laptop or another CI system. Outside GitHub Actions, `flush_manifest_for_ci()` writes the ID to `./decimal_manifest_id.txt`, and the CLI reads it from there:

```bash theme={null}
PYTHONPATH=. DECIMALAI_MODE=manifest_only python scripts/init_for_decimal.py
decimalai regression-check --agent-name support-agent
```

`--dry-run` computes the report without saving it or using quota. The CLI exits 0 below the `fail-on` level, 1 at or above it, and 2 on an error, and [the CLI reference](https://docs.decimal.ai/sdk/cli/runs-and-data.md) has every option. From a script, `POST /api/v1/regression-check` takes `agent_name` and `candidate_manifest_id`, with `?dry_run=true` as a query parameter. **Run new check** on the **Regression checks** page does this from the dashboard.

## What can go wrong

### The manifest extraction step fails

Your init script raised an error, so the job fails at that step and the Action never runs. Usually `build_agent()` needs something CI doesn't have, such as a database or a key. Stub what it needs, and use placeholder values for required environment variables.

### No comment on the PR

Check that the workflow grants `pull-requests: write`. A failed comment only logs a warning, so the job can be green with no comment. On PRs from forks, the default token can't comment, so set `github-token`.

### A report that doesn't describe your PR

The check compares manifest versions. A PR that leaves the manifest as it is, including one that only edits prompt text, registers no new version ([Manifests](https://docs.decimal.ai/guides/manifests.md)). The report then shows the current version against the one before it, not your PR, and it can fail the job on a change that has already shipped.

A prompt edit is graded when it ships with a tool, model or skill change. To test a prompt edit alone, use [Evaluations](https://docs.decimal.ai/guides/evaluations.md), then watch [the timeline](#find-what-broke) after you deploy.

### "First run" on more than one PR

The check stays on first run until the agent has a second manifest version.

### Empty or small impact reports

* Has this agent sent traces in the window? If not, the verdict is `unverified`. Widen `trace-window-days` if the traffic is older.
* Does `agent-name` match both `flush_manifest_for_ci(agent_name=...)` and the name your production agent uses? A mismatch finds no traces.

### HIGH IMPACT on a change that should do nothing

A tool whose content changes with no parameter added or removed reads as HIGH. The manifest is probably capturing something that changes on its own, such as a value generated at runtime. See [Manifests](https://docs.decimal.ai/guides/manifests.md).

### Stale baseline

The baseline is the manifest yours was registered on top of, skipping PR builds that never served a trace. If reports look exaggerated, check that the deployed agent runs the SDK in its normal mode, not `manifest_only`.

## How this compares to eval-based regression checks

An eval-driven check re-runs your eval suite on the new version and compares pass rates. DecimalAI looks at what changed and which real traces it reaches.

| | Eval-driven | Manifest-aware (DecimalAI) |
| - | - | - |
| Needs eval cases | Yes, and they need upkeep | No. Production traces are the test set |
| Runs your agent in CI | Yes | No. CI only builds it to read the manifest |
| Knows which traffic a change reaches | No. The whole suite runs | Yes, trace by trace |
| Catches a removed tool | Only if a case covers it | Yes, when traces in the window called it |
| Says whether answers got better | Yes, on its cases | No. It shows reach, not direction |

The two approaches are complementary. Use both if you want behavioral verification on the eval surface, and use DecimalAI alone if you don't have an eval suite yet.

## What's next

> [card] [Manifests](https://docs.decimal.ai/guides/manifests.md)
>
> What manifests capture and how versions work.

> [card] [Evaluations](https://docs.decimal.ai/guides/evaluations.md)
>
> Test a change, including a prompt edit.

> [card] [Troubleshooting](https://docs.decimal.ai/guides/troubleshooting.md)
>
> The Action isn't commenting, or says "no manifest"?


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.