Bernstein Observability API
The Observability API from Bernstein — 22 operation(s) for observability.
The Observability API from Bernstein — 22 operation(s) for observability.
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-observability-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 Observability 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: Observability
paths:
/observability/agents:
get:
summary: Observability Agents
description: Return runtime heartbeat, stall-profile, and log-summary data per agent.
operationId: observability_agents_observability_agents_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Observability Agents Observability Agents Get
tags:
- Observability
/observability/effectiveness:
get:
summary: Observability Effectiveness
description: Return recent effectiveness data, role trends, and best configs.
operationId: observability_effectiveness_observability_effectiveness_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Observability Effectiveness Observability Effectiveness Get
tags:
- Observability
/observability/recommendations:
get:
summary: Observability Recommendations
description: Return the current recommendation set and delivery hit counts.
operationId: observability_recommendations_observability_recommendations_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Observability Recommendations Observability Recommendations Get
tags:
- Observability
/observability/budget:
get:
summary: Observability Budget
description: Return completion-budget status per lineage.
operationId: observability_budget_observability_budget_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Observability Budget Observability Budget Get
tags:
- Observability
/observability/deps:
get:
summary: Observability Deps
description: 'Return dependency-graph validation status for current tasks.
The response names the ids it walked - the ready set, the critical path,
and both broken-edge lists - so the walk is narrowed to the caller''s
tenant scope rather than the whole store.'
operationId: observability_deps_observability_deps_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Observability Deps Observability Deps Get
tags:
- Observability
/observability/token-histogram:
get:
summary: Token Histogram
description: 'Return histogram of token usage by task complexity.
Shows average tokens consumed for small, medium, large tasks.
Helps understand token consumption patterns.'
operationId: token_histogram_observability_token_histogram_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Token Histogram Observability Token Histogram Get
tags:
- Observability
/observability/queue-depth:
get:
summary: Get Queue Depth
description: 'Return task queue depth over time.
Returns last N records of queue depth snapshots.
Args:
request: FastAPI request.
limit: Maximum number of records to return (default 100).
Returns:
List of queue depth snapshots with timestamps.'
operationId: get_queue_depth_observability_queue_depth_get
parameters:
- name: limit
in: query
required: false
schema:
type: integer
default: 100
title: Limit
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Get Queue Depth Observability Queue Depth Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Observability
/observability/timeline:
get:
summary: Get Timeline
description: 'Return task timing data for timeline visualization.
Returns start and end times for all tasks tracked in metrics.'
operationId: get_timeline_observability_timeline_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Get Timeline Observability Timeline Get
tags:
- Observability
/observability/incidents:
get:
summary: List Incidents
description: 'List all known incidents.
Returns:
Dict with ''incidents'' list.'
operationId: list_incidents_observability_incidents_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response List Incidents Observability Incidents Get
tags:
- Observability
/observability/incident-timeline/{incident_id}:
get:
summary: Get Incident Timeline
description: 'Build a correlated incident timeline from logs, metrics, and traces.
Args:
request: FastAPI request.
incident_id: The incident ID to build a timeline for.
window_before: Seconds before incident to include (default 600).
window_after: Seconds after incident to include (default 300).
Returns:
Dict with incident metadata and sorted timeline events.'
operationId: get_incident_timeline_observability_incident_timeline__incident_id__get
parameters:
- name: incident_id
in: path
required: true
schema:
type: string
title: Incident Id
- name: window_before
in: query
required: false
schema:
type: integer
default: 600
title: Window Before
- name: window_after
in: query
required: false
schema:
type: integer
default: 300
title: Window After
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Get Incident Timeline Observability Incident Timeline Incident Id Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Observability
/observability/token-breakdown:
get:
summary: Token Breakdown
description: 'Return per-session token consumption breakdown.
For each agent session with a ``.tokens`` sidecar file, breaks down
token usage into estimated categories:
- ``system_prompt_estimated``: overhead from Bernstein role templates
- ``task_description_estimated``: tokens for the task title + description
- ``context_estimated``: remaining input tokens (context files, tool results,
prior conversation history, etc.)
- ``output_tokens``: actual assistant output tokens
Also reports ``optimization_opportunities`` - a list of human-readable
insights when a category accounts for an unusually large share of tokens
(e.g. "context files are 60% of input").
Token sidecar files live at ``.sdd/runtime/{session_id}.tokens``.
Breakdown percentages use a 4-chars/token heuristic for size estimates.
Returns:
Dict with ``sessions`` list and aggregate ``summary``.'
operationId: token_breakdown_observability_token_breakdown_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Token Breakdown Observability Token Breakdown Get
tags:
- Observability
/api/v1/observability/agents:
get:
summary: Observability Agents
description: Return runtime heartbeat, stall-profile, and log-summary data per agent.
operationId: observability_agents_api_v1_observability_agents_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Observability Agents Api V1 Observability Agents Get
tags:
- Observability
/api/v1/observability/effectiveness:
get:
summary: Observability Effectiveness
description: Return recent effectiveness data, role trends, and best configs.
operationId: observability_effectiveness_api_v1_observability_effectiveness_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Observability Effectiveness Api V1 Observability Effectiveness Get
tags:
- Observability
/api/v1/observability/recommendations:
get:
summary: Observability Recommendations
description: Return the current recommendation set and delivery hit counts.
operationId: observability_recommendations_api_v1_observability_recommendations_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Observability Recommendations Api V1 Observability Recommendations Get
tags:
- Observability
/api/v1/observability/budget:
get:
summary: Observability Budget
description: Return completion-budget status per lineage.
operationId: observability_budget_api_v1_observability_budget_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Observability Budget Api V1 Observability Budget Get
tags:
- Observability
/api/v1/observability/deps:
get:
summary: Observability Deps
description: 'Return dependency-graph validation status for current tasks.
The response names the ids it walked - the ready set, the critical path,
and both broken-edge lists - so the walk is narrowed to the caller''s
tenant scope rather than the whole store.'
operationId: observability_deps_api_v1_observability_deps_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Observability Deps Api V1 Observability Deps Get
tags:
- Observability
/api/v1/observability/token-histogram:
get:
summary: Token Histogram
description: 'Return histogram of token usage by task complexity.
Shows average tokens consumed for small, medium, large tasks.
Helps understand token consumption patterns.'
operationId: token_histogram_api_v1_observability_token_histogram_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Token Histogram Api V1 Observability Token Histogram Get
tags:
- Observability
/api/v1/observability/queue-depth:
get:
summary: Get Queue Depth
description: 'Return task queue depth over time.
Returns last N records of queue depth snapshots.
Args:
request: FastAPI request.
limit: Maximum number of records to return (default 100).
Returns:
List of queue depth snapshots with timestamps.'
operationId: get_queue_depth_api_v1_observability_queue_depth_get
parameters:
- name: limit
in: query
required: false
schema:
type: integer
default: 100
title: Limit
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Get Queue Depth Api V1 Observability Queue Depth Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Observability
/api/v1/observability/timeline:
get:
summary: Get Timeline
description: 'Return task timing data for timeline visualization.
Returns start and end times for all tasks tracked in metrics.'
operationId: get_timeline_api_v1_observability_timeline_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Get Timeline Api V1 Observability Timeline Get
tags:
- Observability
/api/v1/observability/incidents:
get:
summary: List Incidents
description: 'List all known incidents.
Returns:
Dict with ''incidents'' list.'
operationId: list_incidents_api_v1_observability_incidents_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response List Incidents Api V1 Observability Incidents Get
tags:
- Observability
/api/v1/observability/incident-timeline/{incident_id}:
get:
summary: Get Incident Timeline
description: 'Build a correlated incident timeline from logs, metrics, and traces.
Args:
request: FastAPI request.
incident_id: The incident ID to build a timeline for.
window_before: Seconds before incident to include (default 600).
window_after: Seconds after incident to include (default 300).
Returns:
Dict with incident metadata and sorted timeline events.'
operationId: get_incident_timeline_api_v1_observability_incident_timeline__incident_id__get
parameters:
- name: incident_id
in: path
required: true
schema:
type: string
title: Incident Id
- name: window_before
in: query
required: false
schema:
type: integer
default: 600
title: Window Before
- name: window_after
in: query
required: false
schema:
type: integer
default: 300
title: Window After
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Get Incident Timeline Api V1 Observability Incident Timeline Incident Id Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Observability
/api/v1/observability/token-breakdown:
get:
summary: Token Breakdown
description: 'Return per-session token consumption breakdown.
For each agent session with a ``.tokens`` sidecar file, breaks down
token usage into estimated categories:
- ``system_prompt_estimated``: overhead from Bernstein role templates
- ``task_description_estimated``: tokens for the task title + description
- ``context_estimated``: remaining input tokens (context files, tool results,
prior conversation history, etc.)
- ``output_tokens``: actual assistant output tokens
Also reports ``optimization_opportunities`` - a list of human-readable
insights when a category accounts for an unusually large share of tokens
(e.g. "context files are 60% of input").
Token sidecar files live at ``.sdd/runtime/{session_id}.tokens``.
Breakdown percentages use a 4-chars/token heuristic for size estimates.
Returns:
Dict with ``sessions`` list and aggregate ``summary``.'
operationId: token_breakdown_api_v1_observability_token_breakdown_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Token Breakdown Api V1 Observability Token Breakdown Get
tags:
- Observability
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