> ## Documentation Index
> Fetch the complete documentation index at: https://docs.errorbar.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Mid-run anchor check

> Submit the current policy's outputs on your FROZEN anchor prompt set (same request ids every time). The server scores them with the session's reward AND the independent anchor judge (corrected for its measured error), appends the point to the session's history, and decides: reward up ≥ 10 points over the last three checks while the anchor moves ≤ 2, or the anchor ≥ 10 points below its best, HOLDS the session. Held sessions refuse scoring (409) until a human resumes them; `pinned_step` is the checkpoint to ship. Points with fewer than 20 gradable prompts hold nothing (`underpowered` says so). Hold, never kill.



## OpenAPI

````yaml /openapi.json post /v1/reward/sessions/{id}/anchor
openapi: 3.1.0
info:
  title: errorbar Management API
  description: >-
    The management API behind the improvement loop: capture and setup, request
    logs and datasets, grades (labels), judges (criteria), evals and deploy
    gates, fine-tuning and reinforcement learning, dedicated GPU endpoints, and
    model aliases and versions. Authenticated with a workspace API key
    (sk_sovereign_...). The inference API (chat, embeddings, rerank, responses)
    is OpenAI-compatible and documented separately.


    Responses are snake_case, list endpoints on the loop products use the
    {"object": "list", "data": [...]} envelope, and refusals use the same nested
    error shape the gateway emits: {"error": {"message", "type", "code"}}.
    Request bodies on the loop products (logs, labels, criteria, evals,
    datasets, aliases) are snake_case; the training and infrastructure products
    (fine-tuning, GRPO, environment tools, dedicated, model-version adoption)
    validate camelCase bodies, and each schema below says which it is. Endpoints
    that spend money require a key minted by a workspace owner or admin and
    return 403 otherwise.
  version: 1.0.0
servers:
  - url: https://gateway.errorbar.ai
    description: Production
  - url: https://www.errorbar.ai/api
    description: Control plane (also served at this base URL)
security:
  - bearerAuth: []
tags:
  - name: Certified reward
    description: >-
      The certified reward for your own trainer: sessions with judge
      certificates, scoring with a ledger-true kill switch, and the mid-run
      anchor that holds a run when the reward diverges from an independent
      judge.
paths:
  /v1/reward/sessions/{id}/anchor:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
    post:
      tags:
        - Certified reward
      summary: Mid-run anchor check
      description: >-
        Submit the current policy's outputs on your FROZEN anchor prompt set
        (same request ids every time). The server scores them with the session's
        reward AND the independent anchor judge (corrected for its measured
        error), appends the point to the session's history, and decides: reward
        up ≥ 10 points over the last three checks while the anchor moves ≤ 2, or
        the anchor ≥ 10 points below its best, HOLDS the session. Held sessions
        refuse scoring (409) until a human resumes them; `pinned_step` is the
        checkpoint to ship. Points with fewer than 20 gradable prompts hold
        nothing (`underpowered` says so). Hold, never kill.
      operationId: anchorCheck
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - step
                - items
              properties:
                step:
                  type: string
                  pattern: ^[A-Za-z0-9_.-]{1,40}$
                items:
                  type: array
                  minItems: 1
                  maxItems: 64
                  items:
                    $ref: '#/components/schemas/RewardItem'
      responses:
        '200':
          description: The verdict for this check.
          content:
            application/json:
              schema:
                type: object
                properties:
                  session_id:
                    type: string
                  held:
                    type: boolean
                  reason:
                    type:
                      - string
                      - 'null'
                  pinned_step:
                    type:
                      - string
                      - 'null'
                  point:
                    $ref: '#/components/schemas/AnchorPoint'
                  underpowered:
                    type:
                      - string
                      - 'null'
                  history:
                    type: array
                    items:
                      $ref: '#/components/schemas/AnchorPoint'
                  spend_micros:
                    type: string
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientBalance'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: 'Already held (`code: held`).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: The session has no anchor, or its anchor judge no longer exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    RewardItem:
      type: object
      required:
        - requestId
        - conversation
      properties:
        requestId:
          type: string
          maxLength: 200
          description: >-
            Your id for the rollout; re-sending the same (step, requestId)
            settles into the same ledger rows.
        conversation:
          type: string
          description: The prompt/conversation the policy answered.
        response:
          type: string
          description: Single-turn completion (omit when sending steps).
        steps:
          type: array
          maxItems: 200
          items:
            type: object
            required:
              - role
              - content
            properties:
              role:
                type: string
                enum:
                  - assistant
                  - tool
              content:
                type: string
              source:
                type: string
                enum:
                  - code
                  - recorded
                  - declared
                  - simulated
                  - flagged
              toolName:
                type: string
          description: >-
            Agentic sessions: the whole rollout as structured steps; the server
            renders and sanitises it through the same instrument trace
            calibration uses.
        sessionId:
          type: string
          description: >-
            The episode's errorbar environment session id (exec verifiers +
            attestation).
    AnchorPoint:
      type: object
      properties:
        step:
          type: string
        at:
          type: string
          format: date-time
        'n':
          type: integer
          description: Prompts both the reward and the anchor judge could grade.
        reward_rate:
          type: number
          description: >-
            Mean composite grade under the session's reward on the anchor
            outputs — the signal being optimised.
        anchor_rate:
          type: number
          description: >-
            The independent anchor judge's pass rate, corrected for its measured
            error (Lang–Reiczigel) when the criterion carries report counts.
        anchor_ci:
          type: array
          items:
            type: number
          minItems: 2
          maxItems: 2
        anchor_corrected:
          type: boolean
        masked:
          type: integer
          description: Items the anchor judge could not parse — counted in neither rate.
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
              description: >-
                invalid_request_error, insufficient_quota, rate_limit_error, or
                api_error.
            code:
              type: string
              description: >-
                Machine-stable cause, e.g. invalid_api_key, not_found,
                insufficient_permissions, precondition_failed.
          required:
            - message
            - type
            - code
      description: >-
        Every refusal — gateway and management API alike — uses this one
        envelope.
  responses:
    BadRequest:
      description: Malformed request or invalid field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing, malformed, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Invalid API key
              type: invalid_request_error
              code: invalid_api_key
    InsufficientBalance:
      description: Your wallet can't cover the required prepaid runway.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: >-
                Insufficient balance: deploying this endpoint requires at least
                1h of runway. Top up and try again.
              type: insufficient_quota
              code: insufficient_balance
    NotFound:
      description: The resource does not exist in your workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your workspace API key, e.g. `sk_sovereign_...`, sent as `Authorization:
        Bearer <key>`.

````