Deterministic quality measurement for AI agents. Accept scenario definitions, run Monte Carlo evaluations, and gate CI/CD pipelines on pass/fail status.
All CI/CD endpoints require the X-BaselineForge-Key header.
Set the environment variable BASELINE_FORGE_API_KEY in your server/app environment. Pass it as a header on every CI/CD request:
X-BaselineForge-Key: <your-api-key>
If the key is missing or invalid, the endpoint returns 401 Unauthorized. If the env var is not configured at all, POST /api/ci/check returns 503 Service Unavailable.
Get your API key from your deployment environment's config (e.g., Render environment variables).
Execute a Monte Carlo scenario and receive structured metrics with pass/fail classification against baselines.
Accepts a scenario definition, executes n trials, classifies the result against baseline thresholds, persists the run record, and returns structured results including success rate, cost, duration, and regression signals.
| Field | Type | Required | Description |
|---|---|---|---|
agent_type | string | Yes | Agent archetype, e.g. "engineering", "support", "research" |
name | string | No | Scenario name for tracking. Defaults to <agent_type>:<timestamp> |
profile_id | number | No | Baseline profile to auto-apply thresholds. Overridden by explicit baseline fields. |
n | number | No | Number of trials, 1–50. Defaults to 10. |
fixture | object | No | Controlled environment config: company_type, task, complexity (1–10), or any custom key-value pairs. |
baseline | object | No | Overrides or sets thresholds: success_rate (target %), soft_failure (floor %), cost_per_task (max USD), max_duration_ms |
# Run an engineering agent scenario with 20 trials
curl -X POST https://baselineforge-2.polsia.app/api/scenarios/run \\
-H "Content-Type: application/json" \\
-d '{
"name": "engineering-agent-v3",
"agent_type": "engineering",
"profile_id": 2,
"n": 20,
"fixture": {
"company_type": "saas",
"complexity": 7
}
}'
{
"scenario_id": 1,
"run_id": 14,
"agent_type": "engineering",
"profile": { "id": 2, "name": "Coding Agent" },
"measurement": {
"success_rate": 0.91,
"cost_usd": 0.38,
"duration_ms": 12450,
"trials": 20,
"trial_results": [...]
},
"status": "pass",
"baseline": {
"success_rate": 0.91,
"soft_failure": 0.33,
"cost_per_task": 0.50
},
"regression_signals": [],
"ran_at": "2026-05-24T07:00:00.000Z"
}
Run a scenario check as part of a CI pipeline. Returns HTTP 200 on pass, 422 on fail.
X-BaselineForge-Key required
Executes the scenario associated with scenario_id and returns structured pass/fail results. CI pipelines should gate on the HTTP status code: 200 = pass, 422 = fail. All request metadata (commit SHA, branch) is stored in the ci_runs table for audit.
| Header | Value |
|---|---|
X-BaselineForge-Key | Your BASELINE_FORGE_API_KEY env var value |
| Field | Type | Required | Description |
|---|---|---|---|
scenario_id | number | Yes | ID of the scenario to run (must already exist in the database) |
commit_sha | string | Yes | Git commit SHA being checked (stored in CI run record) |
branch | string | No | Git branch name for badge filtering, e.g. "main" |
curl -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": 1,
"commit_sha": "a3f8c2d",
"branch": "main"
}'
{
"passed": true,
"commit_sha": "a3f8c2d",
"branch": "main",
"duration_ms": 3120,
"summary": {
"total": 10,
"passed": 9,
"failed": 1,
"soft_failed": 0
},
"results": [...],
"regression_signals": [],
"scenario": { "id": 1, "name": "engineering-agent-v3", "agent_type": "engineering" },
"run_id": 15
}
| Status | Body | Cause |
|---|---|---|
400 | { "error": "scenario_id is required..." } | Missing or invalid fields |
401 | { "error": "Unauthorized..." } | Missing or wrong X-BaselineForge-Key |
404 | { "error": "Scenario N not found" } | scenario_id does not exist |
422 | Full response body with "passed": false | Scenario failed baseline thresholds |
Compare two runs side-by-side and get structured deltas with direction indicators.
Returns per-metric deltas (success_rate, cost_usd, duration_ms) between two runs of the same scenario. run_a defaults to the most recent run before run_b. Both runs must belong to the same scenario.
| Param | Required | Description |
|---|---|---|
run_b | Yes | ID of the newer run to compare |
run_a | No | ID of the older run. Omit to auto-select the most recent prior run |
curl "https://baselineforge-2.polsia.app/api/scenarios/1/compare?run_b=14&run_a=12"
{
"scenario_id": 1,
"run_a": {
"id": 12,
"metrics": {
"success_rate": 0.87,
"cost_usd": 0.52,
"duration_ms": 14800
},
"status": "soft_fail",
"created_at": "2026-05-23T10:00:00.000Z"
},
"run_b": {
"id": 14,
"metrics": {
"success_rate": 0.91,
"cost_usd": 0.38,
"duration_ms": 12450
},
"status": "pass",
"created_at": "2026-05-24T07:00:00.000Z"
},
"deltas": {
"success_rate": { "old": 0.87, "new": 0.91, "change_pct": 4.60, "direction": "improved" },
"cost_usd": { "old": 0.52, "new": 0.38, "change_pct": -26.92, "direction": "improved" },
"duration_ms": { "old": 14800, "new": 12450, "change_pct": -15.88, "direction": "improved" }
},
"summary": { "total_metrics": 3, "improved": 3, "regressed": 0, "stable": 0 }
}
Embed a live SVG status badge in your README or dashboard.
Returns a shields.io-format SVG badge showing PASS / FAIL / NO RUNS for the latest CI run of the scenario. Cached for 60 seconds to avoid DB load from frequent polling. Filter by branch with ?branch=main.
| Param | Description |
|---|---|
scenarioId | Numeric scenario ID |
| Param | Description |
|---|---|
branch | Optional branch filter, e.g. ?branch=main — returns latest run for that branch only |
https://baselineforge-2.polsia.app/api/ci/badge/1?branch=main
Update 1 to your actual scenario ID. For unfiltered badge (all branches): drop ?branch=main.
| Status | Color | Meaning |
|---|---|---|
PASS | 🟢 green | Latest CI run passed all baselines |
FAIL | 🔴 red | Latest CI run failed or soft-failed baselines |
NO RUNS | ⬜ gray | No CI runs recorded for this scenario/branch |
UNKNOWN | ⬜ gray | Scenario not found or DB error (fail-open) |
Pre-defined agent archetype templates with default success rate and cost thresholds. Pass profile_id to /api/scenarios/run to auto-fill baseline thresholds.
List all available baseline profile templates. Each profile contains default_thresholds and metric_definitions.
curl https://baselineforge-2.polsia.app/api/profiles
{
"profiles": [
{
"id": 1,
"name": "Support Agent",
"agent_type": "support",
"success_rate_threshold": 0.93,
"default_thresholds": {
"success_rate": 0.93,
"soft_failure": 0.50,
"cost_per_task": 0.25
},
"metric_definitions": [...],
"custom_metrics": {}
},
{
"id": 2,
"name": "Coding Agent",
"agent_type": "engineering",
"success_rate_threshold": 0.91,
"default_thresholds": {
"success_rate": 0.91,
"soft_failure": 0.33,
"cost_per_task": 0.50
},
"metric_definitions": [...],
"custom_metrics": {}
},
{
"id": 3,
"name": "Research Agent",
"agent_type": "research",
"success_rate_threshold": 0.89,
"default_thresholds": {
"success_rate": 0.89,
"soft_failure": 0.40,
"cost_per_task": 0.60
},
"metric_definitions": [...],
"custom_metrics": {}
}
]
}
Fetch a single profile by ID. Returns the profile with full default_thresholds and metric_definitions.
curl https://baselineforge-2.polsia.app/api/profiles/2
Add a BaselineForge quality gate to any GitHub Actions workflow in under 5 minutes.
Set BASELINE_FORGE_API_KEY as a GitHub Secret, then add this step to your workflow:
# .github/workflows/quality-gate.yml
name: BaselineForge Quality Gate
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
baseline-check:
runs-on: ubuntu-latest
steps:
- name: Run BaselineForge quality check
run: |
# Replace SCENARIO_ID with your scenario ID from /docs/profiles
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "${{ secrets.BASELINE_FORGE_API_URL }}/api/ci/check" \\
-H "Content-Type: application/json" \\
-H "X-BaselineForge-Key: ${{ secrets.BASELINE_FORGE_API_KEY }}" \\
-d '{
"scenario_id": 1,
"commit_sha": "${{ github.sha }}",
"branch": "${{ github.ref_name }}"
}')
STATUS_CODE=$(echo "$RESPONSE" | tail -1)
BODY=$(echo "$RESPONSE" | sed '$d')
echo "BaselineForge response:"
echo "$BODY" | jq .
if [ "$STATUS_CODE" = "200" ]; then
echo "BaselineForge: PASS — all baselines met"
exit 0
elif [ "$STATUS_CODE" = "422" ]; then
echo "BaselineForge: FAIL — baseline thresholds not met"
exit 1
else
echo "BaselineForge: Unexpected status $STATUS_CODE"
echo "$BODY" | jq .
exit 1
fi
env:
BASELINE_FORGE_API_URL: https://baselineforge-2.polsia.app
BASELINE_FORGE_API_KEY as a GitHub Secret (Settings → Secrets → Actions)BASELINE_FORGE_API_URL secret to https://baselineforge-2.polsia.app.github/workflows/baselineforge.ymlscenario_id to match your scenario's ID (found on the profiles page)Paste this markdown to show live CI status: