Bernstein Quality API
The Quality API from Bernstein — 14 operation(s) for quality.
The Quality API from Bernstein — 14 operation(s) for quality.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/bernstein-run:bernstein-run-quality-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Bernstein Task Server Quality API
description: 'Bernstein REST API - the open-source governance layer for AI agents, one git worktree per task.
## Authentication
Authentication is ENABLED by default. Include a Bearer token in all requests:
```
Authorization: Bearer
```
To run without auth (development only), set `BERNSTEIN_AUTH_DISABLED=1` - this logs a loud warning and passes every request through.
Public endpoints (no auth required): `/health`, `/health/ready`, `/health/live`, `/ready`, `/alive`, `/.well-known/agent.json`, `/docs`, `/openapi.json`, and the auth-flow endpoints (`/auth/login`, `/auth/oidc/callback`, etc.).
Webhook and hook endpoints (`/webhook`, `/webhooks/*`, `/hooks/{session_id}`) authenticate via HMAC-SHA256 signatures - they do NOT accept Bearer tokens.
## Base URL
Default: `http://127.0.0.1:8052`. Override with env vars `BERNSTEIN_HOST` and `BERNSTEIN_PORT`.
## Error Format
All errors return JSON with a `detail` field:
```json
{"detail": "Task not found: task-xyz"}
```
| Status | Meaning |
|--------|---------|
| 400 | Bad request (validation error) |
| 401 | Unauthorized (missing/invalid token) |
| 403 | Forbidden (IP not in allowlist) |
| 404 | Resource not found |
| 409 | Conflict (task already in terminal state) |
| 429 | Rate limited - respect the `Retry-After` header |
| 500 | Internal server error |'
version: 3.22.0
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
contact:
name: Alex Chernysh
url: https://github.com/sipyourdrink-ltd/bernstein
servers:
- url: http://{host}:{port}
description: Task server started by the Bernstein CLI on the operator's own machine. There is no hosted instance; substitute the host and port of your install.
variables:
host:
default: 127.0.0.1
description: Interface the task server binds to. Loopback by default.
port:
default: '8052'
description: Task server port. Override with BERNSTEIN_PORT.
tags:
- name: Quality
paths:
/quality:
get:
summary: Get Quality Metrics
description: 'Return aggregated internal quality metrics (last 7 days).
Reads from ``.sdd/metrics/`` JSONL files to compute:
- ``per_model``: per-model success rate, avg tokens, and completion
time distribution (p50/p90/p99).
- ``overall``: aggregate across all models.
- ``gate_stats``: per-gate pass/blocked/flagged counts (last 30 days).
- ``guardrail_pass_rate``: fraction of gate checks that passed.
- ``review_rejection_rate``: fraction of tasks that failed overall.
Returns an empty structure when no metric data exists yet.'
operationId: get_quality_metrics_quality_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Quality
/quality/budget-forecast:
get:
summary: Get Budget Forecast
description: Return projected spend for the active planned backlog.
operationId: get_budget_forecast_quality_budget_forecast_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Quality
/quality/trend:
get:
summary: Get Quality Trend
description: 'Return time-series quality metrics for trend visualization.
Buckets quality data by day (default) or week and returns per-bucket
success rates, gate pass rates, and average quality scores. Covers the
last 90 days by default so dashboards can show weeks-to-months trends.
Query parameters:
- ``days``: lookback window in days (default 90, max 365).
- ``granularity``: ``"day"`` (default) or ``"week"``.
Returns a ``series`` list ordered by date, each entry containing:
- ``date``: ISO date string (bucket start).
- ``ts``: Unix timestamp of the bucket start.
- ``tasks_total``, ``tasks_success``: raw task counts.
- ``success_rate``: fraction of tasks that succeeded (omitted if no tasks).
- ``gate_pass_rates``: dict of gate name → pass rate for that bucket.
- ``avg_quality_score``: mean quality score 0-100 (omitted if no scores).'
operationId: get_quality_trend_quality_trend_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Quality
/quality/models:
get:
summary: Get Quality By Model
description: 'Return per-model quality breakdown (last 30 days).
Extended view of model performance for routing configuration and cost
analysis. Covers a longer window than the default ``/quality`` summary.'
operationId: get_quality_by_model_quality_models_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Quality
/quality/file-health:
get:
summary: List File Health
description: 'Return per-file code health scores, worst files first.
Query parameters:
- ``limit``: max results (default 50, max 500).
- ``min_score``: only return files at or below this score.
- ``grade``: filter by grade (A/B/C/D/F).
Returns a JSON object with ``files`` list and summary statistics.'
operationId: list_file_health_quality_file_health_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Quality
/quality/file-health/flagged:
get:
summary: List Flagged Files
description: 'Return files currently flagged for human review due to health degradation.
A file is flagged when:
- A task dropped its health score by ≥10 points, OR
- Its total health score is below 60 (grade D or F).
Returns ``files`` list with detailed health scores and degradation context.'
operationId: list_flagged_files_quality_file_health_flagged_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Quality
/quality/file-health/{file_path}:
get:
summary: Get File Health
description: 'Return the current health score for a single file.
Args:
file_path: File path relative to repository root (URL-encoded).
Returns 404 if the file has never been tracked.'
operationId: get_file_health_quality_file_health__file_path__get
parameters:
- name: file_path
in: path
required: true
schema:
type: string
title: File Path
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'404':
description: File not tracked yet
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Quality
/api/v1/quality:
get:
summary: Get Quality Metrics
description: 'Return aggregated internal quality metrics (last 7 days).
Reads from ``.sdd/metrics/`` JSONL files to compute:
- ``per_model``: per-model success rate, avg tokens, and completion
time distribution (p50/p90/p99).
- ``overall``: aggregate across all models.
- ``gate_stats``: per-gate pass/blocked/flagged counts (last 30 days).
- ``guardrail_pass_rate``: fraction of gate checks that passed.
- ``review_rejection_rate``: fraction of tasks that failed overall.
Returns an empty structure when no metric data exists yet.'
operationId: get_quality_metrics_api_v1_quality_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Quality
/api/v1/quality/budget-forecast:
get:
summary: Get Budget Forecast
description: Return projected spend for the active planned backlog.
operationId: get_budget_forecast_api_v1_quality_budget_forecast_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Quality
/api/v1/quality/trend:
get:
summary: Get Quality Trend
description: 'Return time-series quality metrics for trend visualization.
Buckets quality data by day (default) or week and returns per-bucket
success rates, gate pass rates, and average quality scores. Covers the
last 90 days by default so dashboards can show weeks-to-months trends.
Query parameters:
- ``days``: lookback window in days (default 90, max 365).
- ``granularity``: ``"day"`` (default) or ``"week"``.
Returns a ``series`` list ordered by date, each entry containing:
- ``date``: ISO date string (bucket start).
- ``ts``: Unix timestamp of the bucket start.
- ``tasks_total``, ``tasks_success``: raw task counts.
- ``success_rate``: fraction of tasks that succeeded (omitted if no tasks).
- ``gate_pass_rates``: dict of gate name → pass rate for that bucket.
- ``avg_quality_score``: mean quality score 0-100 (omitted if no scores).'
operationId: get_quality_trend_api_v1_quality_trend_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Quality
/api/v1/quality/models:
get:
summary: Get Quality By Model
description: 'Return per-model quality breakdown (last 30 days).
Extended view of model performance for routing configuration and cost
analysis. Covers a longer window than the default ``/quality`` summary.'
operationId: get_quality_by_model_api_v1_quality_models_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Quality
/api/v1/quality/file-health:
get:
summary: List File Health
description: 'Return per-file code health scores, worst files first.
Query parameters:
- ``limit``: max results (default 50, max 500).
- ``min_score``: only return files at or below this score.
- ``grade``: filter by grade (A/B/C/D/F).
Returns a JSON object with ``files`` list and summary statistics.'
operationId: list_file_health_api_v1_quality_file_health_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Quality
/api/v1/quality/file-health/flagged:
get:
summary: List Flagged Files
description: 'Return files currently flagged for human review due to health degradation.
A file is flagged when:
- A task dropped its health score by ≥10 points, OR
- Its total health score is below 60 (grade D or F).
Returns ``files`` list with detailed health scores and degradation context.'
operationId: list_flagged_files_api_v1_quality_file_health_flagged_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Quality
/api/v1/quality/file-health/{file_path}:
get:
summary: Get File Health
description: 'Return the current health score for a single file.
Args:
file_path: File path relative to repository root (URL-encoded).
Returns 404 if the file has never been tracked.'
operationId: get_file_health_api_v1_quality_file_health__file_path__get
parameters:
- name: file_path
in: path
required: true
schema:
type: string
title: File Path
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'404':
description: File not tracked yet
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Quality
components:
schemas:
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError