The Problem: Most Agent Pilots Never Reach Production

Enterprise teams are deploying AI agents faster than they can evaluate them. The testing paradigm that works for traditional software — unit tests, integration tests, assertions — breaks down completely with agents. Agents are non-deterministic. The same input produces different outputs on different runs. Traditional assertions fail immediately.

88%
of AI agent pilots fail to reach production. The majority fail not because of bad models, but because teams lack any reliable way to measure agent behavior across releases.

So teams ship to production hoping for the best. The agent works in demos. It fails in the wild. They patch, re-deploy, watch error rates spike, and patch again. There’s no systematic way to know if a new model version or prompt change made things better or worse.

The fix isn’t more unit tests. It’s a quality baseline.

What Is a Quality Baseline?

A quality baseline is a statistical contract for your agent’s behavior. Instead of asserting “the agent returns X,” you assert “the agent succeeds at least 94% of the time, costs under $0.42 per task, and completes in under 8 seconds.” You establish this baseline against a controlled environment, then measure every release against it.

This is how hardware teams ship chips. This is how pharmaceutical companies run trials. And this is how serious AI teams are starting to ship agents.

Key insight: You’re not testing individual outputs — you’re measuring distributions. Success rate, cost, latency, and failure modes across hundreds of controlled runs. That’s a baseline.

A quality baseline has three components:

How to Set Up a Quality Baseline

Step 1: Run a Scenario Evaluation

Define a scenario with your agent type, fixture configuration, and baseline thresholds. BaselineForge runs it as a Monte Carlo simulation and returns structured metrics.

// POST /api/scenarios/run — submit a scenario for evaluation
const response = await fetch('https://baselineforge-2.polsia.app/api/scenarios/run', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-BaselineForge-Key': process.env.BASELINE_FORGE_API_KEY
  },
  body: JSON.stringify({
    name: 'support-agent-v2-onboarding',
    agent_type: 'support',
    fixture_config: {
      company_type: 'saas_startup',
      ticket_complexity: 'medium',
      tools_available: ['knowledge_base', 'crm']
    },
    baseline_thresholds: {
      success_rate: 0.92,        // must succeed 92%+ of the time
      soft_failure_rate: 0.30,   // red flag if below 30%
      max_cost_usd: 0.35,         // $0.35/task ceiling
      max_duration_ms: 12000      // 12s latency bound
    },
    runs: 50                       // Monte Carlo: 50 independent runs
  })
});

const { run_id, status, success_rate, cost_usd, duration_ms } = await response.json();
// status: "pass" | "fail" | "warn"

Step 2: Gate CI/CD on Baseline Metrics

Once you have a baseline, every PR can be gated against it. The POST /api/ci/check endpoint returns HTTP 200 for a passing run and 422 for a failure — designed to plug directly into any CI pipeline.

// POST /api/ci/check — CI/CD gate for a scenario
const result = await fetch('https://baselineforge-2.polsia.app/api/ci/check', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-BaselineForge-Key': process.env.BASELINE_FORGE_API_KEY
  },
  body: JSON.stringify({
    scenario_id: 'scenario-uuid-here',
    commit_sha: process.env.GITHUB_SHA,
    branch: process.env.GITHUB_REF_NAME
  })
});
// HTTP 200 = pass (merge allowed)
// HTTP 422 = fail (block the PR)

Step 3: Compare Runs to Detect Regressions

The compare endpoint gives you structured deltas between any two runs — direction (improved/regressed/stable) and magnitude for every metric. This is what tells you whether your model upgrade actually helped.

// GET /api/scenarios/:id/compare — compare two runs
const comparison = await fetch(
  `https://baselineforge-2.polsia.app/api/scenarios/${scenarioId}/compare?run_a=${runA}&run_b=${runB}`
);

// Response shape:
// {
//   success_rate: { run_a: 0.91, run_b: 0.94, delta: +0.03, direction: "improved" },
//   cost_usd:     { run_a: 0.41, run_b: 0.38, delta: -0.03, direction: "improved" },
//   duration_ms:  { run_a: 9200, run_b: 8800, delta: -400,  direction: "improved" }
// }

Integrating with GitHub Actions

Drop this into your CI workflow to block merges that would regress agent quality. The badge embed gives you a live signal on your README.

# .github/workflows/agent-quality.yml
name: Agent Quality Gate

on:
  pull_request:
    branches: [main]

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

      - name: Run BaselineForge Quality Gate
        env:
          BASELINE_FORGE_API_KEY: ${{ secrets.BASELINE_FORGE_API_KEY }}
        run: |
          RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \
            -X POST https://baselineforge-2.polsia.app/api/ci/check \
            -H "Content-Type: application/json" \
            -H "X-BaselineForge-Key: $BASELINE_FORGE_API_KEY" \
            -d "{\"scenario_id\":\"${{ vars.SCENARIO_ID }}\",\"commit_sha\":\"${{ github.sha }}\",\"branch\":\"${{ github.head_ref }}\"}")
          if [ "$RESPONSE" != "200" ]; then
            echo "Quality gate failed (HTTP $RESPONSE). Blocking merge."
            exit 1
          fi
          echo "Quality gate passed."

Add a live badge to your README with the scenario’s current pass/fail status:

# README.md
![Agent Quality](https://baselineforge-2.polsia.app/api/ci/badge/YOUR_SCENARIO_ID)

LLM Evals vs. Quality Baselines

Evals and baselines solve different problems. Use both — but know which one to reach for when.

Dimension LLM Evals Quality Baselines
What they test Individual model outputs (prompt-in, text-out) Agent behavior in a controlled environment
Scope Single LLM call Full agent workflow (tools, state, multi-turn)
Handles non-determinism ✗ Brittle on stochastic output ✓ Statistical bands absorb variance
CI/CD integration ~ Requires custom thresholds ✓ HTTP 200/422 gate, native badge
Regression detection ~ Manual diff of eval suites ✓ Structured deltas with direction
Cost + latency tracking ✗ Not in scope ✓ First-class metrics, per-run
Best for Prompt engineering, model selection Production release gating, SLA enforcement

Evals tell you which model writes better code. Baselines tell you whether your agent can actually deploy a feature end-to-end, within budget, reliably enough to ship to production.

Start Before You Think You Need To

The biggest mistake teams make is waiting until they have a performance problem to set up quality measurement. By then, you have no baseline to regress against. You don’t know if you’re at 60% success rate or 94% — and you don’t know what you changed to get there.

Set your baseline on day one. Run it on every PR. The first time a model upgrade or prompt tweak would have caused a regression, your CI pipeline will catch it before it reaches users.

That’s the difference between teams that ship AI agents to production and teams that demo them forever.

Set your first baseline in 10 minutes

BaselineForge gives you the scenario runner, CI gate, badge, and compare endpoint out of the box. No infrastructure to manage.

Open Scenario Runner →
← Back to Blog