Bernstein Graduation API
The graduation API from Bernstein — 10 operation(s) for graduation.
The graduation API from Bernstein — 10 operation(s) for graduation.
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-graduation-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 Graduation 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: graduation
paths:
/graduation/status:
get:
tags:
- graduation
summary: Graduation Status
description: 'Return graduation stage and metrics for all tracked sessions.
Returns:
JSON with ``sessions`` list and ``total`` count.'
operationId: graduation_status_graduation_status_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
/graduation/config/policies:
get:
tags:
- graduation
summary: Get Policies
description: 'Return the current graduation stage policies.
Returns:
JSON mapping stage names to policy thresholds.'
operationId: get_policies_graduation_config_policies_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
/graduation/{session_id}:
get:
tags:
- graduation
summary: Session Graduation
description: 'Return graduation state for a specific session.
Args:
session_id: The session identifier to look up.
Returns:
JSON with stage, metrics, promotion log, and graduation readiness.
Raises:
HTTPException: 404 when no record exists for *session_id*.'
operationId: session_graduation_graduation__session_id__get
parameters:
- name: session_id
in: path
required: true
schema:
type: string
title: Session Id
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'404':
description: No graduation record for session
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/graduation/{session_id}/promote:
post:
tags:
- graduation
summary: Promote Session
description: 'Manually promote a session to the next graduation stage.
Args:
session_id: Session to promote.
body: Promotion reason and who initiated it.
Returns:
JSON with ``from_stage``, ``to_stage``, and ``promoted: true``.
Raises:
HTTPException: 404 when no record exists.
HTTPException: 409 when already at the terminal (autonomous) stage.'
operationId: promote_session_graduation__session_id__promote_post
parameters:
- name: session_id
in: path
required: true
schema:
type: string
title: Session Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PromoteRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'404':
description: No graduation record for session
'409':
description: Already at terminal stage
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/graduation/{session_id}/record-event:
post:
tags:
- graduation
summary: Record Task Event
description: 'Record a task completion or failure for graduation metric tracking.
The orchestrator or CLI calls this after each task completes/fails so
the graduation framework can accumulate per-stage metrics and determine
when the session qualifies for the next stage.
Args:
session_id: The session that executed the task.
body: Task event details.
Returns:
JSON with updated stage, metrics, and graduation readiness.
Raises:
HTTPException: 422 when *initial_stage* is not a valid stage name.'
operationId: record_task_event_graduation__session_id__record_event_post
parameters:
- name: session_id
in: path
required: true
schema:
type: string
title: Session Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RecordEventRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Invalid graduation stage
/api/v1/graduation/status:
get:
tags:
- graduation
summary: Graduation Status
description: 'Return graduation stage and metrics for all tracked sessions.
Returns:
JSON with ``sessions`` list and ``total`` count.'
operationId: graduation_status_api_v1_graduation_status_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
/api/v1/graduation/config/policies:
get:
tags:
- graduation
summary: Get Policies
description: 'Return the current graduation stage policies.
Returns:
JSON mapping stage names to policy thresholds.'
operationId: get_policies_api_v1_graduation_config_policies_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
/api/v1/graduation/{session_id}:
get:
tags:
- graduation
summary: Session Graduation
description: 'Return graduation state for a specific session.
Args:
session_id: The session identifier to look up.
Returns:
JSON with stage, metrics, promotion log, and graduation readiness.
Raises:
HTTPException: 404 when no record exists for *session_id*.'
operationId: session_graduation_api_v1_graduation__session_id__get
parameters:
- name: session_id
in: path
required: true
schema:
type: string
title: Session Id
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'404':
description: No graduation record for session
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/graduation/{session_id}/promote:
post:
tags:
- graduation
summary: Promote Session
description: 'Manually promote a session to the next graduation stage.
Args:
session_id: Session to promote.
body: Promotion reason and who initiated it.
Returns:
JSON with ``from_stage``, ``to_stage``, and ``promoted: true``.
Raises:
HTTPException: 404 when no record exists.
HTTPException: 409 when already at the terminal (autonomous) stage.'
operationId: promote_session_api_v1_graduation__session_id__promote_post
parameters:
- name: session_id
in: path
required: true
schema:
type: string
title: Session Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PromoteRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'404':
description: No graduation record for session
'409':
description: Already at terminal stage
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/v1/graduation/{session_id}/record-event:
post:
tags:
- graduation
summary: Record Task Event
description: 'Record a task completion or failure for graduation metric tracking.
The orchestrator or CLI calls this after each task completes/fails so
the graduation framework can accumulate per-stage metrics and determine
when the session qualifies for the next stage.
Args:
session_id: The session that executed the task.
body: Task event details.
Returns:
JSON with updated stage, metrics, and graduation readiness.
Raises:
HTTPException: 422 when *initial_stage* is not a valid stage name.'
operationId: record_task_event_api_v1_graduation__session_id__record_event_post
parameters:
- name: session_id
in: path
required: true
schema:
type: string
title: Session Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RecordEventRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Invalid graduation stage
components:
schemas:
RecordEventRequest:
properties:
task_id:
type: string
title: Task Id
success:
type: boolean
title: Success
duration_s:
type: number
title: Duration S
default: 0
cost_usd:
type: number
title: Cost Usd
default: 0
initial_stage:
type: string
title: Initial Stage
default: sandbox
type: object
required:
- task_id
- success
title: RecordEventRequest
description: "Body for recording a task completion/failure event.\n\nAttributes:\n task_id: Task identifier.\n success: Whether the task succeeded.\n duration_s: Task wall-clock duration in seconds.\n cost_usd: Estimated cost of the task in USD.\n initial_stage: Stage to initialise the record at when no record exists yet."
PromoteRequest:
properties:
reason:
type: string
title: Reason
default: manual
promoted_by:
type: string
title: Promoted By
default: operator
type: object
title: PromoteRequest
description: "Request body for a manual promotion to the next stage.\n\nAttributes:\n reason: Human-readable reason for the promotion.\n promoted_by: Who triggered the promotion (operator name or ID)."
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