{
  "openapi": "3.1.0",
  "info": {
    "title": "Evals API",
    "version": "1.1.0",
    "description": "HTTP API for Evals: analytics, Evaluations, datasets, runs, monitors, criteria, traces, feedback, judges and scorecards. Every endpoint needs a task API key with the `evals:read` capability; the endpoints that change something (POST, PUT, PATCH) need `evals:write` too, which the key's owner grants when creating the key. The organization comes from the key, and a request that names `orgId` is refused. A key reads and changes exactly what its owner can in the app, no more. A member without Evals access reads only traces of agents they own. A key limited to specific agents reads only those agents' traces and is refused (403) on every other endpoint except `/feedback/enabled` and `/feedback/schemas`. Send an `Idempotency-Key` header on creates and run starts you might retry."
  },
  "servers": [
    {
      "url": "https://{deployment}/api/v1/evals",
      "description": "Your Context deployment",
      "variables": {
        "deployment": {
          "default": "context.example.com",
          "description": "The host your organization signs in to"
        }
      }
    }
  ],
  "security": [
    {
      "TaskApiKey": []
    },
    {
      "TaskApiKeyHeader": []
    }
  ],
  "tags": [
    {
      "name": "Analytics",
      "description": "An analytics record is one piece of agent work in the organization: a root task, a sub-agent task or a dispatch run, with its cost, outcome and feedback. These are the reads behind the app's Tasks list, with its filters, overview charts and export. An organization admin, or a person with analytics access, reads every record; a workspace admin reads the records in the workspaces they administer, and another member with Evals access reads the ones they created or their own agents ran."
    },
    {
      "name": "Evaluations",
      "description": "An evaluation measures how well agents answer, and has two kinds: a benchmark runs a fixed set of dataset tasks when you ask, and a monitor grades a sample of real requests as they finish (see Monitors). The endpoints under `/benchmarks` handle benchmarks. A benchmark tests one axis (model, skill or agent), compares one or more values on it, holds the rest fixed, and can set a pass threshold from 0 to 100. It has no criteria of its own: the criteria of its linked datasets grade each run."
    },
    {
      "name": "Datasets",
      "description": "A dataset is a set of dataset tasks that a benchmark runs; the HTTP API calls a dataset task an item (`/items/{taskId}`). A dataset task holds a prompt, an optional expected answer, optional input files the agent reads and optional expected files that only the criteria open, never the agent being tested. Changes to tasks and criteria land in the dataset's working copy, and a run grades the latest saved version, so save a version before you start a run that should include them. Archived datasets and tasks are not returned."
    },
    {
      "name": "Runs",
      "description": "A run is one execution of a benchmark over each linked dataset's latest saved version. It freezes the benchmark's axes when it starts and runs every dataset task once per cell, where a cell is one value of the tested axis at one repeat (1 to 5 repeats). Its status is `PENDING`, `RUNNING` or `EVALUATING` while it works, then `COMPLETED`, `FAILED` or `STOPPED`; a stored status this API does not recognize reads `UNKNOWN`."
    },
    {
      "name": "Feedback",
      "description": "Feedback is what people say about an agent's answer (a score, a yes or no, a comment, or a mix of them), given on a whole task, one message or a selected part of a message. People give it against scorecards, and these endpoints read it; none of them writes feedback. Reading entries needs Evals access, while `/feedback/enabled` and `/feedback/schemas` are open to any member of the organization."
    },
    {
      "name": "Judges",
      "description": "A judge is an LLM judge in the organization's library: instructions, a model and an output type (`FLOAT` for a 1 to 5 score, `BOOLEAN` for pass or fail, `TEXT` for a free-form answer). Scorecards and monitors use judges. `SYSTEM` judges are built in, shared by every organization and can't be changed; `USER` judges belong to one organization."
    },
    {
      "name": "Scorecards",
      "description": "A scorecard groups judges, in order, into the form people fill in when they give feedback; some of its judges can be required. It applies where one of its scopes matches (an organization, workspace or user, where an empty field matches any), applies everywhere when it has no scopes, and reaches the feedback panel only while it is active. This API serves automatic scorecards (`kind` `auto`) read-only; skill rubrics are never served, and a skill rubric's ID answers 404."
    },
    {
      "name": "Criteria",
      "description": "A criterion grades an answer. A dataset criterion is an LLM judge (`llm_judge`), an agent judge (`agent_judge`, an agent that can open the task's files), a Python check (`code_verifier`, your code returns a pass or fail or a score from 0 to 1) or an exact match (`exact_match`). A dataset's own criteria grade every dataset task in it; shared criteria live in the organization's library, where a monitor binds them by ID. A Python check on a dataset needs an administrator to turn Python checks on, and a monitor can't use exact match."
    },
    {
      "name": "Monitors",
      "description": "A monitor is the evaluation that grades a sample of real requests as they finish. It watches 1 to 50 targets (each an agent, skill, applet or Evals workflow at a sample percentage from 1 to 100, or every trace in the organization), grades with 1 to 50 criteria, and passes a request whose weighted score reaches its pass mark, from 0 to 1. A monitor is on or paused, and each change names the `revision` it read, so a change made after someone else's is refused with 409. Monitors need Monitoring turned on for the organization; until then these endpoints answer 403."
    },
    {
      "name": "Targets",
      "description": "A target is what an evaluation is shown on or a monitor watches: an agent, a skill, an applet or an Evals workflow. These endpoints list the live ones a page at a time, with the IDs to pass as `targetId`. Listing Evals workflows needs Workflows turned on for the organization and a key with `evals:write` whose owner is an organization owner or admin."
    },
    {
      "name": "Traces",
      "description": "A trace session is one conversation with an agent, with every model call, its tokens, cost and errors; traces cover all agent work, not only evaluation runs. The session, call and histogram reads cut a range longer than 90 days (the deployment's default limit) to its most recent 90 days. An organization admin reads every trace, a workspace admin the traces in the workspaces they administer, and anyone else the traces of agents they own and their own chats. The cost dashboard needs organization-wide trace access."
    }
  ],
  "components": {
    "securitySchemes": {
      "TaskApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "tsk_<prefix>_<secret>",
        "description": "A task API key with the `evals:read` capability. Create one in the app under Settings > API > Task keys."
      },
      "TaskApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "The same task API key, sent in the `X-API-Key` header instead."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "What went wrong, in words."
          },
          "code": {
            "type": "string",
            "description": "A stable code for some errors, for example `TASK_CAPABILITY_MISSING` or `INVALID_CURSOR`."
          },
          "details": {
            "type": "array",
            "description": "On `400`: one entry per invalid parameter.",
            "items": {
              "type": "object",
              "required": [
                "path",
                "message"
              ],
              "properties": {
                "path": {
                  "type": "string",
                  "description": "The parameter's name; a nested field is joined with dots, for example `filters.0.field`."
                },
                "message": {
                  "type": "string",
                  "description": "What is wrong with it."
                }
              }
            }
          }
        }
      },
      "RateLimited": {
        "type": "object",
        "required": [
          "ok",
          "error",
          "scope",
          "retryAfterMs"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "error": {
            "type": "string",
            "enum": [
              "rate_limited"
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "principal"
            ]
          },
          "retryAfterMs": {
            "type": "integer",
            "minimum": 0,
            "description": "Milliseconds until the key may send again."
          }
        }
      }
    }
  },
  "paths": {
    "/analytics/records": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "List analytics records",
        "description": "Paginated analytics records (root tasks, sub-agent tasks, and dispatch runs), with filters.",
        "operationId": "listAnalyticsRecords",
        "parameters": [
          {
            "in": "query",
            "name": "agentIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`agentIds=[\"a\",\"b\"]`) or repeat the key (`agentIds=a&agentIds=b`). A single plain value (`agentIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "workspaceIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`workspaceIds=[\"a\",\"b\"]`) or repeat the key (`workspaceIds=a&workspaceIds=b`). A single plain value (`workspaceIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "workspaceTagIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`workspaceTagIds=[\"a\",\"b\"]`) or repeat the key (`workspaceTagIds=a&workspaceTagIds=b`). A single plain value (`workspaceTagIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "sourceType",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "scheduled",
                "api",
                "internal-api",
                "prewarmed",
                "local-device",
                "agent-brain",
                "subagent"
              ],
              "description": "Started from: keep only records that started on this source (a task source type, or `subagent` for tasks started by another task)."
            }
          },
          {
            "in": "query",
            "name": "usedFrom",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "web",
                  "mobile",
                  "cli",
                  "api",
                  "excel",
                  "word",
                  "powerpoint"
                ],
                "description": "An interface a task was used from: `web` (the web app and the desktop app), `mobile` (the native mobile app), `cli` (the `context-code` terminal on a paired machine), `api` (the Task API with your own key), or `excel` / `word` / `powerpoint` (the Context add-in's pane inside that Office application). The platform's own automation is not an interface."
              },
              "minItems": 1,
              "description": "Used from: keep only tasks a person acted on through ANY of these interfaces (a turn sent from the app, a run driven by a paired machine, or where the task started). Send a JSON list in one value (`usedFrom=[\"a\",\"b\"]`) or repeat the key (`usedFrom=a&usedFrom=b`). A single plain value (`usedFrom=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "viewedFrom",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "task_route",
                  "shared_link",
                  "eval_analytics",
                  "context_code",
                  "eval_project"
                ]
              },
              "minItems": 1,
              "description": "Viewed from: keep only records a person opened the conversation of on ANY of these surfaces, as the record's own view summary reports them (task_view.source). A record with no recorded view on any chosen surface is dropped, including one whose views were never measured. Send a JSON list in one value (`viewedFrom=[\"a\",\"b\"]`) or repeat the key (`viewedFrom=a&viewedFrom=b`). A single plain value (`viewedFrom=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "userIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`userIds=[\"a\",\"b\"]`) or repeat the key (`userIds=a&userIds=b`). A single plain value (`userIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "email",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "Case-insensitive substring matched against the owning user's email, to narrow results to one person."
            }
          },
          {
            "in": "query",
            "name": "countries",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`countries=[\"a\",\"b\"]`) or repeat the key (`countries=a&countries=b`). A single plain value (`countries=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "taskOpencodeBranchId",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "skillIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`skillIds=[\"a\",\"b\"]`) or repeat the key (`skillIds=a&skillIds=b`). A single plain value (`skillIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "workflowIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "minItems": 1,
              "maxItems": 50,
              "description": "Workflow ids. A record matches when its chat is classified into any of them. Send a JSON list in one value (`workflowIds=[\"a\",\"b\"]`) or repeat the key (`workflowIds=a&workflowIds=b`). A single plain value (`workflowIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "errorMessage",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "Case-insensitive substring matched against the error messages of calls in the record's own chat (the same filter the app's Traces view offers). A record with no chat never matches."
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "minRating",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 5
            }
          },
          {
            "in": "query",
            "name": "maxRating",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 5
            }
          },
          {
            "in": "query",
            "name": "hasFeedback",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "Case-insensitive substring matched against the task title (a dispatch run matches on its task's title, otherwise its prompt). A task with no title of its own matches on its latest dispatch run's title or prompt, the same fallback the list shows."
            }
          },
          {
            "in": "query",
            "name": "statuses",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "completed",
                  "failed",
                  "running",
                  "pending",
                  "cancelled",
                  "archived"
                ],
                "description": "A status from the status breakdown: `completed` (Completed or Succeeded), `failed`, `running` (Queued or Running), `pending`, `cancelled`, or `archived`."
              },
              "minItems": 1,
              "description": "Keep only records whose current status (as shown in the status breakdown) is ANY of these. Send a JSON list in one value (`statuses=[\"a\",\"b\"]`) or repeat the key (`statuses=a&statuses=b`). A single plain value (`statuses=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "origins",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "evaluation-run",
                  "judge",
                  "skill-learning-replay",
                  "production"
                ],
                "description": "What started a chat: an Evaluation run's task, a judge grading one, a skill-learning replay, or the org's own production work"
              },
              "minItems": 1,
              "description": "Keep only records started by ANY of these kinds of work: `production`, `evaluation-run`, `judge`, or `skill-learning-replay`. The origin comes from the record's root task: whether an evaluation started it, then whether it runs as the organization's judge agent. Omit to keep every origin. Send a JSON list in one value (`origins=[\"a\",\"b\"]`) or repeat the key (`origins=a&origins=b`). A single plain value (`origins=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Cursor from the previous page's `pageInfo.nextCursor`; stop when `pageInfo.hasNextPage` is false."
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Maximum number of top-level records to return. Sub-agent rows shown under those records can make `data.length` larger.",
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "recordId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "recordKind": {
                            "type": "string",
                            "enum": [
                              "task",
                              "dispatchRun"
                            ]
                          },
                          "recordType": {
                            "type": "string",
                            "enum": [
                              "rootTask",
                              "subAgent",
                              "dispatchRun"
                            ],
                            "description": "Kind of record: `rootTask`, `subAgent`, or `dispatchRun`."
                          },
                          "taskId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "parentTaskId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Parent task ID when this row is a sub-agent task; null for root tasks and standalone dispatch runs."
                          },
                          "runId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "taskOpencodeBranchId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sourceType": {
                            "type": "string",
                            "enum": [
                              "manual",
                              "scheduled",
                              "api",
                              "internal-api",
                              "prewarmed",
                              "local-device",
                              "agent-brain",
                              "subagent"
                            ],
                            "description": "Where the record started: one of the task source types, or `subagent` for child tasks started by another task."
                          },
                          "title": {
                            "type": "string",
                            "minLength": 1
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "taskStatus": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "active",
                              "completed",
                              "failed",
                              "archived",
                              null
                            ]
                          },
                          "latestRunStatus": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "queued",
                              "running",
                              "succeeded",
                              "failed",
                              "cancelled",
                              null
                            ]
                          },
                          "displayStatus": {
                            "type": "string",
                            "minLength": 1
                          },
                          "user": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1
                              },
                              "email": {
                                "type": "string",
                                "format": "email"
                              },
                              "country": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "label",
                              "email"
                            ],
                            "additionalProperties": false
                          },
                          "agent": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "id",
                              "label"
                            ],
                            "additionalProperties": false
                          },
                          "workspace": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "workspaceTag": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "messageCount": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0
                          },
                          "userMessageCount": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Number of user-written messages in the task's latest archived conversation; null (not 0) when the task has no archived conversation."
                          },
                          "skillsUsed": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "items": {
                              "type": "string"
                            }
                          },
                          "skillsUsedDetails": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "id",
                                "label"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "connectorsAttached": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "id",
                                "label"
                              ],
                              "additionalProperties": false
                            },
                            "description": "MCP connectors attached to the record's agent (including the organization's custom connectors on the agent's list or covered by its All connectors setting), as connector names sorted by label; null when the agent has none. Attachments are not recorded per run, so this shows the agent's connectors at the time you read it, not when the record ran."
                          },
                          "metrics": {
                            "type": "object",
                            "properties": {
                              "runCount": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "inputFiles": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "outputFiles": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "attempts": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "totalTokens": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "minimum": 0,
                                "description": "Billed tokens (input + output + reasoning + cache write + cache read) summed across the record's LLM calls in trace data. Null when the record has no chat, there is no trace data for it, or trace data cannot be read."
                              }
                            },
                            "required": [
                              "runCount",
                              "inputFiles",
                              "outputFiles",
                              "attempts",
                              "totalTokens"
                            ],
                            "additionalProperties": false
                          },
                          "taskViews": {
                            "type": "object",
                            "properties": {
                              "viewCount": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "minimum": 0,
                                "description": "Recorded opens of this task's conversation across every surface that records views. Null (not 0) when views were never measured for this record (see `unmeasuredReason`)."
                              },
                              "unmeasuredReason": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "enum": [
                                  "no-view-key",
                                  "predates-instrumentation",
                                  null
                                ],
                                "description": "Why `viewCount` is null. Null whenever `viewCount` is a real measurement, including a real zero."
                              },
                              "lastViewedAt": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "lastViewedBy": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "label": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "email": {
                                    "type": "string",
                                    "format": "email"
                                  },
                                  "country": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "label",
                                  "email"
                                ],
                                "additionalProperties": false
                              },
                              "viewedFrom": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "task_route",
                                    "shared_link",
                                    "eval_analytics",
                                    "context_code",
                                    "eval_project"
                                  ]
                                },
                                "description": "Distinct surfaces where a person opened this record's conversation, in the enum's order. Empty when `viewCount` is null or 0: a surface appears only when at least one view was recorded on it."
                              }
                            },
                            "required": [
                              "viewCount",
                              "unmeasuredReason",
                              "lastViewedAt",
                              "lastViewedBy",
                              "viewedFrom"
                            ],
                            "additionalProperties": false,
                            "description": "View measurement for an analytics record (a task, or a standalone dispatch run matched by its chat)."
                          },
                          "feedbackSummary": {
                            "type": "object",
                            "properties": {
                              "count": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Number of feedback submissions on this record"
                              },
                              "avgRating": {
                                "type": [
                                  "number",
                                  "null"
                                ],
                                "minimum": 1,
                                "maximum": 5,
                                "description": "Mean numeric rating on the 1 to 5 scale, or null when there is no numeric rating"
                              },
                              "maxRating": {
                                "type": [
                                  "number",
                                  "null"
                                ],
                                "minimum": 1,
                                "maximum": 5,
                                "description": "Highest numeric rating on the 1 to 5 scale, or null when there is no numeric rating"
                              },
                              "withTextCount": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Number of submissions with a non-empty comment"
                              }
                            },
                            "required": [
                              "count",
                              "avgRating",
                              "maxRating",
                              "withTextCount"
                            ],
                            "additionalProperties": false,
                            "description": "Feedback summary for one task, run, or trace session"
                          },
                          "execution": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "traced"
                                    ]
                                  },
                                  "sessionIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "minItems": 1,
                                    "description": "The chat's trace sessions, latest first."
                                  },
                                  "model": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "minLength": 1,
                                    "description": "The model that served the most calls in the chat; null when no call named a model"
                                  },
                                  "models": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "description": "Every named model in the chat, most calls first; empty when no call named a model"
                                  },
                                  "callCount": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "tokens": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "description": "Billed tokens (input + output + reasoning + cache write + cache read) across the chat's own calls"
                                  },
                                  "durationMs": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "description": "Total duration of the chat's own calls, in milliseconds"
                                  },
                                  "errorCount": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "description": "Number of calls that ended unsuccessfully"
                                  },
                                  "estimatedCostUsd": {
                                    "type": [
                                      "number",
                                      "null"
                                    ],
                                    "minimum": 0,
                                    "description": "Estimated cost summed over the chat's calls. An estimate, not the bill: the billed amount is `billedCost`. Null when no call reported a cost."
                                  },
                                  "errorMessageSample": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "minLength": 1,
                                    "description": "The error message of one failed call (aborted calls excluded); null when no failed call had one"
                                  },
                                  "lastActivityAt": {
                                    "type": "string",
                                    "description": "Time of the chat's latest call (ISO 8601)"
                                  },
                                  "subagents": {
                                    "type": [
                                      "object",
                                      "null"
                                    ],
                                    "properties": {
                                      "count": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "description": "Number of sub-agent rows on this page grouped under the parent"
                                      },
                                      "tokens": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "description": "Billed tokens of the grouped sub-agent chats"
                                      },
                                      "estimatedCostUsd": {
                                        "type": [
                                          "number",
                                          "null"
                                        ],
                                        "minimum": 0,
                                        "description": "Estimated cost of the grouped sub-agent chats; null when none of them reported one"
                                      },
                                      "errorCount": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "description": "Number of unsuccessful calls in the grouped sub-agent chats"
                                      }
                                    },
                                    "required": [
                                      "count",
                                      "tokens",
                                      "estimatedCostUsd",
                                      "errorCount"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Totals for the grouped sub-agent rows; null when the row has no sub-agent rows on this page"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "sessionIds",
                                  "model",
                                  "models",
                                  "callCount",
                                  "tokens",
                                  "durationMs",
                                  "errorCount",
                                  "estimatedCostUsd",
                                  "errorMessageSample",
                                  "lastActivityAt",
                                  "subagents"
                                ],
                                "additionalProperties": false,
                                "description": "Execution data is available: the chat has trace data."
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "none"
                                    ]
                                  },
                                  "reason": {
                                    "type": "string",
                                    "enum": [
                                      "no_chat_id",
                                      "no_trace_rows",
                                      "trace_store_unavailable"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind",
                                  "reason"
                                ],
                                "additionalProperties": false,
                                "description": "The row has no execution data; `reason` says why."
                              }
                            ],
                            "description": "Execution data for a task row, taken from the chat's trace data"
                          },
                          "billedCost": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "known"
                                    ]
                                  },
                                  "costUsdMicros": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "description": "Billed model spend in millionths of a US dollar, read from billing records (never recalculated)"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "costUsdMicros"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "unknown"
                                    ]
                                  },
                                  "reason": {
                                    "type": "string",
                                    "enum": [
                                      "ledger_not_final",
                                      "device_calls_unbounded",
                                      "no_rows",
                                      "unrated_rows",
                                      "ledger_unavailable"
                                    ],
                                    "description": "Why the billed cost is unavailable. `ledger_not_final`: billing for the run is not final, or the run can still be billed for a call. `device_calls_unbounded`: a run ran on a paired machine, whose spend is never reported as final. `no_rows`: there is no billing record for it. `unrated_rows`: a billing record has no rated cost. `ledger_unavailable`: billing records could not be read."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "reason"
                                ],
                                "additionalProperties": false
                              }
                            ],
                            "description": "The billed cost of a task row, the same figure Settings › Usage shows"
                          },
                          "workflows": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "id",
                                "label"
                              ],
                              "additionalProperties": false
                            },
                            "description": "Workflows the record's chat is classified into. `[]` when the chat is unclassified; null when classifications could not be read."
                          },
                          "origin": {
                            "type": "string",
                            "enum": [
                              "evaluation-run",
                              "judge",
                              "skill-learning-replay",
                              "production"
                            ],
                            "description": "The kind of work that started the record, taken from its chat's root task: whether an evaluation started it, then whether it runs as the organization's judge agent. A sub-agent takes its root's origin. A dispatch run whose chat has no task is judged on its own. This is the same rule the `origins` filter uses."
                          }
                        },
                        "required": [
                          "recordId",
                          "recordKind",
                          "recordType",
                          "taskId",
                          "parentTaskId",
                          "runId",
                          "taskOpencodeBranchId",
                          "sourceType",
                          "title",
                          "createdAt",
                          "taskStatus",
                          "latestRunStatus",
                          "displayStatus",
                          "user",
                          "agent",
                          "workspace",
                          "workspaceTag",
                          "messageCount",
                          "userMessageCount",
                          "skillsUsed",
                          "skillsUsedDetails",
                          "connectorsAttached",
                          "metrics",
                          "taskViews",
                          "feedbackSummary",
                          "execution",
                          "billedCost",
                          "workflows",
                          "origin"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pageInfo": {
                      "type": "object",
                      "properties": {
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Cursor for fetching the next page; pass it as `cursor`"
                        },
                        "hasNextPage": {
                          "type": "boolean",
                          "description": "Whether another page exists for the current filters"
                        }
                      },
                      "required": [
                        "nextCursor",
                        "hasNextPage"
                      ],
                      "additionalProperties": false,
                      "description": "Cursor pagination state"
                    }
                  },
                  "required": [
                    "data",
                    "pageInfo"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner reads no task analytics in the organization — neither the Evals role (`org:access_evals`) nor the analytics key (`org:access_analytics`). An owner holding only the analytics key reads these routes org-wide and nothing else under /evals.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A workflow or error-message filter could not be applied because the trace store did not answer; retry, or drop that filter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "analytics",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/analytics/records\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode 'limit=50'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/analytics/records\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"limit\": 50},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/analytics/records`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"limit\", \"50\")\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/analytics/overview": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get the analytics overview",
        "description": "Summary cards plus chart series for the records matching the filters.",
        "operationId": "getAnalyticsOverview",
        "parameters": [
          {
            "in": "query",
            "name": "agentIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`agentIds=[\"a\",\"b\"]`) or repeat the key (`agentIds=a&agentIds=b`). A single plain value (`agentIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "workspaceIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`workspaceIds=[\"a\",\"b\"]`) or repeat the key (`workspaceIds=a&workspaceIds=b`). A single plain value (`workspaceIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "workspaceTagIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`workspaceTagIds=[\"a\",\"b\"]`) or repeat the key (`workspaceTagIds=a&workspaceTagIds=b`). A single plain value (`workspaceTagIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "sourceType",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "scheduled",
                "api",
                "internal-api",
                "prewarmed",
                "local-device",
                "agent-brain",
                "subagent"
              ],
              "description": "Started from: keep only records that started on this source (a task source type, or `subagent` for tasks started by another task)."
            }
          },
          {
            "in": "query",
            "name": "usedFrom",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "web",
                  "mobile",
                  "cli",
                  "api",
                  "excel",
                  "word",
                  "powerpoint"
                ],
                "description": "An interface a task was used from: `web` (the web app and the desktop app), `mobile` (the native mobile app), `cli` (the `context-code` terminal on a paired machine), `api` (the Task API with your own key), or `excel` / `word` / `powerpoint` (the Context add-in's pane inside that Office application). The platform's own automation is not an interface."
              },
              "minItems": 1,
              "description": "Used from: keep only tasks a person acted on through ANY of these interfaces (a turn sent from the app, a run driven by a paired machine, or where the task started). Send a JSON list in one value (`usedFrom=[\"a\",\"b\"]`) or repeat the key (`usedFrom=a&usedFrom=b`). A single plain value (`usedFrom=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "viewedFrom",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "task_route",
                  "shared_link",
                  "eval_analytics",
                  "context_code",
                  "eval_project"
                ]
              },
              "minItems": 1,
              "description": "Viewed from: keep only records a person opened the conversation of on ANY of these surfaces, as the record's own view summary reports them (task_view.source). A record with no recorded view on any chosen surface is dropped, including one whose views were never measured. Send a JSON list in one value (`viewedFrom=[\"a\",\"b\"]`) or repeat the key (`viewedFrom=a&viewedFrom=b`). A single plain value (`viewedFrom=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "userIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`userIds=[\"a\",\"b\"]`) or repeat the key (`userIds=a&userIds=b`). A single plain value (`userIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "email",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "Case-insensitive substring matched against the owning user's email, to narrow results to one person."
            }
          },
          {
            "in": "query",
            "name": "countries",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`countries=[\"a\",\"b\"]`) or repeat the key (`countries=a&countries=b`). A single plain value (`countries=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "taskOpencodeBranchId",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "skillIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`skillIds=[\"a\",\"b\"]`) or repeat the key (`skillIds=a&skillIds=b`). A single plain value (`skillIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "workflowIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "minItems": 1,
              "maxItems": 50,
              "description": "Workflow ids. A record matches when its chat is classified into any of them. Send a JSON list in one value (`workflowIds=[\"a\",\"b\"]`) or repeat the key (`workflowIds=a&workflowIds=b`). A single plain value (`workflowIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "errorMessage",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "Case-insensitive substring matched against the error messages of calls in the record's own chat (the same filter the app's Traces view offers). A record with no chat never matches."
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "minRating",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 5
            }
          },
          {
            "in": "query",
            "name": "maxRating",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 5
            }
          },
          {
            "in": "query",
            "name": "hasFeedback",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "Case-insensitive substring matched against the task title (a dispatch run matches on its task's title, otherwise its prompt). A task with no title of its own matches on its latest dispatch run's title or prompt, the same fallback the list shows."
            }
          },
          {
            "in": "query",
            "name": "statuses",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "completed",
                  "failed",
                  "running",
                  "pending",
                  "cancelled",
                  "archived"
                ],
                "description": "A status from the status breakdown: `completed` (Completed or Succeeded), `failed`, `running` (Queued or Running), `pending`, `cancelled`, or `archived`."
              },
              "minItems": 1,
              "description": "Keep only records whose current status (as shown in the status breakdown) is ANY of these. Send a JSON list in one value (`statuses=[\"a\",\"b\"]`) or repeat the key (`statuses=a&statuses=b`). A single plain value (`statuses=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "origins",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "evaluation-run",
                  "judge",
                  "skill-learning-replay",
                  "production"
                ],
                "description": "What started a chat: an Evaluation run's task, a judge grading one, a skill-learning replay, or the org's own production work"
              },
              "minItems": 1,
              "description": "Keep only records started by ANY of these kinds of work: `production`, `evaluation-run`, `judge`, or `skill-learning-replay`. The origin comes from the record's root task: whether an evaluation started it, then whether it runs as the organization's judge agent. Omit to keep every origin. Send a JSON list in one value (`origins=[\"a\",\"b\"]`) or repeat the key (`origins=a&origins=b`). A single plain value (`origins=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "summary": {
                      "type": "object",
                      "properties": {
                        "totalTasks": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of top-level task records matching the filters; sub-agent tasks are excluded"
                        },
                        "totalRecords": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "totalUsers": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "avgRating": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "feedbackRate": {
                          "type": "number",
                          "minimum": 0
                        },
                        "totalFeedback": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "skillsCreated": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Skills created in the organization within the from/to date window (system skills excluded). Only the organization and date filters apply: a skill is not a task, so agent, user, and workspace filters do not narrow it."
                        },
                        "billedCost": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "known"
                                  ]
                                },
                                "costUsdMicros": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Billed model spend in millionths of a US dollar, read from billing records (never recalculated)"
                                }
                              },
                              "required": [
                                "kind",
                                "costUsdMicros"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "unknown"
                                  ]
                                },
                                "reason": {
                                  "type": "string",
                                  "enum": [
                                    "ledger_not_final",
                                    "device_calls_unbounded",
                                    "no_rows",
                                    "unrated_rows",
                                    "ledger_unavailable"
                                  ],
                                  "description": "Why the billed cost is unavailable. `ledger_not_final`: billing for the run is not final, or the run can still be billed for a call. `device_calls_unbounded`: a run ran on a paired machine, whose spend is never reported as final. `no_rows`: there is no billing record for it. `unrated_rows`: a billing record has no rated cost. `ledger_unavailable`: billing records could not be read."
                                }
                              },
                              "required": [
                                "kind",
                                "reason"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "description": "Billed model spend of every record matching the filters, from billing records"
                        },
                        "execution": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "known"
                                  ]
                                },
                                "tracedTasks": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Records matching the filters whose chat has trace data"
                                },
                                "tasksWithErrors": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Of those, records with at least one unsuccessful call"
                                }
                              },
                              "required": [
                                "kind",
                                "tracedTasks",
                                "tasksWithErrors"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "unknown"
                                  ]
                                },
                                "reason": {
                                  "type": "string",
                                  "enum": [
                                    "too_many_tasks",
                                    "trace_store_unavailable"
                                  ],
                                  "description": "`too_many_tasks`: the filters match more chats than one trace data read covers (narrow the date window). `trace_store_unavailable`: trace data could not be read."
                                }
                              },
                              "required": [
                                "kind",
                                "reason"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "description": "Execution totals across all records matching the filters, for the Errors tile"
                        }
                      },
                      "required": [
                        "totalTasks",
                        "totalRecords",
                        "totalUsers",
                        "avgRating",
                        "feedbackRate",
                        "totalFeedback",
                        "skillsCreated",
                        "billedCost",
                        "execution"
                      ],
                      "additionalProperties": false
                    },
                    "graphs": {
                      "type": "object",
                      "properties": {
                        "ratingDistributionSeries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "rating": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 5
                              },
                              "recordCount": {
                                "type": "integer",
                                "minimum": 0
                              }
                            },
                            "required": [
                              "rating",
                              "recordCount"
                            ],
                            "additionalProperties": false,
                            "description": "Rating bucket for the overview charts"
                          }
                        },
                        "runsOverTimeSeries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "date": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Date bucket in ISO `YYYY-MM-DD` format"
                              },
                              "recordCount": {
                                "type": "integer",
                                "minimum": 0
                              }
                            },
                            "required": [
                              "date",
                              "recordCount"
                            ],
                            "additionalProperties": false,
                            "description": "Daily record count for the overview charts"
                          }
                        },
                        "topAgentSeries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "agentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "agentLabel": {
                                "type": "string",
                                "minLength": 1
                              },
                              "recordCount": {
                                "type": "integer",
                                "minimum": 0
                              }
                            },
                            "required": [
                              "agentId",
                              "agentLabel",
                              "recordCount"
                            ],
                            "additionalProperties": false,
                            "description": "Top-agent row for the overview charts"
                          }
                        },
                        "topUserSeries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "userId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "userLabel": {
                                "type": "string",
                                "minLength": 1
                              },
                              "recordCount": {
                                "type": "integer",
                                "minimum": 0
                              }
                            },
                            "required": [
                              "userId",
                              "userLabel",
                              "recordCount"
                            ],
                            "additionalProperties": false,
                            "description": "Top-user row for the overview charts"
                          }
                        },
                        "statusBreakdownSeries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string",
                                "minLength": 1
                              },
                              "recordCount": {
                                "type": "integer",
                                "minimum": 0
                              }
                            },
                            "required": [
                              "status",
                              "recordCount"
                            ],
                            "additionalProperties": false,
                            "description": "Status row for the overview charts"
                          }
                        },
                        "countryBreakdownSeries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "countryCode": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1
                              },
                              "recordCount": {
                                "type": "integer",
                                "minimum": 0
                              }
                            },
                            "required": [
                              "countryCode",
                              "recordCount"
                            ],
                            "additionalProperties": false,
                            "description": "Country row for the overview charts"
                          }
                        },
                        "topSkillSeries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "skillName": {
                                "type": "string",
                                "minLength": 1
                              },
                              "recordCount": {
                                "type": "integer",
                                "minimum": 0
                              }
                            },
                            "required": [
                              "skillName",
                              "recordCount"
                            ],
                            "additionalProperties": false,
                            "description": "Top-skill row for the overview charts"
                          }
                        },
                        "skillsCreatedSeries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "creatorId": {
                                "type": "string",
                                "description": "ID of the creator: a user ID, or the agent ID for skills an agent wrote; empty when no creator was recorded"
                              },
                              "creatorType": {
                                "type": "string",
                                "enum": [
                                  "user",
                                  "agent"
                                ],
                                "description": "Whether the creator ID is a user or an agent"
                              },
                              "creatorLabel": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Creator display name, or the raw ID when the creator no longer exists"
                              },
                              "skillCount": {
                                "type": "integer",
                                "minimum": 0
                              }
                            },
                            "required": [
                              "creatorId",
                              "creatorType",
                              "creatorLabel",
                              "skillCount"
                            ],
                            "additionalProperties": false,
                            "description": "Skills-created-by-creator row for the overview"
                          },
                          "description": "Top skill creators in the window, by skill count; same scope as `summary.skillsCreated`"
                        },
                        "costByModelSeries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "modelGroup": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The model that served the calls (the model name as configured on the deployment)"
                              },
                              "costUsdMicros": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Billed spend for those calls, in millionths of a US dollar, from billing records"
                              }
                            },
                            "required": [
                              "modelGroup",
                              "costUsdMicros"
                            ],
                            "additionalProperties": false,
                            "description": "Billed-cost-by-model row for the task charts"
                          },
                          "description": "Billed spend of the filtered records by model, from billing records; empty when billing is not final or cannot be read (see `summary.billedCost`)"
                        }
                      },
                      "required": [
                        "ratingDistributionSeries",
                        "runsOverTimeSeries",
                        "topAgentSeries",
                        "topUserSeries",
                        "statusBreakdownSeries",
                        "countryBreakdownSeries",
                        "topSkillSeries",
                        "skillsCreatedSeries",
                        "costByModelSeries"
                      ],
                      "additionalProperties": false,
                      "description": "All overview chart series for the full set of records matching the filters"
                    }
                  },
                  "required": [
                    "summary",
                    "graphs"
                  ],
                  "additionalProperties": false,
                  "description": "Overview cards plus chart series for the full set of records matching the filters"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner reads no task analytics in the organization — neither the Evals role (`org:access_evals`) nor the analytics key (`org:access_analytics`). An owner holding only the analytics key reads these routes org-wide and nothing else under /evals.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A workflow or error-message filter could not be applied because the trace store did not answer; retry, or drop that filter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "analytics",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/analytics/overview\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/analytics/overview\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/analytics/overview`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/analytics/options": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "List analytics filter values",
        "description": "Values for the analytics filters.",
        "operationId": "getAnalyticsOptions",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "label"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "label"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Started from: the sources present in the organization's records, with labels"
                    },
                    "interfaces": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "label"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Used from: every interface a task can be used from, with labels, in the same order as the export's `usedFrom`. This list is fixed: it includes every interface whether or not the organization has records from it."
                    },
                    "users": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1
                          },
                          "email": {
                            "type": "string",
                            "format": "email"
                          },
                          "country": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "label",
                          "email"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "countries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "label"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "workspaces": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "label"
                        ],
                        "additionalProperties": false
                      },
                      "description": "First page of the organization's workspaces, ordered by name and capped (see `workspacesTruncated`). To find others, search for workspaces in the app."
                    },
                    "workspacesTruncated": {
                      "type": "boolean",
                      "description": "True when the organization has more workspaces than this list holds, so the list is incomplete."
                    },
                    "workspaceTags": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "label"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "skills": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "label"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "agents",
                    "sources",
                    "interfaces",
                    "users",
                    "countries",
                    "workspaces",
                    "workspacesTruncated",
                    "workspaceTags",
                    "skills"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner reads no task analytics in the organization — neither the Evals role (`org:access_evals`) nor the analytics key (`org:access_analytics`). An owner holding only the analytics key reads these routes org-wide and nothing else under /evals.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "analytics",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/analytics/options\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/analytics/options\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/analytics/options`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/analytics/records/export": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Export analytics records",
        "description": "Streams every analytics record matching the filters as line-delimited JSON (`application/x-ndjson`). When `includeFeedback=true` (default), each row has a `feedback` array with one entry per scorecard, holding aggregated criterion responses and free-text comments. Numeric criteria become their average, boolean criteria combine to Yes/No, and multi-valued text criteria are comma-joined. Comments are newline-joined per scorecard in submission order. The app's CSV download uses the same data, with one column per scorecard and criterion pair plus 'Feedback Comments: <scorecard name>' columns. Use `limit` to fetch a sample; omit it to stream the full filtered set.",
        "operationId": "exportAnalyticsRecords",
        "parameters": [
          {
            "in": "query",
            "name": "agentIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`agentIds=[\"a\",\"b\"]`) or repeat the key (`agentIds=a&agentIds=b`). A single plain value (`agentIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "workspaceIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`workspaceIds=[\"a\",\"b\"]`) or repeat the key (`workspaceIds=a&workspaceIds=b`). A single plain value (`workspaceIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "workspaceTagIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`workspaceTagIds=[\"a\",\"b\"]`) or repeat the key (`workspaceTagIds=a&workspaceTagIds=b`). A single plain value (`workspaceTagIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "sourceType",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "scheduled",
                "api",
                "internal-api",
                "prewarmed",
                "local-device",
                "agent-brain",
                "subagent"
              ],
              "description": "Started from: keep only records that started on this source (a task source type, or `subagent` for tasks started by another task)."
            }
          },
          {
            "in": "query",
            "name": "usedFrom",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "web",
                  "mobile",
                  "cli",
                  "api",
                  "excel",
                  "word",
                  "powerpoint"
                ],
                "description": "An interface a task was used from: `web` (the web app and the desktop app), `mobile` (the native mobile app), `cli` (the `context-code` terminal on a paired machine), `api` (the Task API with your own key), or `excel` / `word` / `powerpoint` (the Context add-in's pane inside that Office application). The platform's own automation is not an interface."
              },
              "minItems": 1,
              "description": "Used from: keep only tasks a person acted on through ANY of these interfaces (a turn sent from the app, a run driven by a paired machine, or where the task started). Send a JSON list in one value (`usedFrom=[\"a\",\"b\"]`) or repeat the key (`usedFrom=a&usedFrom=b`). A single plain value (`usedFrom=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "viewedFrom",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "task_route",
                  "shared_link",
                  "eval_analytics",
                  "context_code",
                  "eval_project"
                ]
              },
              "minItems": 1,
              "description": "Viewed from: keep only records a person opened the conversation of on ANY of these surfaces, as the record's own view summary reports them (task_view.source). A record with no recorded view on any chosen surface is dropped, including one whose views were never measured. Send a JSON list in one value (`viewedFrom=[\"a\",\"b\"]`) or repeat the key (`viewedFrom=a&viewedFrom=b`). A single plain value (`viewedFrom=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "userIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`userIds=[\"a\",\"b\"]`) or repeat the key (`userIds=a&userIds=b`). A single plain value (`userIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "email",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "Case-insensitive substring matched against the owning user's email, to narrow results to one person."
            }
          },
          {
            "in": "query",
            "name": "countries",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`countries=[\"a\",\"b\"]`) or repeat the key (`countries=a&countries=b`). A single plain value (`countries=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "taskOpencodeBranchId",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "skillIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Send a JSON list in one value (`skillIds=[\"a\",\"b\"]`) or repeat the key (`skillIds=a&skillIds=b`). A single plain value (`skillIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "workflowIds",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "minItems": 1,
              "maxItems": 50,
              "description": "Workflow ids. A record matches when its chat is classified into any of them. Send a JSON list in one value (`workflowIds=[\"a\",\"b\"]`) or repeat the key (`workflowIds=a&workflowIds=b`). A single plain value (`workflowIds=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "errorMessage",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "Case-insensitive substring matched against the error messages of calls in the record's own chat (the same filter the app's Traces view offers). A record with no chat never matches."
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "minRating",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 5
            }
          },
          {
            "in": "query",
            "name": "maxRating",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 5
            }
          },
          {
            "in": "query",
            "name": "hasFeedback",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "Case-insensitive substring matched against the task title (a dispatch run matches on its task's title, otherwise its prompt). A task with no title of its own matches on its latest dispatch run's title or prompt, the same fallback the list shows."
            }
          },
          {
            "in": "query",
            "name": "statuses",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "completed",
                  "failed",
                  "running",
                  "pending",
                  "cancelled",
                  "archived"
                ],
                "description": "A status from the status breakdown: `completed` (Completed or Succeeded), `failed`, `running` (Queued or Running), `pending`, `cancelled`, or `archived`."
              },
              "minItems": 1,
              "description": "Keep only records whose current status (as shown in the status breakdown) is ANY of these. Send a JSON list in one value (`statuses=[\"a\",\"b\"]`) or repeat the key (`statuses=a&statuses=b`). A single plain value (`statuses=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "origins",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "evaluation-run",
                  "judge",
                  "skill-learning-replay",
                  "production"
                ],
                "description": "What started a chat: an Evaluation run's task, a judge grading one, a skill-learning replay, or the org's own production work"
              },
              "minItems": 1,
              "description": "Keep only records started by ANY of these kinds of work: `production`, `evaluation-run`, `judge`, or `skill-learning-replay`. The origin comes from the record's root task: whether an evaluation started it, then whether it runs as the organization's judge agent. Omit to keep every origin. Send a JSON list in one value (`origins=[\"a\",\"b\"]`) or repeat the key (`origins=a&origins=b`). A single plain value (`origins=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          },
          {
            "in": "query",
            "name": "includeFeedback",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true,
              "description": "When true (default), each row includes aggregated feedback per scorecard in the `feedback` array. When false, the `feedback` array is always empty and the export skips feedback work."
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Optional row limit, useful for fetching a small sample. When omitted, every matching record is streamed."
            }
          },
          {
            "in": "query",
            "name": "columns",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "Optional list of CSV column headers to include. Applies only to the app's CSV download; the JSONL stream always includes every key. When omitted, all columns are included. Send a JSON list in one value (`columns=[\"a\",\"b\"]`) or repeat the key (`columns=a&columns=b`). A single plain value (`columns=a`) is refused with 400."
            },
            "style": "form",
            "explode": true
          }
        ],
        "responses": {
          "200": {
            "description": "Line-delimited JSON: one `AnalyticsExportJsonRow` per line, each ending in a newline, then one final line `{\"recordType\":\"end\",\"rowCount\":<n>}`. A body without that final line was cut off after its last complete row. Rows arrive page by page in the Tasks list's order (newest first, sub-agents under their parent), so you can read them as they arrive.",
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "recordId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Stable analytics record identifier; always present, so exported rows can be matched back to their records"
                    },
                    "recordType": {
                      "type": "string",
                      "enum": [
                        "rootTask",
                        "subAgent",
                        "dispatchRun"
                      ],
                      "description": "Kind of record: `rootTask`, `subAgent`, or `dispatchRun`"
                    },
                    "taskId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Task ID when the record is a task; null for standalone dispatch runs"
                    },
                    "parentTaskId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Parent task ID when this row is a sub-agent task; null for root tasks and standalone dispatch runs"
                    },
                    "runId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Run ID when the record is a dispatch run; null for tasks"
                    },
                    "taskOpencodeBranchId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Chat ID when available; the preferred identifier for building project URLs"
                    },
                    "sourceType": {
                      "type": "string",
                      "enum": [
                        "manual",
                        "scheduled",
                        "api",
                        "internal-api",
                        "prewarmed",
                        "local-device",
                        "agent-brain",
                        "subagent"
                      ],
                      "description": "Started from: the one source the record started on. The CSV shows it as a label (`manual` → Web, `local-device` → CLI, `internal-api` → Automation)."
                    },
                    "usedFrom": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "web",
                          "mobile",
                          "cli",
                          "api",
                          "excel",
                          "word",
                          "powerpoint"
                        ],
                        "description": "An interface a task was used from: `web` (the web app and the desktop app), `mobile` (the native mobile app), `cli` (the `context-code` terminal on a paired machine), `api` (the Task API with your own key), or `excel` / `word` / `powerpoint` (the Context add-in's pane inside that Office application). The platform's own automation is not an interface."
                      },
                      "description": "Used from: every interface a person acted on this record through, in a fixed order (`web`, `mobile`, `cli`, `api`, `excel`, `word`, `powerpoint`), based on the record's turns, its runs on paired machines, and where it started. Empty for records no interface touched (scheduled, started ahead of use, or a sub-agent with no turns of its own). `api` means started through the Task API with your own key. `excel`, `word` and `powerpoint` mean a prompt was sent from the Context add-in's pane in that Office application (recorded from November 2026; earlier Office use reads as `web`). The platform's own automation (the scheduler, applets, judges, replays) shows as Started from: Automation, with no interface. Known limits: a task started with `POST /api/v1/tasks/prompt` using a service-account key reads as automation, and a task later continued through the API is not detected. Replaces the removed `interfacesUsed` map."
                    },
                    "taskApiKeyName": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Name of the task API key that started this task, taken from the task's first dispatch (later continuations are ignored). Null for tasks and runs not started with a key (for example a task started in the web app, or an automated flow that uses no key, such as an agent judge). When the scheduler started the task, this is `internal-scheduler`."
                    },
                    "taskApiKeyPrincipalType": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "user",
                        "agentServiceAccount",
                        "applet",
                        "service",
                        null
                      ],
                      "description": "Type of account behind the originating key (same dispatch as `taskApiKeyName`): `user` for a person's own key, `agentServiceAccount` for a service key the platform created. Null when the record was not started with a key."
                    },
                    "taskApiKeyNamespace": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Namespace of the originating key (same dispatch as `taskApiKeyName`). A reserved namespace means an automated flow, not a person's key, dispatched the record. Null when the record was not started with a key."
                    },
                    "invokedBy": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Who invoked the record: the dispatching key's name for records started by a service key or by platform automation (or the record's agent for automated flows that use no key, such as an agent judge); otherwise the owning user's display name."
                    },
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Readable title of the task or run"
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "Creation time in ISO 8601; the CSV formats it for display"
                    },
                    "taskStatus": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "active",
                        "completed",
                        "failed",
                        "archived",
                        null
                      ]
                    },
                    "latestRunStatus": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "queued",
                        "running",
                        "succeeded",
                        "failed",
                        "cancelled",
                        null
                      ]
                    },
                    "displayStatus": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Status label combining the task status and its latest run's status"
                    },
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1
                        },
                        "email": {
                          "type": "string",
                          "format": "email"
                        },
                        "country": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "label",
                        "email"
                      ],
                      "additionalProperties": false
                    },
                    "agent": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "id",
                        "label"
                      ],
                      "additionalProperties": false
                    },
                    "workspace": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "workspaceTag": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "messageCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Number of archived messages; null until it is computed"
                    },
                    "userMessageCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Number of archived user-written messages; null until it is computed. The CSV shows null as an empty cell, not 0."
                    },
                    "skillsUsed": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "label"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Skills the record used. The CSV shows a comma-separated list of labels."
                    },
                    "skillsCreated": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "label"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Skills this record's task created. Always empty for dispatch-run records (they have no task). The CSV shows a comma-separated list of labels."
                    },
                    "metrics": {
                      "type": "object",
                      "properties": {
                        "runCount": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "inputFiles": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "outputFiles": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "attempts": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "totalTokens": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Billed tokens (input + output + reasoning + cache write + cache read) summed across the record's LLM calls in trace data. Null when the record has no chat, there is no trace data for it, or trace data cannot be read."
                        }
                      },
                      "required": [
                        "runCount",
                        "inputFiles",
                        "outputFiles",
                        "attempts",
                        "totalTokens"
                      ],
                      "additionalProperties": false
                    },
                    "tokenUsage": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "input": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Billed prompt tokens not served from cache, summed across the record's LLM calls"
                        },
                        "output": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Completion tokens, not counting reasoning, summed across the record's LLM calls"
                        },
                        "reasoning": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Reasoning (thinking) tokens, summed across the record's LLM calls"
                        },
                        "cacheRead": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Prompt tokens served from the provider cache, summed across the record's LLM calls"
                        },
                        "cacheWrite": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Prompt tokens written to the provider cache, summed across the record's LLM calls"
                        }
                      },
                      "required": [
                        "input",
                        "output",
                        "reasoning",
                        "cacheRead",
                        "cacheWrite"
                      ],
                      "additionalProperties": false,
                      "description": "Billed tokens split by type; the parts add up to `metrics.totalTokens`. Null (not 0) when no usage was reported."
                    },
                    "taskViews": {
                      "type": "object",
                      "properties": {
                        "viewCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Recorded opens of this task's conversation across every surface that records views. Null (not 0) when views were never measured for this record (see `unmeasuredReason`)."
                        },
                        "unmeasuredReason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "no-view-key",
                            "predates-instrumentation",
                            null
                          ],
                          "description": "Why `viewCount` is null. Null whenever `viewCount` is a real measurement, including a real zero."
                        },
                        "lastViewedAt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "lastViewedBy": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1
                            },
                            "email": {
                              "type": "string",
                              "format": "email"
                            },
                            "country": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "label",
                            "email"
                          ],
                          "additionalProperties": false
                        },
                        "viewedFrom": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "task_route",
                              "shared_link",
                              "eval_analytics",
                              "context_code",
                              "eval_project"
                            ]
                          },
                          "description": "Distinct surfaces where a person opened this record's conversation, in the enum's order. Empty when `viewCount` is null or 0: a surface appears only when at least one view was recorded on it."
                        }
                      },
                      "required": [
                        "viewCount",
                        "unmeasuredReason",
                        "lastViewedAt",
                        "lastViewedBy",
                        "viewedFrom"
                      ],
                      "additionalProperties": false,
                      "description": "View summary. Tasks match views by task ID; standalone dispatch runs match by chat. `viewCount` is null (with `unmeasuredReason` set) when the record could not be measured: a run with no chat, or a record created before views were recorded. The CSV shows that as an empty cell, not 0."
                    },
                    "feedbackSummary": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of feedback submissions on this record"
                        },
                        "avgRating": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 5,
                          "description": "Mean numeric rating on the 1 to 5 scale, or null when there is no numeric rating"
                        },
                        "maxRating": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "minimum": 1,
                          "maximum": 5,
                          "description": "Highest numeric rating on the 1 to 5 scale, or null when there is no numeric rating"
                        },
                        "withTextCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of submissions with a non-empty comment"
                        }
                      },
                      "required": [
                        "count",
                        "avgRating",
                        "maxRating",
                        "withTextCount"
                      ],
                      "additionalProperties": false,
                      "description": "Feedback counts and ratings across all feedback on this record. Always present."
                    },
                    "projectUrl": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uri",
                      "description": "Absolute URL of the project or chat in the app; null when the record has no chat to link to or the deployment has no app address configured"
                    },
                    "isEditorShared": {
                      "type": [
                        "boolean",
                        "null"
                      ],
                      "description": "Whether the project has an active editor-mode share. Null when the record has no shareable root task or the share state could not be read."
                    },
                    "feedback": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "scorecardId": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Stable ID of the scorecard the feedback came from"
                          },
                          "scorecardName": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Scorecard display name; used as the column-name prefix in the CSV (for example 'Feedback: <scorecard name> - <criterionName>')"
                          },
                          "criteria": {
                            "type": "object",
                            "additionalProperties": {
                              "type": "string"
                            },
                            "description": "Aggregated criterion responses by criterion name. Numeric criteria become their average, boolean criteria combine to Yes/No, and free-text responses are comma-joined."
                          },
                          "comments": {
                            "type": "string",
                            "description": "Free-text comments under this scorecard, joined by newlines in submission order. Empty when there are no comments."
                          }
                        },
                        "required": [
                          "scorecardId",
                          "scorecardName",
                          "criteria",
                          "comments"
                        ],
                        "additionalProperties": false,
                        "description": "All feedback from one scorecard on one record, combined into one entry. A record with feedback from several scorecards has several entries."
                      },
                      "description": "Aggregated feedback for this record, one entry per scorecard. Empty when the record has no feedback or the request set `includeFeedback=false`."
                    }
                  },
                  "required": [
                    "recordId",
                    "recordType",
                    "taskId",
                    "parentTaskId",
                    "runId",
                    "taskOpencodeBranchId",
                    "sourceType",
                    "usedFrom",
                    "taskApiKeyName",
                    "taskApiKeyPrincipalType",
                    "taskApiKeyNamespace",
                    "invokedBy",
                    "title",
                    "createdAt",
                    "taskStatus",
                    "latestRunStatus",
                    "displayStatus",
                    "user",
                    "agent",
                    "workspace",
                    "workspaceTag",
                    "messageCount",
                    "userMessageCount",
                    "skillsUsed",
                    "skillsCreated",
                    "metrics",
                    "tokenUsage",
                    "taskViews",
                    "feedbackSummary",
                    "projectUrl",
                    "isEditorShared",
                    "feedback"
                  ],
                  "additionalProperties": false,
                  "description": "One JSONL row from the export. Converts cleanly to CSV with flat 'Feedback: <scorecard name> - <criterionName>' and 'Feedback Comments: <scorecard name>' columns."
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner reads no task analytics in the organization — neither the Evals role (`org:access_evals`) nor the analytics key (`org:access_analytics`). An owner holding only the analytics key reads these routes org-wide and nothing else under /evals.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A workflow or error-message filter could not be applied because the trace store did not answer; retry, or drop that filter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "analytics",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/analytics/records/export\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode 'limit=100'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/analytics/records/export\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"limit\": 100},\n    stream=True,\n    timeout=60,\n)\nresp.raise_for_status()\n# Every row is one line; the last line is {\"recordType\": \"end\", \"rowCount\": n}. No such line means the export was cut off.\nfor line in resp.iter_lines():\n    if not line:\n        continue\n    row = json.loads(line)\n    if row.get(\"recordType\") == \"end\":\n        print(f\"{row['rowCount']} rows\")\n        break\n    print(row)\nelse:\n    raise RuntimeError(\"the export was cut off before its final line\")"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/analytics/records/export`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"limit\", \"100\")\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\n// Every row is one line; the last line is {\"recordType\":\"end\",\"rowCount\":n}. No such line means the export was cut off.\nconst rows = (await res.text()).split(\"\\n\").filter(Boolean).map((line) => JSON.parse(line))\nconst end = rows.pop()\nif (end?.recordType !== \"end\") throw new Error(\"The export was cut off before its final line\")\nfor (const row of rows) console.log(row)\nconsole.log(`${end.rowCount} rows`)"
          }
        ]
      }
    },
    "/analytics/records/{recordId}": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get an analytics record",
        "description": "One analytics record plus its latest run and feedback entries.",
        "operationId": "getAnalyticsRecord",
        "parameters": [
          {
            "in": "path",
            "name": "recordId",
            "required": true,
            "description": "Stable analytics record identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Stable analytics record identifier"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "record": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "recordId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "recordKind": {
                          "type": "string",
                          "enum": [
                            "task",
                            "dispatchRun"
                          ]
                        },
                        "recordType": {
                          "type": "string",
                          "enum": [
                            "rootTask",
                            "subAgent",
                            "dispatchRun"
                          ],
                          "description": "Kind of record: `rootTask`, `subAgent`, or `dispatchRun`."
                        },
                        "taskId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "parentTaskId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Parent task ID when this row is a sub-agent task; null for root tasks and standalone dispatch runs."
                        },
                        "runId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "taskOpencodeBranchId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "sourceType": {
                          "type": "string",
                          "enum": [
                            "manual",
                            "scheduled",
                            "api",
                            "internal-api",
                            "prewarmed",
                            "local-device",
                            "agent-brain",
                            "subagent"
                          ],
                          "description": "Where the record started: one of the task source types, or `subagent` for child tasks started by another task."
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "taskStatus": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "active",
                            "completed",
                            "failed",
                            "archived",
                            null
                          ]
                        },
                        "latestRunStatus": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "queued",
                            "running",
                            "succeeded",
                            "failed",
                            "cancelled",
                            null
                          ]
                        },
                        "displayStatus": {
                          "type": "string",
                          "minLength": 1
                        },
                        "user": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1
                            },
                            "email": {
                              "type": "string",
                              "format": "email"
                            },
                            "country": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "label",
                            "email"
                          ],
                          "additionalProperties": false
                        },
                        "agent": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "id",
                            "label"
                          ],
                          "additionalProperties": false
                        },
                        "workspace": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        "workspaceTag": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        "messageCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0
                        },
                        "userMessageCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Number of user-written messages in the task's latest archived conversation; null (not 0) when the task has no archived conversation."
                        },
                        "skillsUsed": {
                          "type": [
                            "array",
                            "null"
                          ],
                          "items": {
                            "type": "string"
                          }
                        },
                        "skillsUsedDetails": {
                          "type": [
                            "array",
                            "null"
                          ],
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "id",
                              "label"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "connectorsAttached": {
                          "type": [
                            "array",
                            "null"
                          ],
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "id",
                              "label"
                            ],
                            "additionalProperties": false
                          },
                          "description": "MCP connectors attached to the record's agent (including the organization's custom connectors on the agent's list or covered by its All connectors setting), as connector names sorted by label; null when the agent has none. Attachments are not recorded per run, so this shows the agent's connectors at the time you read it, not when the record ran."
                        },
                        "metrics": {
                          "type": "object",
                          "properties": {
                            "runCount": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "inputFiles": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "outputFiles": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "attempts": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "totalTokens": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 0,
                              "description": "Billed tokens (input + output + reasoning + cache write + cache read) summed across the record's LLM calls in trace data. Null when the record has no chat, there is no trace data for it, or trace data cannot be read."
                            }
                          },
                          "required": [
                            "runCount",
                            "inputFiles",
                            "outputFiles",
                            "attempts",
                            "totalTokens"
                          ],
                          "additionalProperties": false
                        },
                        "taskViews": {
                          "type": "object",
                          "properties": {
                            "viewCount": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "minimum": 0,
                              "description": "Recorded opens of this task's conversation across every surface that records views. Null (not 0) when views were never measured for this record (see `unmeasuredReason`)."
                            },
                            "unmeasuredReason": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "enum": [
                                "no-view-key",
                                "predates-instrumentation",
                                null
                              ],
                              "description": "Why `viewCount` is null. Null whenever `viewCount` is a real measurement, including a real zero."
                            },
                            "lastViewedAt": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "lastViewedBy": {
                              "type": [
                                "object",
                                "null"
                              ],
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "email": {
                                  "type": "string",
                                  "format": "email"
                                },
                                "country": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "label",
                                "email"
                              ],
                              "additionalProperties": false
                            },
                            "viewedFrom": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "task_route",
                                  "shared_link",
                                  "eval_analytics",
                                  "context_code",
                                  "eval_project"
                                ]
                              },
                              "description": "Distinct surfaces where a person opened this record's conversation, in the enum's order. Empty when `viewCount` is null or 0: a surface appears only when at least one view was recorded on it."
                            }
                          },
                          "required": [
                            "viewCount",
                            "unmeasuredReason",
                            "lastViewedAt",
                            "lastViewedBy",
                            "viewedFrom"
                          ],
                          "additionalProperties": false,
                          "description": "View measurement for an analytics record (a task, or a standalone dispatch run matched by its chat)."
                        },
                        "feedbackSummary": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "Number of feedback submissions on this record"
                            },
                            "avgRating": {
                              "type": [
                                "number",
                                "null"
                              ],
                              "minimum": 1,
                              "maximum": 5,
                              "description": "Mean numeric rating on the 1 to 5 scale, or null when there is no numeric rating"
                            },
                            "maxRating": {
                              "type": [
                                "number",
                                "null"
                              ],
                              "minimum": 1,
                              "maximum": 5,
                              "description": "Highest numeric rating on the 1 to 5 scale, or null when there is no numeric rating"
                            },
                            "withTextCount": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "Number of submissions with a non-empty comment"
                            }
                          },
                          "required": [
                            "count",
                            "avgRating",
                            "maxRating",
                            "withTextCount"
                          ],
                          "additionalProperties": false,
                          "description": "Feedback summary for one task, run, or trace session"
                        },
                        "execution": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "traced"
                                  ]
                                },
                                "sessionIds": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "minItems": 1,
                                  "description": "The chat's trace sessions, latest first."
                                },
                                "model": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "description": "The model that served the most calls in the chat; null when no call named a model"
                                },
                                "models": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "description": "Every named model in the chat, most calls first; empty when no call named a model"
                                },
                                "callCount": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "tokens": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Billed tokens (input + output + reasoning + cache write + cache read) across the chat's own calls"
                                },
                                "durationMs": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Total duration of the chat's own calls, in milliseconds"
                                },
                                "errorCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Number of calls that ended unsuccessfully"
                                },
                                "estimatedCostUsd": {
                                  "type": [
                                    "number",
                                    "null"
                                  ],
                                  "minimum": 0,
                                  "description": "Estimated cost summed over the chat's calls. An estimate, not the bill: the billed amount is `billedCost`. Null when no call reported a cost."
                                },
                                "errorMessageSample": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "description": "The error message of one failed call (aborted calls excluded); null when no failed call had one"
                                },
                                "lastActivityAt": {
                                  "type": "string",
                                  "description": "Time of the chat's latest call (ISO 8601)"
                                },
                                "subagents": {
                                  "type": [
                                    "object",
                                    "null"
                                  ],
                                  "properties": {
                                    "count": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "description": "Number of sub-agent rows on this page grouped under the parent"
                                    },
                                    "tokens": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "description": "Billed tokens of the grouped sub-agent chats"
                                    },
                                    "estimatedCostUsd": {
                                      "type": [
                                        "number",
                                        "null"
                                      ],
                                      "minimum": 0,
                                      "description": "Estimated cost of the grouped sub-agent chats; null when none of them reported one"
                                    },
                                    "errorCount": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "description": "Number of unsuccessful calls in the grouped sub-agent chats"
                                    }
                                  },
                                  "required": [
                                    "count",
                                    "tokens",
                                    "estimatedCostUsd",
                                    "errorCount"
                                  ],
                                  "additionalProperties": false,
                                  "description": "Totals for the grouped sub-agent rows; null when the row has no sub-agent rows on this page"
                                }
                              },
                              "required": [
                                "kind",
                                "sessionIds",
                                "model",
                                "models",
                                "callCount",
                                "tokens",
                                "durationMs",
                                "errorCount",
                                "estimatedCostUsd",
                                "errorMessageSample",
                                "lastActivityAt",
                                "subagents"
                              ],
                              "additionalProperties": false,
                              "description": "Execution data is available: the chat has trace data."
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "none"
                                  ]
                                },
                                "reason": {
                                  "type": "string",
                                  "enum": [
                                    "no_chat_id",
                                    "no_trace_rows",
                                    "trace_store_unavailable"
                                  ]
                                }
                              },
                              "required": [
                                "kind",
                                "reason"
                              ],
                              "additionalProperties": false,
                              "description": "The row has no execution data; `reason` says why."
                            }
                          ],
                          "description": "Execution data for a task row, taken from the chat's trace data"
                        },
                        "billedCost": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "known"
                                  ]
                                },
                                "costUsdMicros": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Billed model spend in millionths of a US dollar, read from billing records (never recalculated)"
                                }
                              },
                              "required": [
                                "kind",
                                "costUsdMicros"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "unknown"
                                  ]
                                },
                                "reason": {
                                  "type": "string",
                                  "enum": [
                                    "ledger_not_final",
                                    "device_calls_unbounded",
                                    "no_rows",
                                    "unrated_rows",
                                    "ledger_unavailable"
                                  ],
                                  "description": "Why the billed cost is unavailable. `ledger_not_final`: billing for the run is not final, or the run can still be billed for a call. `device_calls_unbounded`: a run ran on a paired machine, whose spend is never reported as final. `no_rows`: there is no billing record for it. `unrated_rows`: a billing record has no rated cost. `ledger_unavailable`: billing records could not be read."
                                }
                              },
                              "required": [
                                "kind",
                                "reason"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "description": "The billed cost of a task row, the same figure Settings › Usage shows"
                        },
                        "workflows": {
                          "type": [
                            "array",
                            "null"
                          ],
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "id",
                              "label"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Workflows the record's chat is classified into. `[]` when the chat is unclassified; null when classifications could not be read."
                        },
                        "origin": {
                          "type": "string",
                          "enum": [
                            "evaluation-run",
                            "judge",
                            "skill-learning-replay",
                            "production"
                          ],
                          "description": "The kind of work that started the record, taken from its chat's root task: whether an evaluation started it, then whether it runs as the organization's judge agent. A sub-agent takes its root's origin. A dispatch run whose chat has no task is judged on its own. This is the same rule the `origins` filter uses."
                        }
                      },
                      "required": [
                        "recordId",
                        "recordKind",
                        "recordType",
                        "taskId",
                        "parentTaskId",
                        "runId",
                        "taskOpencodeBranchId",
                        "sourceType",
                        "title",
                        "createdAt",
                        "taskStatus",
                        "latestRunStatus",
                        "displayStatus",
                        "user",
                        "agent",
                        "workspace",
                        "workspaceTag",
                        "messageCount",
                        "userMessageCount",
                        "skillsUsed",
                        "skillsUsedDetails",
                        "connectorsAttached",
                        "metrics",
                        "taskViews",
                        "feedbackSummary",
                        "execution",
                        "billedCost",
                        "workflows",
                        "origin"
                      ],
                      "additionalProperties": false,
                      "description": "The record; null (with a 200) when the ID is unknown or outside what the key can read."
                    },
                    "latestRun": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "runId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "sessionId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "taskOpencodeBranchId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "inputPrompt": {
                          "type": "string",
                          "minLength": 1
                        },
                        "outputText": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "running",
                            "succeeded",
                            "failed",
                            "cancelled"
                          ]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "completedAt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "metrics": {
                          "type": "object",
                          "properties": {
                            "inputFiles": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "outputFiles": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "attempts": {
                              "type": "integer",
                              "minimum": 0
                            }
                          },
                          "required": [
                            "inputFiles",
                            "outputFiles",
                            "attempts"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "runId",
                        "sessionId",
                        "taskOpencodeBranchId",
                        "inputPrompt",
                        "outputText",
                        "status",
                        "createdAt",
                        "completedAt",
                        "metrics"
                      ],
                      "additionalProperties": false
                    },
                    "feedback": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "organizationId": {
                            "type": "string"
                          },
                          "valinorProjectId": {
                            "type": "string"
                          },
                          "chatId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "valinorMessageId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "selectedText": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "userId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "teamId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "feedbackType": {
                            "type": "string"
                          },
                          "responses": {},
                          "createdAt": {
                            "type": "string"
                          },
                          "rubric": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "description": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "description"
                            ],
                            "additionalProperties": false
                          },
                          "rubricVersion": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "version": {
                                "type": "number"
                              },
                              "snapshot": {}
                            },
                            "required": [
                              "id",
                              "version"
                            ],
                            "additionalProperties": false
                          },
                          "submitter": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "user"
                                    ]
                                  },
                                  "id": {
                                    "type": "string",
                                    "description": "The person's user id"
                                  },
                                  "name": {
                                    "type": "string",
                                    "description": "The person's display name"
                                  },
                                  "email": {
                                    "type": "string",
                                    "description": "The person's email"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "id",
                                  "name",
                                  "email"
                                ],
                                "additionalProperties": false,
                                "description": "A person rated it, in the app or with a task API key they own"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "serviceAccount"
                                    ]
                                  },
                                  "id": {
                                    "type": "string",
                                    "description": "The agent service account id stored as the row's user_id"
                                  },
                                  "name": {
                                    "type": "string",
                                    "description": "The agent's name"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false,
                                "description": "An agent service account rated it (an agent's sandbox or MCP tools, or a task API key the agent minted)"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "target": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "taskId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "taskTitle": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "chatId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "messageText": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "taskId",
                              "taskTitle",
                              "chatId",
                              "messageText"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "id",
                          "organizationId",
                          "valinorProjectId",
                          "valinorMessageId",
                          "userId",
                          "teamId",
                          "feedbackType",
                          "createdAt",
                          "rubric",
                          "rubricVersion"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "record",
                    "latestRun",
                    "feedback"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner reads no task analytics in the organization — neither the Evals role (`org:access_evals`) nor the analytics key (`org:access_analytics`). An owner holding only the analytics key reads these routes org-wide and nothing else under /evals.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "analytics",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/analytics/records/$RECORD_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nrecord_id = os.environ[\"RECORD_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/analytics/records/{record_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/analytics/records/${encodeURIComponent(env(\"RECORD_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/benchmarks": {
      "get": {
        "tags": [
          "Evaluations"
        ],
        "summary": "List evaluations",
        "description": "Lists the benchmarks in the workspace scope you read, each with its axes, judge model and threshold. Evaluations saved before axes existed are left out, and monitors are listed separately (`GET /monitors/{monitorId}` reads one).",
        "operationId": "listBenchmarks",
        "parameters": [
          {
            "in": "query",
            "name": "workspaceScope",
            "required": false,
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "all"
                          ]
                        }
                      },
                      "required": [
                        "kind"
                      ],
                      "additionalProperties": false,
                      "description": "Every workspace in the organization plus the organization-wide evaluations; organization admins only"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "one"
                          ]
                        },
                        "workspaceId": {
                          "type": "string",
                          "minLength": 1,
                          "description": "The workspace the request is about"
                        }
                      },
                      "required": [
                        "kind",
                        "workspaceId"
                      ],
                      "additionalProperties": false,
                      "description": "One workspace: its evaluations plus the organization-wide ones"
                    }
                  ],
                  "description": "Which workspace to read. When omitted: every workspace for an organization admin; your one workspace if your Evals access covers exactly one; otherwise 403 asking you to name a workspace."
                }
              }
            },
            "description": "Send it as JSON in one value, for example `workspaceScope={\"kind\":\"one\",\"workspaceId\":\"<id>\"}`. Any other value is refused with 400."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Unique evaluation identifier"
                      },
                      "orgId": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Organization that owns this evaluation"
                      },
                      "workspaceId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "The workspace this evaluation belongs to; null means organization-wide, shown in every workspace"
                      },
                      "createdById": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "User who created this evaluation"
                      },
                      "ownerUserId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "The person who owns this evaluation; null for evaluations made before owners were recorded (organization-wide, and changeable by an organization admin)"
                      },
                      "visibility": {
                        "type": "string",
                        "enum": [
                          "org",
                          "workspace",
                          "personal"
                        ],
                        "description": "Where this evaluation is placed: organization-wide, shared into its workspace, or private to its owner"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200,
                        "description": "Evaluation display name"
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 2000,
                        "description": "Optional evaluation description"
                      },
                      "judgeModel": {
                        "type": "string",
                        "description": "The model that grades a dataset's or task's model criterion, unless the criterion names its own model"
                      },
                      "threshold": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "maximum": 100,
                        "description": "Pass threshold on the 0 to 100 result scale; null when the evaluation sets none"
                      },
                      "axes": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "testing": {
                                "type": "string",
                                "enum": [
                                  "model"
                                ]
                              },
                              "values": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "model"
                                      ]
                                    },
                                    "model": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "model"
                                  ],
                                  "additionalProperties": false,
                                  "description": "A model the held agent runs"
                                },
                                "minItems": 1,
                                "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                              },
                              "held": {
                                "type": "object",
                                "properties": {
                                  "agentId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "An agent in the evaluation's organization"
                                  },
                                  "skills": {
                                    "type": "array",
                                    "items": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "skillId": {
                                              "type": "string",
                                              "minLength": 1,
                                              "description": "A skill in the evaluation's organization"
                                            },
                                            "version": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                            }
                                          },
                                          "required": [
                                            "skillId"
                                          ],
                                          "additionalProperties": false,
                                          "description": "A skill, at its newest version (no version given) or a pinned version number"
                                        },
                                        {
                                          "type": "string",
                                          "minLength": 1,
                                          "description": "A skill in the evaluation's organization"
                                        }
                                      ],
                                      "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                    },
                                    "maxItems": 20,
                                    "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                  }
                                },
                                "required": [
                                  "agentId",
                                  "skills"
                                ],
                                "additionalProperties": false,
                                "description": "The agent every model runs on, and the skills it runs with"
                              }
                            },
                            "required": [
                              "testing",
                              "values",
                              "held"
                            ],
                            "additionalProperties": false,
                            "description": "Testing Model: one agent and its skills are held fixed"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "testing": {
                                "type": "string",
                                "enum": [
                                  "skill"
                                ]
                              },
                              "values": {
                                "type": "array",
                                "items": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "skill"
                                          ]
                                        },
                                        "skillId": {
                                          "type": "string",
                                          "minLength": 1,
                                          "description": "A skill in the evaluation's organization"
                                        },
                                        "version": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "skillId"
                                      ],
                                      "additionalProperties": false,
                                      "description": "A skill the held agent runs with, at its newest version or a pinned one"
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "no_skill"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false,
                                      "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                    }
                                  ]
                                },
                                "minItems": 1,
                                "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                              },
                              "held": {
                                "type": "object",
                                "properties": {
                                  "agentId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "An agent in the evaluation's organization"
                                  },
                                  "model": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "agent_default"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false,
                                        "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "model"
                                            ]
                                          },
                                          "model": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 200,
                                            "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "model"
                                        ],
                                        "additionalProperties": false,
                                        "description": "One model that every agent in the evaluation runs"
                                      }
                                    ],
                                    "description": "The model held fixed when Model is not the tested axis"
                                  }
                                },
                                "required": [
                                  "agentId",
                                  "model"
                                ],
                                "additionalProperties": false,
                                "description": "The agent every skill runs on, and the model it runs"
                              }
                            },
                            "required": [
                              "testing",
                              "values",
                              "held"
                            ],
                            "additionalProperties": false,
                            "description": "Testing Skill: one agent and its model are held fixed"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "testing": {
                                "type": "string",
                                "enum": [
                                  "agent"
                                ]
                              },
                              "values": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "agent"
                                      ]
                                    },
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "agentId"
                                  ],
                                  "additionalProperties": false,
                                  "description": "An agent"
                                },
                                "minItems": 1,
                                "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                              },
                              "held": {
                                "type": "object",
                                "properties": {
                                  "model": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "agent_default"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false,
                                        "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "model"
                                            ]
                                          },
                                          "model": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 200,
                                            "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "model"
                                        ],
                                        "additionalProperties": false,
                                        "description": "One model that every agent in the evaluation runs"
                                      }
                                    ],
                                    "description": "The model held fixed when Model is not the tested axis"
                                  },
                                  "skills": {
                                    "type": "array",
                                    "items": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "skillId": {
                                              "type": "string",
                                              "minLength": 1,
                                              "description": "A skill in the evaluation's organization"
                                            },
                                            "version": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                            }
                                          },
                                          "required": [
                                            "skillId"
                                          ],
                                          "additionalProperties": false,
                                          "description": "A skill, at its newest version (no version given) or a pinned version number"
                                        },
                                        {
                                          "type": "string",
                                          "minLength": 1,
                                          "description": "A skill in the evaluation's organization"
                                        }
                                      ],
                                      "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                    },
                                    "maxItems": 20,
                                    "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                  }
                                },
                                "required": [
                                  "model",
                                  "skills"
                                ],
                                "additionalProperties": false,
                                "description": "The model every agent runs (one they can all run, or each agent's own default), and the skills they run with"
                              }
                            },
                            "required": [
                              "testing",
                              "values",
                              "held"
                            ],
                            "additionalProperties": false,
                            "description": "Testing Agent: the model and the skills are held fixed"
                          }
                        ],
                        "description": "The question this evaluation asks: the one axis it tests, the values it compares, and what it holds fixed. Editable at any time; each run keeps its own copy from when it started."
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Creation timestamp"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Last update timestamp"
                      }
                    },
                    "required": [
                      "id",
                      "orgId",
                      "workspaceId",
                      "createdById",
                      "ownerUserId",
                      "visibility",
                      "name",
                      "description",
                      "judgeModel",
                      "threshold",
                      "axes",
                      "createdAt",
                      "updatedAt"
                    ],
                    "additionalProperties": false,
                    "description": "An evaluation: the datasets it measures, its axes (what it tests and what it holds fixed), the default judge model for the datasets' criteria, and its pass threshold. It has no grading criteria of its own."
                  },
                  "description": "Evaluations in the organization"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/benchmarks\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/benchmarks\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/benchmarks`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          },
          {
            "lang": "shell",
            "label": "CLI",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n\n# Find benchmarks with in-flight runs\n# The CLI pages ({items, nextCursor}) and adds runCount and activeRunCount; GET /benchmarks returns a plain array without them.\ncontext evals benchmark list --limit 100 | jq '.items[] | select(.activeRunCount > 0) | .id'"
          }
        ]
      },
      "post": {
        "tags": [
          "Evaluations"
        ],
        "summary": "Create an Evaluation",
        "description": "A test-set Evaluation: what it tests (`axes`), its judge model and pass threshold. Every agent the axes name must be one you can run, and every skill one you can read. Link its datasets with `POST /benchmarks/{evaluationId}/datasets`. `modelWarnings` lists any model problem a run would refuse.",
        "operationId": "createBenchmark",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "description": "A key you choose for this request (a UUID works; at most 255 characters; a blank one is refused 400, code `idempotency_key_empty`). A retry with the same key and the same body answers the first success again instead of acting twice; kept 24 hours. Send one on every create and run start you might retry.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "workspaceId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "description": "The workspace to create this in; null = organization-wide (organization admins only); omitted = the caller's only workspace, or every workspace for an organization admin"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "Benchmark display name"
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000,
                    "description": "Optional description"
                  },
                  "judgeModel": {
                    "type": "string",
                    "description": "Provider-prefixed default judge model for the datasets' model criteria; omission records this deployment's effective small model"
                  },
                  "threshold": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 100,
                    "description": "Pass threshold (0-100); omit or null for none"
                  },
                  "axes": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "testing": {
                            "type": "string",
                            "enum": [
                              "model"
                            ]
                          },
                          "values": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "model"
                                  ]
                                },
                                "model": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200,
                                  "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                }
                              },
                              "required": [
                                "kind",
                                "model"
                              ],
                              "additionalProperties": false,
                              "description": "A model the held agent runs"
                            },
                            "minItems": 1,
                            "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                          },
                          "held": {
                            "type": "object",
                            "properties": {
                              "agentId": {
                                "type": "string",
                                "minLength": 1,
                                "description": "An agent in the evaluation's organization"
                              },
                              "skills": {
                                "type": "array",
                                "items": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "skillId": {
                                          "type": "string",
                                          "minLength": 1,
                                          "description": "A skill in the evaluation's organization"
                                        },
                                        "version": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                        }
                                      },
                                      "required": [
                                        "skillId"
                                      ],
                                      "additionalProperties": false,
                                      "description": "A skill, at its newest version (no version given) or a pinned version number"
                                    },
                                    {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "A skill in the evaluation's organization"
                                    }
                                  ],
                                  "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                },
                                "maxItems": 20,
                                "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                              }
                            },
                            "required": [
                              "agentId",
                              "skills"
                            ],
                            "additionalProperties": false,
                            "description": "The agent every model runs on, and the skills it runs with"
                          }
                        },
                        "required": [
                          "testing",
                          "values",
                          "held"
                        ],
                        "additionalProperties": false,
                        "description": "Testing Model: one agent and its skills are held fixed"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "testing": {
                            "type": "string",
                            "enum": [
                              "skill"
                            ]
                          },
                          "values": {
                            "type": "array",
                            "items": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "skill"
                                      ]
                                    },
                                    "skillId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "A skill in the evaluation's organization"
                                    },
                                    "version": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "skillId"
                                  ],
                                  "additionalProperties": false,
                                  "description": "A skill the held agent runs with, at its newest version or a pinned one"
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "no_skill"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                }
                              ]
                            },
                            "minItems": 1,
                            "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                          },
                          "held": {
                            "type": "object",
                            "properties": {
                              "agentId": {
                                "type": "string",
                                "minLength": 1,
                                "description": "An agent in the evaluation's organization"
                              },
                              "model": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent_default"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "One model that every agent in the evaluation runs"
                                  }
                                ],
                                "description": "The model held fixed when Model is not the tested axis"
                              }
                            },
                            "required": [
                              "agentId",
                              "model"
                            ],
                            "additionalProperties": false,
                            "description": "The agent every skill runs on, and the model it runs"
                          }
                        },
                        "required": [
                          "testing",
                          "values",
                          "held"
                        ],
                        "additionalProperties": false,
                        "description": "Testing Skill: one agent and its model are held fixed"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "testing": {
                            "type": "string",
                            "enum": [
                              "agent"
                            ]
                          },
                          "values": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "agent"
                                  ]
                                },
                                "agentId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An agent in the evaluation's organization"
                                }
                              },
                              "required": [
                                "kind",
                                "agentId"
                              ],
                              "additionalProperties": false,
                              "description": "An agent"
                            },
                            "minItems": 1,
                            "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                          },
                          "held": {
                            "type": "object",
                            "properties": {
                              "model": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent_default"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "One model that every agent in the evaluation runs"
                                  }
                                ],
                                "description": "The model held fixed when Model is not the tested axis"
                              },
                              "skills": {
                                "type": "array",
                                "items": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "skillId": {
                                          "type": "string",
                                          "minLength": 1,
                                          "description": "A skill in the evaluation's organization"
                                        },
                                        "version": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                        }
                                      },
                                      "required": [
                                        "skillId"
                                      ],
                                      "additionalProperties": false,
                                      "description": "A skill, at its newest version (no version given) or a pinned version number"
                                    },
                                    {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "A skill in the evaluation's organization"
                                    }
                                  ],
                                  "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                },
                                "maxItems": 20,
                                "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                              }
                            },
                            "required": [
                              "model",
                              "skills"
                            ],
                            "additionalProperties": false,
                            "description": "The model every agent runs (one they can all run, or each agent's own default), and the skills they run with"
                          }
                        },
                        "required": [
                          "testing",
                          "values",
                          "held"
                        ],
                        "additionalProperties": false,
                        "description": "Testing Agent: the model and the skills are held fixed"
                      }
                    ],
                    "description": "The question: the axis tested, its values (one or more) and what is held. A skill is named at Latest (no version: its newest version, fixed when a run starts) or at a version number. Every agent it names must be one the caller can run and every skill one they can read (a pinned version must still exist), else FORBIDDEN with AxesRefusalSchema data"
                  }
                },
                "required": [
                  "name",
                  "axes"
                ],
                "additionalProperties": false,
                "description": "Input for creating a new Evaluation"
              },
              "example": {
                "name": "rest-writes refunds agent",
                "threshold": 80,
                "axes": {
                  "testing": "agent",
                  "values": [
                    {
                      "kind": "agent",
                      "agentId": "<agent id>"
                    }
                  ],
                  "held": {
                    "model": {
                      "kind": "agent_default"
                    },
                    "skills": []
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success. A retry with the same `Idempotency-Key` and the same request answers this again, with `Idempotent-Replayed: true`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique evaluation identifier"
                    },
                    "orgId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Organization that owns this evaluation"
                    },
                    "workspaceId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "The workspace this evaluation belongs to; null means organization-wide, shown in every workspace"
                    },
                    "createdById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "User who created this evaluation"
                    },
                    "ownerUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "The person who owns this evaluation; null for evaluations made before owners were recorded (organization-wide, and changeable by an organization admin)"
                    },
                    "visibility": {
                      "type": "string",
                      "enum": [
                        "org",
                        "workspace",
                        "personal"
                      ],
                      "description": "Where this evaluation is placed: organization-wide, shared into its workspace, or private to its owner"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "Evaluation display name"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 2000,
                      "description": "Optional evaluation description"
                    },
                    "judgeModel": {
                      "type": "string",
                      "description": "The model that grades a dataset's or task's model criterion, unless the criterion names its own model"
                    },
                    "threshold": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "maximum": 100,
                      "description": "Pass threshold on the 0 to 100 result scale; null when the evaluation sets none"
                    },
                    "axes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "model"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "model"
                                    ]
                                  },
                                  "model": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "model"
                                ],
                                "additionalProperties": false,
                                "description": "A model the held agent runs"
                              },
                              "minItems": 1,
                              "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "agentId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An agent in the evaluation's organization"
                                },
                                "skills": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          }
                                        },
                                        "required": [
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A skill, at its newest version (no version given) or a pinned version number"
                                      },
                                      {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      }
                                    ],
                                    "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                  },
                                  "maxItems": 20,
                                  "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                }
                              },
                              "required": [
                                "agentId",
                                "skills"
                              ],
                              "additionalProperties": false,
                              "description": "The agent every model runs on, and the skills it runs with"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Model: one agent and its skills are held fixed"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "skill"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "skill"
                                        ]
                                      },
                                      "skillId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      },
                                      "version": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "skillId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A skill the held agent runs with, at its newest version or a pinned one"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "no_skill"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                  }
                                ]
                              },
                              "minItems": 1,
                              "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "agentId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An agent in the evaluation's organization"
                                },
                                "model": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "agent_default"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false,
                                      "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "model"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "model"
                                      ],
                                      "additionalProperties": false,
                                      "description": "One model that every agent in the evaluation runs"
                                    }
                                  ],
                                  "description": "The model held fixed when Model is not the tested axis"
                                }
                              },
                              "required": [
                                "agentId",
                                "model"
                              ],
                              "additionalProperties": false,
                              "description": "The agent every skill runs on, and the model it runs"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Skill: one agent and its model are held fixed"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "agent"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "agent"
                                    ]
                                  },
                                  "agentId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "An agent in the evaluation's organization"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "agentId"
                                ],
                                "additionalProperties": false,
                                "description": "An agent"
                              },
                              "minItems": 1,
                              "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "model": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "agent_default"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false,
                                      "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "model"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "model"
                                      ],
                                      "additionalProperties": false,
                                      "description": "One model that every agent in the evaluation runs"
                                    }
                                  ],
                                  "description": "The model held fixed when Model is not the tested axis"
                                },
                                "skills": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          }
                                        },
                                        "required": [
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A skill, at its newest version (no version given) or a pinned version number"
                                      },
                                      {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      }
                                    ],
                                    "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                  },
                                  "maxItems": 20,
                                  "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                }
                              },
                              "required": [
                                "model",
                                "skills"
                              ],
                              "additionalProperties": false,
                              "description": "The model every agent runs (one they can all run, or each agent's own default), and the skills they run with"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Agent: the model and the skills are held fixed"
                        }
                      ],
                      "description": "The question this evaluation asks: the one axis it tests, the values it compares, and what it holds fixed. Editable at any time; each run keeps its own copy from when it started."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    },
                    "modelWarnings": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "string",
                                "enum": [
                                  "model_not_runnable"
                                ]
                              },
                              "agentId": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The agent that would run the model"
                              },
                              "model": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The model as the axes name it"
                              },
                              "message": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The one plain sentence to show. Run start's refusal adds the models the agent can run, for a caller that can use the list"
                              }
                            },
                            "required": [
                              "code",
                              "agentId",
                              "model",
                              "message"
                            ],
                            "additionalProperties": false,
                            "description": "This agent cannot run this model"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "string",
                                "enum": [
                                  "models_resolve_to_one"
                                ]
                              },
                              "model": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The one model two tested values resolve to"
                              },
                              "message": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The one plain sentence to show"
                              }
                            },
                            "required": [
                              "code",
                              "model",
                              "message"
                            ],
                            "additionalProperties": false,
                            "description": "Testing Model: two of the values are the same model on the held agent"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "string",
                                "enum": [
                                  "held_model_differs"
                                ]
                              },
                              "model": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The held model as the axes name it"
                              },
                              "resolved": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "minItems": 2,
                                "description": "The different models it resolves to on the tested agents"
                              },
                              "message": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The one plain sentence to show"
                              }
                            },
                            "required": [
                              "code",
                              "model",
                              "resolved",
                              "message"
                            ],
                            "additionalProperties": false,
                            "description": "Testing Agent: the held model is a different model on different agents"
                          }
                        ],
                        "description": "Why a run of these axes would be refused for a model they name: run start refuses with the first, in the axes' order"
                      },
                      "description": "Every model problem in the axes this save wrote, in their order, each with its sentence (the same decision run start refuses with). Empty when every model is one its agent runs, and when an update wrote no axes: name, description and judge edits are not checked, as agents are not"
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "workspaceId",
                    "createdById",
                    "ownerUserId",
                    "visibility",
                    "name",
                    "description",
                    "judgeModel",
                    "threshold",
                    "axes",
                    "createdAt",
                    "updatedAt",
                    "modelWarnings"
                  ],
                  "additionalProperties": false,
                  "description": "An Evaluation as saved, and the model warnings for the axes the save wrote"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "This `Idempotency-Key` was already used on a different request (code `idempotency_key_reused`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "benchmark.create",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n# One Idempotency-Key per request you mean to make once; send the same key again to retry it.\ncurl -sS --fail-with-body -X POST \"$CONTEXT_APP_ORIGIN/api/v1/evals/benchmarks\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  -H \"Idempotency-Key: $IDEMPOTENCY_KEY\" \\\n  --data-binary @- <<'JSON'\n{\n  \"name\": \"rest-writes refunds agent\",\n  \"threshold\": 80,\n  \"axes\": {\n    \"testing\": \"agent\",\n    \"values\": [\n      {\n        \"kind\": \"agent\",\n        \"agentId\": \"<agent id>\"\n      }\n    ],\n    \"held\": {\n      \"model\": {\n        \"kind\": \"agent_default\"\n      },\n      \"skills\": []\n    }\n  }\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.post(\n    f\"{origin}/api/v1/evals/benchmarks\",\n    headers={\"Authorization\": f\"Bearer {api_key}\", \"Idempotency-Key\": os.environ[\"IDEMPOTENCY_KEY\"]},\n    json={\n        \"name\": \"rest-writes refunds agent\",\n        \"threshold\": 80,\n        \"axes\": {\n            \"testing\": \"agent\",\n            \"values\": [\n                {\n                    \"kind\": \"agent\",\n                    \"agentId\": \"<agent id>\"\n                }\n            ],\n            \"held\": {\n                \"model\": {\n                    \"kind\": \"agent_default\"\n                },\n                \"skills\": []\n            }\n        }\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/benchmarks`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"name\": \"rest-writes refunds agent\",\n  \"threshold\": 80,\n  \"axes\": {\n    \"testing\": \"agent\",\n    \"values\": [\n      {\n        \"kind\": \"agent\",\n        \"agentId\": \"<agent id>\"\n      }\n    ],\n    \"held\": {\n      \"model\": {\n        \"kind\": \"agent_default\"\n      },\n      \"skills\": []\n    }\n  }\n}\nconst res = await fetch(url, {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\", \"Idempotency-Key\": env(\"IDEMPOTENCY_KEY\") },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/benchmarks/{evaluationId}": {
      "get": {
        "tags": [
          "Evaluations"
        ],
        "summary": "Get an evaluation",
        "description": "Returns one benchmark: its axes, judge model and pass threshold, and where it is placed. A benchmark outside your organization or your workspaces answers 404, the same as a missing one.",
        "operationId": "getBenchmark",
        "parameters": [
          {
            "in": "path",
            "name": "evaluationId",
            "required": true,
            "description": "Evaluation identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Evaluation identifier"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique evaluation identifier"
                    },
                    "orgId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Organization that owns this evaluation"
                    },
                    "workspaceId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "The workspace this evaluation belongs to; null means organization-wide, shown in every workspace"
                    },
                    "createdById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "User who created this evaluation"
                    },
                    "ownerUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "The person who owns this evaluation; null for evaluations made before owners were recorded (organization-wide, and changeable by an organization admin)"
                    },
                    "visibility": {
                      "type": "string",
                      "enum": [
                        "org",
                        "workspace",
                        "personal"
                      ],
                      "description": "Where this evaluation is placed: organization-wide, shared into its workspace, or private to its owner"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "Evaluation display name"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 2000,
                      "description": "Optional evaluation description"
                    },
                    "judgeModel": {
                      "type": "string",
                      "description": "The model that grades a dataset's or task's model criterion, unless the criterion names its own model"
                    },
                    "threshold": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "maximum": 100,
                      "description": "Pass threshold on the 0 to 100 result scale; null when the evaluation sets none"
                    },
                    "axes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "model"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "model"
                                    ]
                                  },
                                  "model": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "model"
                                ],
                                "additionalProperties": false,
                                "description": "A model the held agent runs"
                              },
                              "minItems": 1,
                              "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "agentId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An agent in the evaluation's organization"
                                },
                                "skills": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          }
                                        },
                                        "required": [
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A skill, at its newest version (no version given) or a pinned version number"
                                      },
                                      {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      }
                                    ],
                                    "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                  },
                                  "maxItems": 20,
                                  "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                }
                              },
                              "required": [
                                "agentId",
                                "skills"
                              ],
                              "additionalProperties": false,
                              "description": "The agent every model runs on, and the skills it runs with"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Model: one agent and its skills are held fixed"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "skill"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "skill"
                                        ]
                                      },
                                      "skillId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      },
                                      "version": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "skillId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A skill the held agent runs with, at its newest version or a pinned one"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "no_skill"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                  }
                                ]
                              },
                              "minItems": 1,
                              "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "agentId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An agent in the evaluation's organization"
                                },
                                "model": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "agent_default"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false,
                                      "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "model"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "model"
                                      ],
                                      "additionalProperties": false,
                                      "description": "One model that every agent in the evaluation runs"
                                    }
                                  ],
                                  "description": "The model held fixed when Model is not the tested axis"
                                }
                              },
                              "required": [
                                "agentId",
                                "model"
                              ],
                              "additionalProperties": false,
                              "description": "The agent every skill runs on, and the model it runs"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Skill: one agent and its model are held fixed"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "agent"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "agent"
                                    ]
                                  },
                                  "agentId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "An agent in the evaluation's organization"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "agentId"
                                ],
                                "additionalProperties": false,
                                "description": "An agent"
                              },
                              "minItems": 1,
                              "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "model": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "agent_default"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false,
                                      "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "model"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "model"
                                      ],
                                      "additionalProperties": false,
                                      "description": "One model that every agent in the evaluation runs"
                                    }
                                  ],
                                  "description": "The model held fixed when Model is not the tested axis"
                                },
                                "skills": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          }
                                        },
                                        "required": [
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A skill, at its newest version (no version given) or a pinned version number"
                                      },
                                      {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      }
                                    ],
                                    "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                  },
                                  "maxItems": 20,
                                  "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                }
                              },
                              "required": [
                                "model",
                                "skills"
                              ],
                              "additionalProperties": false,
                              "description": "The model every agent runs (one they can all run, or each agent's own default), and the skills they run with"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Agent: the model and the skills are held fixed"
                        }
                      ],
                      "description": "The question this evaluation asks: the one axis it tests, the values it compares, and what it holds fixed. Editable at any time; each run keeps its own copy from when it started."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "workspaceId",
                    "createdById",
                    "ownerUserId",
                    "visibility",
                    "name",
                    "description",
                    "judgeModel",
                    "threshold",
                    "axes",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false,
                  "description": "An evaluation: the datasets it measures, its axes (what it tests and what it holds fixed), the default judge model for the datasets' criteria, and its pass threshold. It has no grading criteria of its own."
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/benchmarks/$EVALUATION_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nevaluation_id = os.environ[\"EVALUATION_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/benchmarks/{evaluation_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/benchmarks/${encodeURIComponent(env(\"EVALUATION_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      },
      "patch": {
        "tags": [
          "Evaluations"
        ],
        "summary": "Edit an Evaluation",
        "description": "Changes only the fields you send. New `axes` replace the stored ones whole; runs already made keep the copy they froze.",
        "operationId": "updateBenchmark",
        "parameters": [
          {
            "in": "path",
            "name": "evaluationId",
            "required": true,
            "description": "Evaluation identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Evaluation (from the path)"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "New name"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000,
                    "description": "New description (null to clear)"
                  },
                  "judgeModel": {
                    "type": "string",
                    "description": "New default judge model"
                  },
                  "threshold": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 100,
                    "description": "New pass threshold (0-100), or null to clear. A reading line, not part of what a run measures: no new version is cut."
                  },
                  "axes": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "testing": {
                            "type": "string",
                            "enum": [
                              "model"
                            ]
                          },
                          "values": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "model"
                                  ]
                                },
                                "model": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200,
                                  "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                }
                              },
                              "required": [
                                "kind",
                                "model"
                              ],
                              "additionalProperties": false,
                              "description": "A model the held agent runs"
                            },
                            "minItems": 1,
                            "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                          },
                          "held": {
                            "type": "object",
                            "properties": {
                              "agentId": {
                                "type": "string",
                                "minLength": 1,
                                "description": "An agent in the evaluation's organization"
                              },
                              "skills": {
                                "type": "array",
                                "items": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "skillId": {
                                          "type": "string",
                                          "minLength": 1,
                                          "description": "A skill in the evaluation's organization"
                                        },
                                        "version": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                        }
                                      },
                                      "required": [
                                        "skillId"
                                      ],
                                      "additionalProperties": false,
                                      "description": "A skill, at its newest version (no version given) or a pinned version number"
                                    },
                                    {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "A skill in the evaluation's organization"
                                    }
                                  ],
                                  "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                },
                                "maxItems": 20,
                                "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                              }
                            },
                            "required": [
                              "agentId",
                              "skills"
                            ],
                            "additionalProperties": false,
                            "description": "The agent every model runs on, and the skills it runs with"
                          }
                        },
                        "required": [
                          "testing",
                          "values",
                          "held"
                        ],
                        "additionalProperties": false,
                        "description": "Testing Model: one agent and its skills are held fixed"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "testing": {
                            "type": "string",
                            "enum": [
                              "skill"
                            ]
                          },
                          "values": {
                            "type": "array",
                            "items": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "skill"
                                      ]
                                    },
                                    "skillId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "A skill in the evaluation's organization"
                                    },
                                    "version": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "skillId"
                                  ],
                                  "additionalProperties": false,
                                  "description": "A skill the held agent runs with, at its newest version or a pinned one"
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "no_skill"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                }
                              ]
                            },
                            "minItems": 1,
                            "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                          },
                          "held": {
                            "type": "object",
                            "properties": {
                              "agentId": {
                                "type": "string",
                                "minLength": 1,
                                "description": "An agent in the evaluation's organization"
                              },
                              "model": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent_default"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "One model that every agent in the evaluation runs"
                                  }
                                ],
                                "description": "The model held fixed when Model is not the tested axis"
                              }
                            },
                            "required": [
                              "agentId",
                              "model"
                            ],
                            "additionalProperties": false,
                            "description": "The agent every skill runs on, and the model it runs"
                          }
                        },
                        "required": [
                          "testing",
                          "values",
                          "held"
                        ],
                        "additionalProperties": false,
                        "description": "Testing Skill: one agent and its model are held fixed"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "testing": {
                            "type": "string",
                            "enum": [
                              "agent"
                            ]
                          },
                          "values": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "agent"
                                  ]
                                },
                                "agentId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An agent in the evaluation's organization"
                                }
                              },
                              "required": [
                                "kind",
                                "agentId"
                              ],
                              "additionalProperties": false,
                              "description": "An agent"
                            },
                            "minItems": 1,
                            "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                          },
                          "held": {
                            "type": "object",
                            "properties": {
                              "model": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent_default"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "One model that every agent in the evaluation runs"
                                  }
                                ],
                                "description": "The model held fixed when Model is not the tested axis"
                              },
                              "skills": {
                                "type": "array",
                                "items": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "skillId": {
                                          "type": "string",
                                          "minLength": 1,
                                          "description": "A skill in the evaluation's organization"
                                        },
                                        "version": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                        }
                                      },
                                      "required": [
                                        "skillId"
                                      ],
                                      "additionalProperties": false,
                                      "description": "A skill, at its newest version (no version given) or a pinned version number"
                                    },
                                    {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "A skill in the evaluation's organization"
                                    }
                                  ],
                                  "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                },
                                "maxItems": 20,
                                "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                              }
                            },
                            "required": [
                              "model",
                              "skills"
                            ],
                            "additionalProperties": false,
                            "description": "The model every agent runs (one they can all run, or each agent's own default), and the skills they run with"
                          }
                        },
                        "required": [
                          "testing",
                          "values",
                          "held"
                        ],
                        "additionalProperties": false,
                        "description": "Testing Agent: the model and the skills are held fixed"
                      }
                    ],
                    "description": "New axes, replacing the stored ones whole. Allowed after runs exist: each run keeps the copy it froze, skill versions included. Every agent in the new axes must be one the caller can run and every skill one they can read (a pinned version must still exist), else FORBIDDEN with AxesRefusalSchema data. No new version is cut"
                  }
                },
                "additionalProperties": false,
                "description": "Input for updating an existing Evaluation"
              },
              "example": {
                "threshold": 90
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique evaluation identifier"
                    },
                    "orgId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Organization that owns this evaluation"
                    },
                    "workspaceId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "The workspace this evaluation belongs to; null means organization-wide, shown in every workspace"
                    },
                    "createdById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "User who created this evaluation"
                    },
                    "ownerUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "The person who owns this evaluation; null for evaluations made before owners were recorded (organization-wide, and changeable by an organization admin)"
                    },
                    "visibility": {
                      "type": "string",
                      "enum": [
                        "org",
                        "workspace",
                        "personal"
                      ],
                      "description": "Where this evaluation is placed: organization-wide, shared into its workspace, or private to its owner"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "Evaluation display name"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 2000,
                      "description": "Optional evaluation description"
                    },
                    "judgeModel": {
                      "type": "string",
                      "description": "The model that grades a dataset's or task's model criterion, unless the criterion names its own model"
                    },
                    "threshold": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "maximum": 100,
                      "description": "Pass threshold on the 0 to 100 result scale; null when the evaluation sets none"
                    },
                    "axes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "model"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "model"
                                    ]
                                  },
                                  "model": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "model"
                                ],
                                "additionalProperties": false,
                                "description": "A model the held agent runs"
                              },
                              "minItems": 1,
                              "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "agentId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An agent in the evaluation's organization"
                                },
                                "skills": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          }
                                        },
                                        "required": [
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A skill, at its newest version (no version given) or a pinned version number"
                                      },
                                      {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      }
                                    ],
                                    "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                  },
                                  "maxItems": 20,
                                  "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                }
                              },
                              "required": [
                                "agentId",
                                "skills"
                              ],
                              "additionalProperties": false,
                              "description": "The agent every model runs on, and the skills it runs with"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Model: one agent and its skills are held fixed"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "skill"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "skill"
                                        ]
                                      },
                                      "skillId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      },
                                      "version": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "skillId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A skill the held agent runs with, at its newest version or a pinned one"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "no_skill"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                  }
                                ]
                              },
                              "minItems": 1,
                              "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "agentId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An agent in the evaluation's organization"
                                },
                                "model": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "agent_default"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false,
                                      "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "model"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "model"
                                      ],
                                      "additionalProperties": false,
                                      "description": "One model that every agent in the evaluation runs"
                                    }
                                  ],
                                  "description": "The model held fixed when Model is not the tested axis"
                                }
                              },
                              "required": [
                                "agentId",
                                "model"
                              ],
                              "additionalProperties": false,
                              "description": "The agent every skill runs on, and the model it runs"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Skill: one agent and its model are held fixed"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "agent"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "agent"
                                    ]
                                  },
                                  "agentId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "An agent in the evaluation's organization"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "agentId"
                                ],
                                "additionalProperties": false,
                                "description": "An agent"
                              },
                              "minItems": 1,
                              "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "model": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "agent_default"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false,
                                      "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "model"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "model"
                                      ],
                                      "additionalProperties": false,
                                      "description": "One model that every agent in the evaluation runs"
                                    }
                                  ],
                                  "description": "The model held fixed when Model is not the tested axis"
                                },
                                "skills": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          }
                                        },
                                        "required": [
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A skill, at its newest version (no version given) or a pinned version number"
                                      },
                                      {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      }
                                    ],
                                    "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                  },
                                  "maxItems": 20,
                                  "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                }
                              },
                              "required": [
                                "model",
                                "skills"
                              ],
                              "additionalProperties": false,
                              "description": "The model every agent runs (one they can all run, or each agent's own default), and the skills they run with"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Agent: the model and the skills are held fixed"
                        }
                      ],
                      "description": "The question this evaluation asks: the one axis it tests, the values it compares, and what it holds fixed. Editable at any time; each run keeps its own copy from when it started."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    },
                    "modelWarnings": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "string",
                                "enum": [
                                  "model_not_runnable"
                                ]
                              },
                              "agentId": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The agent that would run the model"
                              },
                              "model": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The model as the axes name it"
                              },
                              "message": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The one plain sentence to show. Run start's refusal adds the models the agent can run, for a caller that can use the list"
                              }
                            },
                            "required": [
                              "code",
                              "agentId",
                              "model",
                              "message"
                            ],
                            "additionalProperties": false,
                            "description": "This agent cannot run this model"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "string",
                                "enum": [
                                  "models_resolve_to_one"
                                ]
                              },
                              "model": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The one model two tested values resolve to"
                              },
                              "message": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The one plain sentence to show"
                              }
                            },
                            "required": [
                              "code",
                              "model",
                              "message"
                            ],
                            "additionalProperties": false,
                            "description": "Testing Model: two of the values are the same model on the held agent"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "string",
                                "enum": [
                                  "held_model_differs"
                                ]
                              },
                              "model": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The held model as the axes name it"
                              },
                              "resolved": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "minItems": 2,
                                "description": "The different models it resolves to on the tested agents"
                              },
                              "message": {
                                "type": "string",
                                "minLength": 1,
                                "description": "The one plain sentence to show"
                              }
                            },
                            "required": [
                              "code",
                              "model",
                              "resolved",
                              "message"
                            ],
                            "additionalProperties": false,
                            "description": "Testing Agent: the held model is a different model on different agents"
                          }
                        ],
                        "description": "Why a run of these axes would be refused for a model they name: run start refuses with the first, in the axes' order"
                      },
                      "description": "Every model problem in the axes this save wrote, in their order, each with its sentence (the same decision run start refuses with). Empty when every model is one its agent runs, and when an update wrote no axes: name, description and judge edits are not checked, as agents are not"
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "workspaceId",
                    "createdById",
                    "ownerUserId",
                    "visibility",
                    "name",
                    "description",
                    "judgeModel",
                    "threshold",
                    "axes",
                    "createdAt",
                    "updatedAt",
                    "modelWarnings"
                  ],
                  "additionalProperties": false,
                  "description": "An Evaluation as saved, and the model warnings for the axes the save wrote"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "benchmark.update",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body -X PATCH \"$CONTEXT_APP_ORIGIN/api/v1/evals/benchmarks/$EVALUATION_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary @- <<'JSON'\n{\n  \"threshold\": 90\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nevaluation_id = os.environ[\"EVALUATION_ID\"]\n\nresp = requests.patch(\n    f\"{origin}/api/v1/evals/benchmarks/{evaluation_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    json={\n        \"threshold\": 90\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/benchmarks/${encodeURIComponent(env(\"EVALUATION_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"threshold\": 90\n}\nconst res = await fetch(url, {\n  method: \"PATCH\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/benchmarks/{evaluationId}/datasets": {
      "get": {
        "tags": [
          "Evaluations"
        ],
        "summary": "List an evaluation's dataset links",
        "description": "One link row per dataset the evaluation measures, `{id, evaluationId, datasetId, order}`, sorted by `order`; archived datasets are left out. Fetch each dataset with `GET /datasets/{datasetId}`.",
        "operationId": "listBenchmarkDatasets",
        "parameters": [
          {
            "in": "path",
            "name": "evaluationId",
            "required": true,
            "description": "Evaluation identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Evaluation identifier"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Unique link identifier"
                      },
                      "evaluationId": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Parent evaluation"
                      },
                      "datasetId": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Linked dataset"
                      },
                      "order": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Display and run order within the evaluation"
                      }
                    },
                    "required": [
                      "id",
                      "evaluationId",
                      "datasetId",
                      "order"
                    ],
                    "additionalProperties": false,
                    "description": "Ordered link between an evaluation and a dataset (many to many)"
                  },
                  "description": "Dataset links for the evaluation"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/benchmarks/$EVALUATION_ID/datasets\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nevaluation_id = os.environ[\"EVALUATION_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/benchmarks/{evaluation_id}/datasets\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/benchmarks/${encodeURIComponent(env(\"EVALUATION_ID\"))}/datasets`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      },
      "post": {
        "tags": [
          "Evaluations"
        ],
        "summary": "Link a dataset to an Evaluation",
        "description": "A run of the Evaluation grades each linked dataset's latest saved version.",
        "operationId": "linkBenchmarkDataset",
        "parameters": [
          {
            "in": "path",
            "name": "evaluationId",
            "required": true,
            "description": "Evaluation identifier",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "datasetId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "order": {
                    "type": "integer",
                    "minimum": 0,
                    "default": 0
                  }
                },
                "required": [
                  "datasetId"
                ],
                "additionalProperties": false
              },
              "example": {
                "datasetId": "<dataset id>"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique link identifier"
                    },
                    "evaluationId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Parent evaluation"
                    },
                    "datasetId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Linked dataset"
                    },
                    "order": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Display and run order within the evaluation"
                    }
                  },
                  "required": [
                    "id",
                    "evaluationId",
                    "datasetId",
                    "order"
                  ],
                  "additionalProperties": false,
                  "description": "Ordered link between an evaluation and a dataset (many to many)"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "benchmark.linkDataset",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body -X POST \"$CONTEXT_APP_ORIGIN/api/v1/evals/benchmarks/$EVALUATION_ID/datasets\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary @- <<'JSON'\n{\n  \"datasetId\": \"<dataset id>\"\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nevaluation_id = os.environ[\"EVALUATION_ID\"]\n\nresp = requests.post(\n    f\"{origin}/api/v1/evals/benchmarks/{evaluation_id}/datasets\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    json={\n        \"datasetId\": \"<dataset id>\"\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/benchmarks/${encodeURIComponent(env(\"EVALUATION_ID\"))}/datasets`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"datasetId\": \"<dataset id>\"\n}\nconst res = await fetch(url, {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/benchmarks/{evaluationId}/runs": {
      "get": {
        "tags": [
          "Runs"
        ],
        "summary": "List an evaluation's runs, newest first",
        "description": "Returns the benchmark's runs, newest first, each with the axes and cells it froze, its status and its progress counts. For a run's results, use `GET /runs/{runId}/status`.",
        "operationId": "listBenchmarkRuns",
        "parameters": [
          {
            "in": "path",
            "name": "evaluationId",
            "required": true,
            "description": "Evaluation identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Evaluation identifier"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Unique run identifier"
                      },
                      "orgId": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Organization that owns this run"
                      },
                      "evaluationId": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Evaluation being run"
                      },
                      "topicId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "Workflow this run belongs to; null for a run started from the app's evaluations view"
                      },
                      "evaluationVersionId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "Evaluation version this run uses; null only for runs created before evaluation versions existed"
                      },
                      "runById": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "User who started this run"
                      },
                      "axes": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "testing": {
                                "type": "string",
                                "enum": [
                                  "model"
                                ]
                              },
                              "values": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "model"
                                      ]
                                    },
                                    "model": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "model"
                                  ],
                                  "additionalProperties": false,
                                  "description": "A model the held agent runs"
                                },
                                "minItems": 1,
                                "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                              },
                              "held": {
                                "type": "object",
                                "properties": {
                                  "agentId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "An agent in the evaluation's organization"
                                  },
                                  "skills": {
                                    "type": "array",
                                    "items": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "skillId": {
                                              "type": "string",
                                              "minLength": 1,
                                              "description": "A skill in the evaluation's organization"
                                            },
                                            "version": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                            },
                                            "versionId": {
                                              "type": "string",
                                              "minLength": 1,
                                              "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                            },
                                            "followsLatest": {
                                              "type": "boolean",
                                              "enum": [
                                                true
                                              ],
                                              "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                            }
                                          },
                                          "required": [
                                            "skillId"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "string",
                                          "minLength": 1,
                                          "description": "A skill in the evaluation's organization"
                                        }
                                      ],
                                      "description": "A held skill as fixed by the run. A skill ID on its own means the run started before versions were fixed."
                                    },
                                    "maxItems": 20,
                                    "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                  }
                                },
                                "required": [
                                  "agentId",
                                  "skills"
                                ],
                                "additionalProperties": false,
                                "description": "The agent every model ran on, and the skills it ran with, each at its fixed version"
                              }
                            },
                            "required": [
                              "testing",
                              "values",
                              "held"
                            ],
                            "additionalProperties": false,
                            "description": "Testing Model: one agent and its skills are held fixed"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "testing": {
                                "type": "string",
                                "enum": [
                                  "skill"
                                ]
                              },
                              "values": {
                                "type": "array",
                                "items": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "skill"
                                          ]
                                        },
                                        "skillId": {
                                          "type": "string",
                                          "minLength": 1,
                                          "description": "A skill in the evaluation's organization"
                                        },
                                        "version": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                        },
                                        "versionId": {
                                          "type": "string",
                                          "minLength": 1,
                                          "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                        },
                                        "followsLatest": {
                                          "type": "boolean",
                                          "enum": [
                                            true
                                          ],
                                          "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "skillId"
                                      ],
                                      "additionalProperties": false,
                                      "description": "A tested skill as fixed by the run: the version it runs"
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "no_skill"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false,
                                      "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                    }
                                  ]
                                },
                                "minItems": 1,
                                "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                              },
                              "held": {
                                "type": "object",
                                "properties": {
                                  "agentId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "An agent in the evaluation's organization"
                                  },
                                  "model": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "agent_default"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false,
                                        "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "model"
                                            ]
                                          },
                                          "model": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 200,
                                            "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "model"
                                        ],
                                        "additionalProperties": false,
                                        "description": "One model that every agent in the evaluation runs"
                                      }
                                    ],
                                    "description": "The model held fixed when Model is not the tested axis"
                                  }
                                },
                                "required": [
                                  "agentId",
                                  "model"
                                ],
                                "additionalProperties": false,
                                "description": "The agent every skill runs on, and the model it runs"
                              }
                            },
                            "required": [
                              "testing",
                              "values",
                              "held"
                            ],
                            "additionalProperties": false,
                            "description": "Testing Skill: one agent and its model are held fixed"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "testing": {
                                "type": "string",
                                "enum": [
                                  "agent"
                                ]
                              },
                              "values": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "agent"
                                      ]
                                    },
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "agentId"
                                  ],
                                  "additionalProperties": false,
                                  "description": "An agent"
                                },
                                "minItems": 1,
                                "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                              },
                              "held": {
                                "type": "object",
                                "properties": {
                                  "model": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "agent_default"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false,
                                        "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "model"
                                            ]
                                          },
                                          "model": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 200,
                                            "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "model"
                                        ],
                                        "additionalProperties": false,
                                        "description": "One model that every agent in the evaluation runs"
                                      }
                                    ],
                                    "description": "The model held fixed when Model is not the tested axis"
                                  },
                                  "skills": {
                                    "type": "array",
                                    "items": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "skillId": {
                                              "type": "string",
                                              "minLength": 1,
                                              "description": "A skill in the evaluation's organization"
                                            },
                                            "version": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                            },
                                            "versionId": {
                                              "type": "string",
                                              "minLength": 1,
                                              "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                            },
                                            "followsLatest": {
                                              "type": "boolean",
                                              "enum": [
                                                true
                                              ],
                                              "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                            }
                                          },
                                          "required": [
                                            "skillId"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "string",
                                          "minLength": 1,
                                          "description": "A skill in the evaluation's organization"
                                        }
                                      ],
                                      "description": "A held skill as fixed by the run. A skill ID on its own means the run started before versions were fixed."
                                    },
                                    "maxItems": 20,
                                    "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                  }
                                },
                                "required": [
                                  "model",
                                  "skills"
                                ],
                                "additionalProperties": false,
                                "description": "The model every agent ran, and the skills they ran with, each at its fixed version"
                              }
                            },
                            "required": [
                              "testing",
                              "values",
                              "held"
                            ],
                            "additionalProperties": false,
                            "description": "Testing Agent: the model and the skills are held fixed"
                          }
                        ],
                        "description": "The axes a run executed, fixed when it started, with every model resolved and every skill version fixed. Reports use these, not the evaluation's current settings."
                      },
                      "cells": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "cellId": {
                              "type": "string",
                              "format": "uuid",
                              "description": "Identifies one cell within its run. A run's results, dispatches, and exports are keyed by it."
                            },
                            "value": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "model"
                                      ]
                                    },
                                    "model": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "model"
                                  ],
                                  "additionalProperties": false,
                                  "description": "A model the held agent runs"
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "skill"
                                      ]
                                    },
                                    "skillId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "A skill in the evaluation's organization"
                                    },
                                    "version": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                    },
                                    "versionId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                    },
                                    "followsLatest": {
                                      "type": "boolean",
                                      "enum": [
                                        true
                                      ],
                                      "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "skillId"
                                  ],
                                  "additionalProperties": false,
                                  "description": "A tested skill as fixed by the run: the version it runs"
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "no_skill"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "agent"
                                      ]
                                    },
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "agentId"
                                  ],
                                  "additionalProperties": false,
                                  "description": "An agent"
                                }
                              ],
                              "description": "The tested value this cell ran: one of the run's `axes.values`"
                            },
                            "attempt": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5,
                              "description": "Which repeat of that value this is, starting at 1 (shown as \"Run n\"); a run with one run per task has only 1"
                            }
                          },
                          "required": [
                            "cellId",
                            "value",
                            "attempt"
                          ],
                          "additionalProperties": false,
                          "description": "One (value x repeat) of a run. Every task in the run runs once per cell."
                        },
                        "minItems": 1,
                        "description": "The run's cells, ordered by value (in the axes' order), then by repeat within each value: number of values x runs per task"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "PENDING",
                          "RUNNING",
                          "EVALUATING",
                          "COMPLETED",
                          "FAILED",
                          "STOPPED",
                          "UNKNOWN"
                        ],
                        "description": "Current run status, or `UNKNOWN` when the stored value is not one of the allowed values"
                      },
                      "taskCount": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Total number of (task x cell) pairs to run"
                      },
                      "completedCount": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Number of (task x cell) pairs completed so far"
                      },
                      "concurrency": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100,
                        "description": "Tasks run at once for this run (min 1, max 100 or the deployment's lower limit)."
                      },
                      "judgeConcurrency": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100,
                        "description": "Agent judges run at once for this run, across every task (min 1, max 100 or the deployment's lower limit). LLM judges and rules do not count."
                      },
                      "succeededCount": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Number of (task x cell) pairs whose task ended as succeeded"
                      },
                      "failedCount": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Number of (task x cell) pairs whose task ended as failed"
                      },
                      "cancelledCount": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Number of (task x cell) pairs whose task ended as canceled"
                      },
                      "judgedCount": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "description": "Result rows with a score: a judge score and no task error, or, on a criteria-graded run, a task where at least one criterion reached a verdict. Null until the run's totals are computed."
                      },
                      "passedCount": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "description": "Tasks the judge passed. Null for an evaluation scored on a 0 to 1 scale (no pass or fail), and null until the run's totals are computed."
                      },
                      "maskedCount": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "description": "Result rows left out of the score: the judge gave no score or the task errored, or, on a criteria-graded run, none of the task's criteria reached a verdict (they could not run). Null until the run's totals are computed."
                      },
                      "avgScore": {
                        "type": [
                          "number",
                          "null"
                        ],
                        "description": "Mean judged score on the standard 0 to 1 scale. Null until the run's totals are computed, or when nothing was judged."
                      },
                      "heldOutJudgedCount": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "description": "`judgedCount` for the run's held-out tasks only (tasks the system never learns from). Null until the run's totals are computed, or when the totals come from older stored results that do not record which tasks are held out."
                      },
                      "heldOutAvgScore": {
                        "type": [
                          "number",
                          "null"
                        ],
                        "description": "`avgScore` for the run's held-out tasks only, on the same 0 to 1 scale. Null when `heldOutJudgedCount` is null or 0."
                      },
                      "costUsd": {
                        "type": [
                          "number",
                          "null"
                        ],
                        "description": "Task cost plus judge cost for the whole run, in dollars (USD). Null when any part is unknown (never a partial sum)."
                      },
                      "resolvedMismatch": {
                        "type": "boolean",
                        "description": "True when any dispatch was served by a different model than its cell asked for. This is a notice only: the run's result and every list, trend, and chart still show its score."
                      },
                      "resolvedUnknownCount": {
                        "type": [
                          "integer",
                          "null"
                        ],
                        "minimum": 0,
                        "description": "Dispatches whose serving model could not be identified from billing when the run finished. This is not a mismatch, only unknown, and it never holds back the run's result. Null until the run's totals are computed."
                      },
                      "costUnknownReason": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "enum": [
                          "ledger_not_final",
                          "device_calls_unbounded",
                          "no_rows",
                          "unrated_rows",
                          "warehouse_session_missing",
                          "judge_cost_unknown",
                          "ledger_reroll_failed",
                          null
                        ],
                        "description": "Why `costUsd` is null on an ended run, by order of precedence. Null when the cost is known, while the run is still going, and on an ended run whose totals have not been computed."
                      },
                      "startedAt": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time",
                        "description": "When the run started"
                      },
                      "completedAt": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time",
                        "description": "When the run finished, whether it succeeded or failed"
                      },
                      "error": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Error message if the run failed"
                      },
                      "stopRequestedAt": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time",
                        "description": "When someone asked to stop the run, or null if nobody did. It is set while the run is still going: the run counts as stopping until its status is `STOPPED`."
                      },
                      "stopRequestedByUserId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "Who asked to stop the run: the person, or the person an agent acts for when an agent asked. Null when nobody did."
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Creation timestamp"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Last update timestamp"
                      }
                    },
                    "required": [
                      "id",
                      "orgId",
                      "evaluationId",
                      "topicId",
                      "evaluationVersionId",
                      "runById",
                      "axes",
                      "cells",
                      "taskCount",
                      "completedCount",
                      "concurrency",
                      "judgeConcurrency",
                      "succeededCount",
                      "failedCount",
                      "cancelledCount",
                      "judgedCount",
                      "passedCount",
                      "maskedCount",
                      "avgScore",
                      "heldOutJudgedCount",
                      "heldOutAvgScore",
                      "costUsd",
                      "resolvedMismatch",
                      "resolvedUnknownCount",
                      "costUnknownReason",
                      "startedAt",
                      "completedAt",
                      "error",
                      "stopRequestedAt",
                      "stopRequestedByUserId",
                      "createdAt",
                      "updatedAt"
                    ],
                    "additionalProperties": false,
                    "description": "One execution of an evaluation: the axes it fixed when it started, its cells, and its progress"
                  },
                  "description": "Runs belonging to the evaluation"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/benchmarks/$EVALUATION_ID/runs\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nevaluation_id = os.environ[\"EVALUATION_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/benchmarks/{evaluation_id}/runs\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/benchmarks/${encodeURIComponent(env(\"EVALUATION_ID\"))}/runs`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      },
      "post": {
        "tags": [
          "Runs"
        ],
        "summary": "Start a run",
        "description": "Runs the Evaluation's axes as they stand over each linked dataset's latest saved version, as you, and answers the run (its `id` is what `GET /runs/{runId}/status` reads). A run costs money: send an `Idempotency-Key` so a retry after a timeout answers the same run instead of starting a second one. Refused 409 `datasets_unsaved` when the linked datasets hold tasks only in unsaved changes.",
        "operationId": "createBenchmarkRun",
        "parameters": [
          {
            "in": "path",
            "name": "evaluationId",
            "required": true,
            "description": "Evaluation identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Benchmark to execute"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "description": "A key you choose for this request (a UUID works; at most 255 characters; a blank one is refused 400, code `idempotency_key_empty`). A retry with the same key and the same body answers the first success again instead of acting twice; kept 24 hours. Send one on every create and run start you might retry.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "runsPerTask": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5,
                    "default": 1,
                    "description": "Times each task runs for each value of the tested axis (1-5, default 1)"
                  },
                  "concurrency": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "Tasks at once for this run. Omit to use this deployment's default: a quarter of its limit, at most 10 (benchmark.get's runConcurrency gives the numbers). Range: 1-100. The limit is the deployment's Evals sandbox cap, or its sandbox provider's cap when lower: it and judgeConcurrency together may not exceed it; above it the run is refused."
                  },
                  "judgeConcurrency": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "Agent judges at once for this run, across every task (LLM judges and rules are not counted). Omit to use this deployment's default: twice the tasks at once, at most 20, within what the deployment's limit leaves. Range: 1-100."
                  },
                  "sample": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "all"
                            ]
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "additionalProperties": false,
                        "description": "Measure every task"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "sample"
                            ]
                          },
                          "size": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "description": "Tasks to draw; a size at or above the task count measures every task"
                          },
                          "seed": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 4294967295,
                            "description": "Omit to draw a fresh seed; the one used is frozen on the run's version"
                          }
                        },
                        "required": [
                          "kind",
                          "size"
                        ],
                        "additionalProperties": false,
                        "description": "Measure a seeded random sample of the tasks"
                      }
                    ],
                    "description": "Every task (default) or a seeded sample; the draw is frozen on the run's version",
                    "default": {
                      "kind": "all"
                    }
                  }
                },
                "additionalProperties": false,
                "description": "Input for starting a run. A run executes the Evaluation's axes exactly as they stand, as the caller: it cannot change them. Refused with AxesRefusalSchema data when the caller cannot run one of the Evaluation's agents, an agent would stop to ask for approval, or an agent cannot run a model"
              },
              "example": {
                "runsPerTask": 1
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success. A retry with the same `Idempotency-Key` and the same request answers this again, with `Idempotent-Replayed: true`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique run identifier"
                    },
                    "orgId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Organization that owns this run"
                    },
                    "evaluationId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Evaluation being run"
                    },
                    "topicId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Workflow this run belongs to; null for a run started from the app's evaluations view"
                    },
                    "evaluationVersionId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Evaluation version this run uses; null only for runs created before evaluation versions existed"
                    },
                    "runById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "User who started this run"
                    },
                    "axes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "model"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "model"
                                    ]
                                  },
                                  "model": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "model"
                                ],
                                "additionalProperties": false,
                                "description": "A model the held agent runs"
                              },
                              "minItems": 1,
                              "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "agentId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An agent in the evaluation's organization"
                                },
                                "skills": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          },
                                          "versionId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                          },
                                          "followsLatest": {
                                            "type": "boolean",
                                            "enum": [
                                              true
                                            ],
                                            "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                          }
                                        },
                                        "required": [
                                          "skillId"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      }
                                    ],
                                    "description": "A held skill as fixed by the run. A skill ID on its own means the run started before versions were fixed."
                                  },
                                  "maxItems": 20,
                                  "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                }
                              },
                              "required": [
                                "agentId",
                                "skills"
                              ],
                              "additionalProperties": false,
                              "description": "The agent every model ran on, and the skills it ran with, each at its fixed version"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Model: one agent and its skills are held fixed"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "skill"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "skill"
                                        ]
                                      },
                                      "skillId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      },
                                      "version": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                      },
                                      "versionId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                      },
                                      "followsLatest": {
                                        "type": "boolean",
                                        "enum": [
                                          true
                                        ],
                                        "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "skillId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A tested skill as fixed by the run: the version it runs"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "no_skill"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                  }
                                ]
                              },
                              "minItems": 1,
                              "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "agentId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An agent in the evaluation's organization"
                                },
                                "model": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "agent_default"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false,
                                      "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "model"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "model"
                                      ],
                                      "additionalProperties": false,
                                      "description": "One model that every agent in the evaluation runs"
                                    }
                                  ],
                                  "description": "The model held fixed when Model is not the tested axis"
                                }
                              },
                              "required": [
                                "agentId",
                                "model"
                              ],
                              "additionalProperties": false,
                              "description": "The agent every skill runs on, and the model it runs"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Skill: one agent and its model are held fixed"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "agent"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "agent"
                                    ]
                                  },
                                  "agentId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "An agent in the evaluation's organization"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "agentId"
                                ],
                                "additionalProperties": false,
                                "description": "An agent"
                              },
                              "minItems": 1,
                              "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "model": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "agent_default"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false,
                                      "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "model"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "model"
                                      ],
                                      "additionalProperties": false,
                                      "description": "One model that every agent in the evaluation runs"
                                    }
                                  ],
                                  "description": "The model held fixed when Model is not the tested axis"
                                },
                                "skills": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          },
                                          "versionId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                          },
                                          "followsLatest": {
                                            "type": "boolean",
                                            "enum": [
                                              true
                                            ],
                                            "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                          }
                                        },
                                        "required": [
                                          "skillId"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      }
                                    ],
                                    "description": "A held skill as fixed by the run. A skill ID on its own means the run started before versions were fixed."
                                  },
                                  "maxItems": 20,
                                  "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                }
                              },
                              "required": [
                                "model",
                                "skills"
                              ],
                              "additionalProperties": false,
                              "description": "The model every agent ran, and the skills they ran with, each at its fixed version"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Agent: the model and the skills are held fixed"
                        }
                      ],
                      "description": "The axes a run executed, fixed when it started, with every model resolved and every skill version fixed. Reports use these, not the evaluation's current settings."
                    },
                    "cells": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "cellId": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Identifies one cell within its run. A run's results, dispatches, and exports are keyed by it."
                          },
                          "value": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "model"
                                    ]
                                  },
                                  "model": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "model"
                                ],
                                "additionalProperties": false,
                                "description": "A model the held agent runs"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "skill"
                                    ]
                                  },
                                  "skillId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "A skill in the evaluation's organization"
                                  },
                                  "version": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                  },
                                  "versionId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                  },
                                  "followsLatest": {
                                    "type": "boolean",
                                    "enum": [
                                      true
                                    ],
                                    "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "skillId"
                                ],
                                "additionalProperties": false,
                                "description": "A tested skill as fixed by the run: the version it runs"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "no_skill"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false,
                                "description": "The held agent with no skill attached: the baseline a skill is compared against"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "agent"
                                    ]
                                  },
                                  "agentId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "An agent in the evaluation's organization"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "agentId"
                                ],
                                "additionalProperties": false,
                                "description": "An agent"
                              }
                            ],
                            "description": "The tested value this cell ran: one of the run's `axes.values`"
                          },
                          "attempt": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 5,
                            "description": "Which repeat of that value this is, starting at 1 (shown as \"Run n\"); a run with one run per task has only 1"
                          }
                        },
                        "required": [
                          "cellId",
                          "value",
                          "attempt"
                        ],
                        "additionalProperties": false,
                        "description": "One (value x repeat) of a run. Every task in the run runs once per cell."
                      },
                      "minItems": 1,
                      "description": "The run's cells, ordered by value (in the axes' order), then by repeat within each value: number of values x runs per task"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "PENDING",
                        "RUNNING",
                        "EVALUATING",
                        "COMPLETED",
                        "FAILED",
                        "STOPPED",
                        "UNKNOWN"
                      ],
                      "description": "Current run status, or `UNKNOWN` when the stored value is not one of the allowed values"
                    },
                    "taskCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Total number of (task x cell) pairs to run"
                    },
                    "completedCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of (task x cell) pairs completed so far"
                    },
                    "concurrency": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100,
                      "description": "Tasks run at once for this run (min 1, max 100 or the deployment's lower limit)."
                    },
                    "judgeConcurrency": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100,
                      "description": "Agent judges run at once for this run, across every task (min 1, max 100 or the deployment's lower limit). LLM judges and rules do not count."
                    },
                    "succeededCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of (task x cell) pairs whose task ended as succeeded"
                    },
                    "failedCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of (task x cell) pairs whose task ended as failed"
                    },
                    "cancelledCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of (task x cell) pairs whose task ended as canceled"
                    },
                    "judgedCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Result rows with a score: a judge score and no task error, or, on a criteria-graded run, a task where at least one criterion reached a verdict. Null until the run's totals are computed."
                    },
                    "passedCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Tasks the judge passed. Null for an evaluation scored on a 0 to 1 scale (no pass or fail), and null until the run's totals are computed."
                    },
                    "maskedCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Result rows left out of the score: the judge gave no score or the task errored, or, on a criteria-graded run, none of the task's criteria reached a verdict (they could not run). Null until the run's totals are computed."
                    },
                    "avgScore": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "Mean judged score on the standard 0 to 1 scale. Null until the run's totals are computed, or when nothing was judged."
                    },
                    "heldOutJudgedCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "`judgedCount` for the run's held-out tasks only (tasks the system never learns from). Null until the run's totals are computed, or when the totals come from older stored results that do not record which tasks are held out."
                    },
                    "heldOutAvgScore": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "`avgScore` for the run's held-out tasks only, on the same 0 to 1 scale. Null when `heldOutJudgedCount` is null or 0."
                    },
                    "costUsd": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "Task cost plus judge cost for the whole run, in dollars (USD). Null when any part is unknown (never a partial sum)."
                    },
                    "resolvedMismatch": {
                      "type": "boolean",
                      "description": "True when any dispatch was served by a different model than its cell asked for. This is a notice only: the run's result and every list, trend, and chart still show its score."
                    },
                    "resolvedUnknownCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Dispatches whose serving model could not be identified from billing when the run finished. This is not a mismatch, only unknown, and it never holds back the run's result. Null until the run's totals are computed."
                    },
                    "costUnknownReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "ledger_not_final",
                        "device_calls_unbounded",
                        "no_rows",
                        "unrated_rows",
                        "warehouse_session_missing",
                        "judge_cost_unknown",
                        "ledger_reroll_failed",
                        null
                      ],
                      "description": "Why `costUsd` is null on an ended run, by order of precedence. Null when the cost is known, while the run is still going, and on an ended run whose totals have not been computed."
                    },
                    "startedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the run started"
                    },
                    "completedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the run finished, whether it succeeded or failed"
                    },
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Error message if the run failed"
                    },
                    "stopRequestedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When someone asked to stop the run, or null if nobody did. It is set while the run is still going: the run counts as stopping until its status is `STOPPED`."
                    },
                    "stopRequestedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Who asked to stop the run: the person, or the person an agent acts for when an agent asked. Null when nobody did."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "evaluationId",
                    "topicId",
                    "evaluationVersionId",
                    "runById",
                    "axes",
                    "cells",
                    "taskCount",
                    "completedCount",
                    "concurrency",
                    "judgeConcurrency",
                    "succeededCount",
                    "failedCount",
                    "cancelledCount",
                    "judgedCount",
                    "passedCount",
                    "maskedCount",
                    "avgScore",
                    "heldOutJudgedCount",
                    "heldOutAvgScore",
                    "costUsd",
                    "resolvedMismatch",
                    "resolvedUnknownCount",
                    "costUnknownReason",
                    "startedAt",
                    "completedAt",
                    "error",
                    "stopRequestedAt",
                    "stopRequestedByUserId",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false,
                  "description": "One execution of an evaluation: the axes it fixed when it started, its cells, and its progress"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "This `Idempotency-Key` was already used on a different request (code `idempotency_key_reused`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "benchmark.createRun",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n# One Idempotency-Key per request you mean to make once; send the same key again to retry it.\ncurl -sS --fail-with-body -X POST \"$CONTEXT_APP_ORIGIN/api/v1/evals/benchmarks/$EVALUATION_ID/runs\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  -H \"Idempotency-Key: $IDEMPOTENCY_KEY\" \\\n  --data-binary @- <<'JSON'\n{\n  \"runsPerTask\": 1\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nevaluation_id = os.environ[\"EVALUATION_ID\"]\n\nresp = requests.post(\n    f\"{origin}/api/v1/evals/benchmarks/{evaluation_id}/runs\",\n    headers={\"Authorization\": f\"Bearer {api_key}\", \"Idempotency-Key\": os.environ[\"IDEMPOTENCY_KEY\"]},\n    json={\n        \"runsPerTask\": 1\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/benchmarks/${encodeURIComponent(env(\"EVALUATION_ID\"))}/runs`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"runsPerTask\": 1\n}\nconst res = await fetch(url, {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\", \"Idempotency-Key\": env(\"IDEMPOTENCY_KEY\") },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/datasets": {
      "get": {
        "tags": [
          "Datasets"
        ],
        "summary": "List datasets",
        "description": "Lists the datasets in the workspace scope you read; archived datasets are left out. Read a dataset's tasks with `GET /datasets/{datasetId}/items`.",
        "operationId": "listDatasets",
        "parameters": [
          {
            "in": "query",
            "name": "workspaceScope",
            "required": false,
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "all"
                          ]
                        }
                      },
                      "required": [
                        "kind"
                      ],
                      "additionalProperties": false,
                      "description": "Every workspace in the organization plus the organization-wide datasets; organization admins only"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "one"
                          ]
                        },
                        "workspaceId": {
                          "type": "string",
                          "minLength": 1,
                          "description": "The workspace the request is about"
                        }
                      },
                      "required": [
                        "kind",
                        "workspaceId"
                      ],
                      "additionalProperties": false,
                      "description": "One workspace: its datasets plus the organization-wide ones"
                    }
                  ],
                  "description": "Which workspace to read. When omitted: every workspace for an organization admin; your one workspace if your Evals access covers exactly one; otherwise 403 asking you to name a workspace."
                }
              }
            },
            "description": "Send it as JSON in one value, for example `workspaceScope={\"kind\":\"one\",\"workspaceId\":\"<id>\"}`. Any other value is refused with 400."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Unique dataset identifier"
                      },
                      "orgId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "Organization that owns this dataset"
                      },
                      "workspaceId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "The workspace this dataset belongs to; null means organization-wide, shown in every workspace"
                      },
                      "createdById": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "User who created this dataset"
                      },
                      "ownerUserId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "The person who owns this dataset; null for datasets made before owners were recorded (organization-wide, and changeable by an organization admin)"
                      },
                      "visibility": {
                        "type": "string",
                        "enum": [
                          "org",
                          "workspace",
                          "personal"
                        ],
                        "description": "Where this dataset is placed: organization-wide, shared into its workspace, or private to its owner"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200,
                        "description": "Dataset display name"
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 2000,
                        "description": "Optional dataset description"
                      },
                      "isPublic": {
                        "type": "boolean",
                        "description": "Whether this dataset is publicly shared"
                      },
                      "source": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "description": "Where the dataset came from (for example, `huggingface:openai/gsm8k`). Null for datasets created by hand."
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Creation timestamp"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Last update timestamp"
                      }
                    },
                    "required": [
                      "id",
                      "orgId",
                      "workspaceId",
                      "createdById",
                      "ownerUserId",
                      "visibility",
                      "name",
                      "description",
                      "isPublic",
                      "source",
                      "createdAt",
                      "updatedAt"
                    ],
                    "additionalProperties": false,
                    "description": "A collection of tasks (prompts) for evaluations"
                  },
                  "description": "Datasets the organization can access"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/datasets\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode 'workspaceScope={\"kind\":\"one\",\"workspaceId\":\"'\"$WORKSPACE_ID\"'\"}'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/datasets\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"workspaceScope\": json.dumps({\"kind\": \"one\", \"workspaceId\": os.environ[\"WORKSPACE_ID\"]})},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/datasets`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"workspaceScope\", JSON.stringify({ kind: \"one\", workspaceId: env(\"WORKSPACE_ID\") }))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      },
      "post": {
        "tags": [
          "Datasets"
        ],
        "summary": "Create a dataset",
        "description": "A new dataset, optionally with its first tasks. The dataset, its tasks and its version 1 are written together, so a run can grade them at once. In a workspace you can create in (`workspaceId`), or the one workspace you have.",
        "operationId": "createDataset",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "description": "A key you choose for this request (a UUID works; at most 255 characters; a blank one is refused 400, code `idempotency_key_empty`). A retry with the same key and the same body answers the first success again instead of acting twice; kept 24 hours. Send one on every create and run start you might retry.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "workspaceId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "description": "The workspace to create this in; null = organization-wide (organization admins only); omitted = the caller's only workspace, or every workspace for an organization admin"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "Dataset display name"
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000,
                    "description": "Optional description"
                  },
                  "tasks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 200,
                          "description": "Optional task label (null when the task has no name)"
                        },
                        "prompt": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100000,
                          "description": "Prompt to send to the agent (must be non-empty)"
                        },
                        "expectedOutput": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 100000,
                          "description": "Expected answer, or null when the task has none"
                        },
                        "fileIds": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1
                          },
                          "maxItems": 10,
                          "default": [],
                          "description": "Task file IDs already uploaded via createItemFileUpload (defaults to empty)"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "ready",
                            "draft",
                            "needs_review"
                          ],
                          "description": "Authoring state the task starts in"
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "manual",
                            "csv",
                            "trace",
                            "huggingface",
                            "generated"
                          ],
                          "description": "Where the task came from"
                        }
                      },
                      "required": [
                        "name",
                        "prompt",
                        "expectedOutput",
                        "status",
                        "source"
                      ],
                      "additionalProperties": false,
                      "description": "A task created with its dataset. Criteria are not accepted here: they are added afterwards through verifier.saveDefinitions, the one door for a task's criteria, or come with the task in benchmark.importDataset."
                    },
                    "maxItems": 1000,
                    "default": [],
                    "description": "Tasks to create with the dataset, in order (at most 1000). The dataset, its tasks and its v1 are written in one transaction, so v1 holds them. Defaults to none: callers that predate this field create an empty v1."
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false,
                "description": "Input for creating a new benchmark dataset"
              },
              "example": {
                "name": "rest-writes refunds",
                "tasks": [
                  {
                    "name": "Refund window",
                    "prompt": "How many days do customers have to ask for a refund?",
                    "expectedOutput": "30 days",
                    "status": "ready",
                    "source": "manual"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success. A retry with the same `Idempotency-Key` and the same request answers this again, with `Idempotent-Replayed: true`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique dataset identifier"
                    },
                    "orgId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Organization that owns this dataset"
                    },
                    "workspaceId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "The workspace this dataset belongs to; null means organization-wide, shown in every workspace"
                    },
                    "createdById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "User who created this dataset"
                    },
                    "ownerUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "The person who owns this dataset; null for datasets made before owners were recorded (organization-wide, and changeable by an organization admin)"
                    },
                    "visibility": {
                      "type": "string",
                      "enum": [
                        "org",
                        "workspace",
                        "personal"
                      ],
                      "description": "Where this dataset is placed: organization-wide, shared into its workspace, or private to its owner"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "Dataset display name"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 2000,
                      "description": "Optional dataset description"
                    },
                    "isPublic": {
                      "type": "boolean",
                      "description": "Whether this dataset is publicly shared"
                    },
                    "source": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Where the dataset came from (for example, `huggingface:openai/gsm8k`). Null for datasets created by hand."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "workspaceId",
                    "createdById",
                    "ownerUserId",
                    "visibility",
                    "name",
                    "description",
                    "isPublic",
                    "source",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false,
                  "description": "A collection of tasks (prompts) for evaluations"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "This `Idempotency-Key` was already used on a different request (code `idempotency_key_reused`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "benchmark.createDataset",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n# One Idempotency-Key per request you mean to make once; send the same key again to retry it.\ncurl -sS --fail-with-body -X POST \"$CONTEXT_APP_ORIGIN/api/v1/evals/datasets\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  -H \"Idempotency-Key: $IDEMPOTENCY_KEY\" \\\n  --data-binary @- <<'JSON'\n{\n  \"name\": \"rest-writes refunds\",\n  \"tasks\": [\n    {\n      \"name\": \"Refund window\",\n      \"prompt\": \"How many days do customers have to ask for a refund?\",\n      \"expectedOutput\": \"30 days\",\n      \"status\": \"ready\",\n      \"source\": \"manual\"\n    }\n  ]\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.post(\n    f\"{origin}/api/v1/evals/datasets\",\n    headers={\"Authorization\": f\"Bearer {api_key}\", \"Idempotency-Key\": os.environ[\"IDEMPOTENCY_KEY\"]},\n    json={\n        \"name\": \"rest-writes refunds\",\n        \"tasks\": [\n            {\n                \"name\": \"Refund window\",\n                \"prompt\": \"How many days do customers have to ask for a refund?\",\n                \"expectedOutput\": \"30 days\",\n                \"status\": \"ready\",\n                \"source\": \"manual\"\n            }\n        ]\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/datasets`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"name\": \"rest-writes refunds\",\n  \"tasks\": [\n    {\n      \"name\": \"Refund window\",\n      \"prompt\": \"How many days do customers have to ask for a refund?\",\n      \"expectedOutput\": \"30 days\",\n      \"status\": \"ready\",\n      \"source\": \"manual\"\n    }\n  ]\n}\nconst res = await fetch(url, {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\", \"Idempotency-Key\": env(\"IDEMPOTENCY_KEY\") },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/datasets/{datasetId}": {
      "get": {
        "tags": [
          "Datasets"
        ],
        "summary": "Get a dataset",
        "description": "Returns one dataset: its name, description, source and where it is placed. An archived dataset, or one outside your organization or your workspaces, answers 404.",
        "operationId": "getDataset",
        "parameters": [
          {
            "in": "path",
            "name": "datasetId",
            "required": true,
            "description": "Dataset identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Dataset identifier"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique dataset identifier"
                    },
                    "orgId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Organization that owns this dataset"
                    },
                    "workspaceId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "The workspace this dataset belongs to; null means organization-wide, shown in every workspace"
                    },
                    "createdById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "User who created this dataset"
                    },
                    "ownerUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "The person who owns this dataset; null for datasets made before owners were recorded (organization-wide, and changeable by an organization admin)"
                    },
                    "visibility": {
                      "type": "string",
                      "enum": [
                        "org",
                        "workspace",
                        "personal"
                      ],
                      "description": "Where this dataset is placed: organization-wide, shared into its workspace, or private to its owner"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "Dataset display name"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 2000,
                      "description": "Optional dataset description"
                    },
                    "isPublic": {
                      "type": "boolean",
                      "description": "Whether this dataset is publicly shared"
                    },
                    "source": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Where the dataset came from (for example, `huggingface:openai/gsm8k`). Null for datasets created by hand."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "workspaceId",
                    "createdById",
                    "ownerUserId",
                    "visibility",
                    "name",
                    "description",
                    "isPublic",
                    "source",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false,
                  "description": "A collection of tasks (prompts) for evaluations"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/datasets/$DATASET_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\ndataset_id = os.environ[\"DATASET_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/datasets/{dataset_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/datasets/${encodeURIComponent(env(\"DATASET_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/datasets/{datasetId}/items": {
      "get": {
        "tags": [
          "Datasets"
        ],
        "summary": "List a dataset's tasks",
        "description": "Returns every dataset task in the dataset's working copy, in the dataset's order, each with its prompt, expected answer, files and status. Archived tasks are left out.",
        "operationId": "listDatasetItems",
        "parameters": [
          {
            "in": "path",
            "name": "datasetId",
            "required": true,
            "description": "Dataset identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Dataset identifier"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Unique task identifier"
                      },
                      "datasetId": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Dataset this task belongs to"
                      },
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 200,
                        "description": "Optional task name or label for display"
                      },
                      "prompt": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100000,
                        "description": "The prompt sent to the agent"
                      },
                      "expectedOutput": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 100000,
                        "description": "Reference answer the judge compares against. Null if the task has no expected output."
                      },
                      "fileIds": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "maxItems": 10,
                        "description": "IDs of the Drive files attached to this task"
                      },
                      "expectedFileIds": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "maxItems": 10,
                        "description": "The task's expected files (answer keys): given to its criteria, never to the agent being evaluated"
                      },
                      "heldOut": {
                        "type": "boolean",
                        "description": "A held-out task: graded like every other task, but the system never learns from it, and a run also scores its held-out tasks separately"
                      },
                      "order": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Display and execution order within the dataset"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "ready",
                          "draft",
                          "needs_review"
                        ],
                        "description": "Authoring state: `ready` (ready to measure), `draft` (still being written), or `needs_review` (flagged for a second look). Informational only: a run measures every linked task whatever its status."
                      },
                      "source": {
                        "type": "string",
                        "enum": [
                          "manual",
                          "csv",
                          "trace",
                          "huggingface",
                          "generated"
                        ],
                        "description": "Where the task came from: written by hand, imported from a CSV or other file, promoted from a trace, imported from Hugging Face, or generated (a variant written by a model)"
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Creation timestamp"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Last update timestamp"
                      }
                    },
                    "required": [
                      "id",
                      "datasetId",
                      "name",
                      "prompt",
                      "expectedOutput",
                      "fileIds",
                      "expectedFileIds",
                      "heldOut",
                      "order",
                      "status",
                      "source",
                      "createdAt",
                      "updatedAt"
                    ],
                    "additionalProperties": false,
                    "description": "A single task within a dataset"
                  },
                  "description": "Tasks in the dataset"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/datasets/$DATASET_ID/items\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\ndataset_id = os.environ[\"DATASET_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/datasets/{dataset_id}/items\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/datasets/${encodeURIComponent(env(\"DATASET_ID\"))}/items`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          },
          {
            "lang": "shell",
            "label": "CLI",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n\n# Iterate prompts in a dataset\n# The CLI pages ({items, nextCursor}); GET /datasets/{datasetId}/items returns a plain array: jq '.[].prompt'.\ncontext evals datasets items list $DATASET_ID --limit 200 | jq '.items[].prompt'"
          }
        ]
      },
      "post": {
        "tags": [
          "Datasets"
        ],
        "summary": "Add a task to a dataset",
        "description": "One task, added to the dataset's working copy. A run grades a dataset's latest saved version, so save one (`POST /datasets/{datasetId}/versions`) before you start a run that should include it.",
        "operationId": "createDatasetItem",
        "parameters": [
          {
            "in": "path",
            "name": "datasetId",
            "required": true,
            "description": "Dataset identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Dataset to add the item to"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "description": "A key you choose for this request (a UUID works; at most 255 characters; a blank one is refused 400, code `idempotency_key_empty`). A retry with the same key and the same body answers the first success again instead of acting twice; kept 24 hours. Send one on every create and run start you might retry.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Optional item label"
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100000,
                    "description": "Prompt to send to the agent"
                  },
                  "expectedOutput": {
                    "type": "string",
                    "maxLength": 100000,
                    "description": "Expected answer for judge comparison"
                  },
                  "fileIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "maxItems": 10,
                    "description": "Task file IDs to attach"
                  },
                  "expectedFileIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "maxItems": 10,
                    "description": "Expected files (answer keys) to attach: given to the task's criteria, never to the agent under test"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "ready",
                      "draft",
                      "needs_review"
                    ],
                    "description": "Authoring state (default 'ready')",
                    "default": "ready"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "trace"
                    ],
                    "default": "manual",
                    "description": "'manual' (default) for a task written here, 'trace' for one promoted from a trace"
                  }
                },
                "required": [
                  "prompt"
                ],
                "additionalProperties": false,
                "description": "Input for creating a new benchmark item"
              },
              "example": {
                "name": "Late refund",
                "prompt": "A customer asks for a refund on day 45. What do you tell them?",
                "expectedOutput": "Refunds close after 30 days; offer store credit."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success. A retry with the same `Idempotency-Key` and the same request answers this again, with `Idempotent-Replayed: true`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique task identifier"
                    },
                    "datasetId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Dataset this task belongs to"
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 200,
                      "description": "Optional task name or label for display"
                    },
                    "prompt": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100000,
                      "description": "The prompt sent to the agent"
                    },
                    "expectedOutput": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 100000,
                      "description": "Reference answer the judge compares against. Null if the task has no expected output."
                    },
                    "fileIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "maxItems": 10,
                      "description": "IDs of the Drive files attached to this task"
                    },
                    "expectedFileIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "maxItems": 10,
                      "description": "The task's expected files (answer keys): given to its criteria, never to the agent being evaluated"
                    },
                    "heldOut": {
                      "type": "boolean",
                      "description": "A held-out task: graded like every other task, but the system never learns from it, and a run also scores its held-out tasks separately"
                    },
                    "order": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Display and execution order within the dataset"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "draft",
                        "needs_review"
                      ],
                      "description": "Authoring state: `ready` (ready to measure), `draft` (still being written), or `needs_review` (flagged for a second look). Informational only: a run measures every linked task whatever its status."
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "manual",
                        "csv",
                        "trace",
                        "huggingface",
                        "generated"
                      ],
                      "description": "Where the task came from: written by hand, imported from a CSV or other file, promoted from a trace, imported from Hugging Face, or generated (a variant written by a model)"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "datasetId",
                    "name",
                    "prompt",
                    "expectedOutput",
                    "fileIds",
                    "expectedFileIds",
                    "heldOut",
                    "order",
                    "status",
                    "source",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false,
                  "description": "A single task within a dataset"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "This `Idempotency-Key` was already used on a different request (code `idempotency_key_reused`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "benchmark.createItem",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n# One Idempotency-Key per request you mean to make once; send the same key again to retry it.\ncurl -sS --fail-with-body -X POST \"$CONTEXT_APP_ORIGIN/api/v1/evals/datasets/$DATASET_ID/items\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  -H \"Idempotency-Key: $IDEMPOTENCY_KEY\" \\\n  --data-binary @- <<'JSON'\n{\n  \"name\": \"Late refund\",\n  \"prompt\": \"A customer asks for a refund on day 45. What do you tell them?\",\n  \"expectedOutput\": \"Refunds close after 30 days; offer store credit.\"\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\ndataset_id = os.environ[\"DATASET_ID\"]\n\nresp = requests.post(\n    f\"{origin}/api/v1/evals/datasets/{dataset_id}/items\",\n    headers={\"Authorization\": f\"Bearer {api_key}\", \"Idempotency-Key\": os.environ[\"IDEMPOTENCY_KEY\"]},\n    json={\n        \"name\": \"Late refund\",\n        \"prompt\": \"A customer asks for a refund on day 45. What do you tell them?\",\n        \"expectedOutput\": \"Refunds close after 30 days; offer store credit.\"\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/datasets/${encodeURIComponent(env(\"DATASET_ID\"))}/items`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"name\": \"Late refund\",\n  \"prompt\": \"A customer asks for a refund on day 45. What do you tell them?\",\n  \"expectedOutput\": \"Refunds close after 30 days; offer store credit.\"\n}\nconst res = await fetch(url, {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\", \"Idempotency-Key\": env(\"IDEMPOTENCY_KEY\") },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/items/{taskId}": {
      "get": {
        "tags": [
          "Datasets"
        ],
        "summary": "Get a task",
        "description": "Returns one dataset task, read through its dataset: a task whose dataset you can't read answers 404, as does an archived task.",
        "operationId": "getItem",
        "parameters": [
          {
            "in": "path",
            "name": "taskId",
            "required": true,
            "description": "Task identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Task identifier"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique task identifier"
                    },
                    "datasetId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Dataset this task belongs to"
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 200,
                      "description": "Optional task name or label for display"
                    },
                    "prompt": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100000,
                      "description": "The prompt sent to the agent"
                    },
                    "expectedOutput": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 100000,
                      "description": "Reference answer the judge compares against. Null if the task has no expected output."
                    },
                    "fileIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "maxItems": 10,
                      "description": "IDs of the Drive files attached to this task"
                    },
                    "expectedFileIds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "maxItems": 10,
                      "description": "The task's expected files (answer keys): given to its criteria, never to the agent being evaluated"
                    },
                    "heldOut": {
                      "type": "boolean",
                      "description": "A held-out task: graded like every other task, but the system never learns from it, and a run also scores its held-out tasks separately"
                    },
                    "order": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Display and execution order within the dataset"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "draft",
                        "needs_review"
                      ],
                      "description": "Authoring state: `ready` (ready to measure), `draft` (still being written), or `needs_review` (flagged for a second look). Informational only: a run measures every linked task whatever its status."
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "manual",
                        "csv",
                        "trace",
                        "huggingface",
                        "generated"
                      ],
                      "description": "Where the task came from: written by hand, imported from a CSV or other file, promoted from a trace, imported from Hugging Face, or generated (a variant written by a model)"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "datasetId",
                    "name",
                    "prompt",
                    "expectedOutput",
                    "fileIds",
                    "expectedFileIds",
                    "heldOut",
                    "order",
                    "status",
                    "source",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false,
                  "description": "A single task within a dataset"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/items/$TASK_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\ntask_id = os.environ[\"TASK_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/items/{task_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/items/${encodeURIComponent(env(\"TASK_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/runs/{runId}": {
      "get": {
        "tags": [
          "Runs"
        ],
        "summary": "Get a run",
        "description": "Returns one run: the axes and cells it froze when it started, its status, its progress counts and its scores. The run is visible when its benchmark is; for its results as the Runs table shows them, use `GET /runs/{runId}/status`.",
        "operationId": "getRun",
        "parameters": [
          {
            "in": "path",
            "name": "runId",
            "required": true,
            "description": "Run identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Run identifier"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique run identifier"
                    },
                    "orgId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Organization that owns this run"
                    },
                    "evaluationId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Evaluation being run"
                    },
                    "topicId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Workflow this run belongs to; null for a run started from the app's evaluations view"
                    },
                    "evaluationVersionId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Evaluation version this run uses; null only for runs created before evaluation versions existed"
                    },
                    "runById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "User who started this run"
                    },
                    "axes": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "model"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "model"
                                    ]
                                  },
                                  "model": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "model"
                                ],
                                "additionalProperties": false,
                                "description": "A model the held agent runs"
                              },
                              "minItems": 1,
                              "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "agentId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An agent in the evaluation's organization"
                                },
                                "skills": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          },
                                          "versionId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                          },
                                          "followsLatest": {
                                            "type": "boolean",
                                            "enum": [
                                              true
                                            ],
                                            "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                          }
                                        },
                                        "required": [
                                          "skillId"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      }
                                    ],
                                    "description": "A held skill as fixed by the run. A skill ID on its own means the run started before versions were fixed."
                                  },
                                  "maxItems": 20,
                                  "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                }
                              },
                              "required": [
                                "agentId",
                                "skills"
                              ],
                              "additionalProperties": false,
                              "description": "The agent every model ran on, and the skills it ran with, each at its fixed version"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Model: one agent and its skills are held fixed"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "skill"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "skill"
                                        ]
                                      },
                                      "skillId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      },
                                      "version": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                      },
                                      "versionId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                      },
                                      "followsLatest": {
                                        "type": "boolean",
                                        "enum": [
                                          true
                                        ],
                                        "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "skillId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A tested skill as fixed by the run: the version it runs"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "no_skill"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                  }
                                ]
                              },
                              "minItems": 1,
                              "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "agentId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An agent in the evaluation's organization"
                                },
                                "model": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "agent_default"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false,
                                      "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "model"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "model"
                                      ],
                                      "additionalProperties": false,
                                      "description": "One model that every agent in the evaluation runs"
                                    }
                                  ],
                                  "description": "The model held fixed when Model is not the tested axis"
                                }
                              },
                              "required": [
                                "agentId",
                                "model"
                              ],
                              "additionalProperties": false,
                              "description": "The agent every skill runs on, and the model it runs"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Skill: one agent and its model are held fixed"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "testing": {
                              "type": "string",
                              "enum": [
                                "agent"
                              ]
                            },
                            "values": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "agent"
                                    ]
                                  },
                                  "agentId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "An agent in the evaluation's organization"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "agentId"
                                ],
                                "additionalProperties": false,
                                "description": "An agent"
                              },
                              "minItems": 1,
                              "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                            },
                            "held": {
                              "type": "object",
                              "properties": {
                                "model": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "agent_default"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "additionalProperties": false,
                                      "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "model"
                                          ]
                                        },
                                        "model": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "model"
                                      ],
                                      "additionalProperties": false,
                                      "description": "One model that every agent in the evaluation runs"
                                    }
                                  ],
                                  "description": "The model held fixed when Model is not the tested axis"
                                },
                                "skills": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          },
                                          "versionId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                          },
                                          "followsLatest": {
                                            "type": "boolean",
                                            "enum": [
                                              true
                                            ],
                                            "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                          }
                                        },
                                        "required": [
                                          "skillId"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      }
                                    ],
                                    "description": "A held skill as fixed by the run. A skill ID on its own means the run started before versions were fixed."
                                  },
                                  "maxItems": 20,
                                  "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                }
                              },
                              "required": [
                                "model",
                                "skills"
                              ],
                              "additionalProperties": false,
                              "description": "The model every agent ran, and the skills they ran with, each at its fixed version"
                            }
                          },
                          "required": [
                            "testing",
                            "values",
                            "held"
                          ],
                          "additionalProperties": false,
                          "description": "Testing Agent: the model and the skills are held fixed"
                        }
                      ],
                      "description": "The axes a run executed, fixed when it started, with every model resolved and every skill version fixed. Reports use these, not the evaluation's current settings."
                    },
                    "cells": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "cellId": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Identifies one cell within its run. A run's results, dispatches, and exports are keyed by it."
                          },
                          "value": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "model"
                                    ]
                                  },
                                  "model": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "model"
                                ],
                                "additionalProperties": false,
                                "description": "A model the held agent runs"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "skill"
                                    ]
                                  },
                                  "skillId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "A skill in the evaluation's organization"
                                  },
                                  "version": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                  },
                                  "versionId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                  },
                                  "followsLatest": {
                                    "type": "boolean",
                                    "enum": [
                                      true
                                    ],
                                    "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "skillId"
                                ],
                                "additionalProperties": false,
                                "description": "A tested skill as fixed by the run: the version it runs"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "no_skill"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false,
                                "description": "The held agent with no skill attached: the baseline a skill is compared against"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "agent"
                                    ]
                                  },
                                  "agentId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "An agent in the evaluation's organization"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "agentId"
                                ],
                                "additionalProperties": false,
                                "description": "An agent"
                              }
                            ],
                            "description": "The tested value this cell ran: one of the run's `axes.values`"
                          },
                          "attempt": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 5,
                            "description": "Which repeat of that value this is, starting at 1 (shown as \"Run n\"); a run with one run per task has only 1"
                          }
                        },
                        "required": [
                          "cellId",
                          "value",
                          "attempt"
                        ],
                        "additionalProperties": false,
                        "description": "One (value x repeat) of a run. Every task in the run runs once per cell."
                      },
                      "minItems": 1,
                      "description": "The run's cells, ordered by value (in the axes' order), then by repeat within each value: number of values x runs per task"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "PENDING",
                        "RUNNING",
                        "EVALUATING",
                        "COMPLETED",
                        "FAILED",
                        "STOPPED",
                        "UNKNOWN"
                      ],
                      "description": "Current run status, or `UNKNOWN` when the stored value is not one of the allowed values"
                    },
                    "taskCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Total number of (task x cell) pairs to run"
                    },
                    "completedCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of (task x cell) pairs completed so far"
                    },
                    "concurrency": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100,
                      "description": "Tasks run at once for this run (min 1, max 100 or the deployment's lower limit)."
                    },
                    "judgeConcurrency": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100,
                      "description": "Agent judges run at once for this run, across every task (min 1, max 100 or the deployment's lower limit). LLM judges and rules do not count."
                    },
                    "succeededCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of (task x cell) pairs whose task ended as succeeded"
                    },
                    "failedCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of (task x cell) pairs whose task ended as failed"
                    },
                    "cancelledCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of (task x cell) pairs whose task ended as canceled"
                    },
                    "judgedCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Result rows with a score: a judge score and no task error, or, on a criteria-graded run, a task where at least one criterion reached a verdict. Null until the run's totals are computed."
                    },
                    "passedCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Tasks the judge passed. Null for an evaluation scored on a 0 to 1 scale (no pass or fail), and null until the run's totals are computed."
                    },
                    "maskedCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Result rows left out of the score: the judge gave no score or the task errored, or, on a criteria-graded run, none of the task's criteria reached a verdict (they could not run). Null until the run's totals are computed."
                    },
                    "avgScore": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "Mean judged score on the standard 0 to 1 scale. Null until the run's totals are computed, or when nothing was judged."
                    },
                    "heldOutJudgedCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "`judgedCount` for the run's held-out tasks only (tasks the system never learns from). Null until the run's totals are computed, or when the totals come from older stored results that do not record which tasks are held out."
                    },
                    "heldOutAvgScore": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "`avgScore` for the run's held-out tasks only, on the same 0 to 1 scale. Null when `heldOutJudgedCount` is null or 0."
                    },
                    "costUsd": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "Task cost plus judge cost for the whole run, in dollars (USD). Null when any part is unknown (never a partial sum)."
                    },
                    "resolvedMismatch": {
                      "type": "boolean",
                      "description": "True when any dispatch was served by a different model than its cell asked for. This is a notice only: the run's result and every list, trend, and chart still show its score."
                    },
                    "resolvedUnknownCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Dispatches whose serving model could not be identified from billing when the run finished. This is not a mismatch, only unknown, and it never holds back the run's result. Null until the run's totals are computed."
                    },
                    "costUnknownReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "ledger_not_final",
                        "device_calls_unbounded",
                        "no_rows",
                        "unrated_rows",
                        "warehouse_session_missing",
                        "judge_cost_unknown",
                        "ledger_reroll_failed",
                        null
                      ],
                      "description": "Why `costUsd` is null on an ended run, by order of precedence. Null when the cost is known, while the run is still going, and on an ended run whose totals have not been computed."
                    },
                    "startedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the run started"
                    },
                    "completedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When the run finished, whether it succeeded or failed"
                    },
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Error message if the run failed"
                    },
                    "stopRequestedAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When someone asked to stop the run, or null if nobody did. It is set while the run is still going: the run counts as stopping until its status is `STOPPED`."
                    },
                    "stopRequestedByUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Who asked to stop the run: the person, or the person an agent acts for when an agent asked. Null when nobody did."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "evaluationId",
                    "topicId",
                    "evaluationVersionId",
                    "runById",
                    "axes",
                    "cells",
                    "taskCount",
                    "completedCount",
                    "concurrency",
                    "judgeConcurrency",
                    "succeededCount",
                    "failedCount",
                    "cancelledCount",
                    "judgedCount",
                    "passedCount",
                    "maskedCount",
                    "avgScore",
                    "heldOutJudgedCount",
                    "heldOutAvgScore",
                    "costUsd",
                    "resolvedMismatch",
                    "resolvedUnknownCount",
                    "costUnknownReason",
                    "startedAt",
                    "completedAt",
                    "error",
                    "stopRequestedAt",
                    "stopRequestedByUserId",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false,
                  "description": "One execution of an evaluation: the axes it fixed when it started, its cells, and its progress"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/runs/$RUN_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nrun_id = os.environ[\"RUN_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/runs/{run_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/runs/${encodeURIComponent(env(\"RUN_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          },
          {
            "lang": "shell",
            "label": "CLI",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n\n# Where a run is, and the cell ids `run tasks` and `run task` take\ncontext evals benchmark run get $RUN_ID | jq '{status, cells: [.cells[] | {cellId, value, attempt}]}'"
          }
        ]
      }
    },
    "/runs/{runId}/status": {
      "get": {
        "tags": [
          "Runs"
        ],
        "summary": "Get a run's status",
        "description": "The run as the evaluation's Runs table shows it (its result, each cell's result, the best of them, how many cells are at or above the threshold, cost per task, criteria that errored), plus who started it, the evaluation's current threshold, the per-cell stats (total, succeeded, failed, mean score), and the tasks waiting now, by reason. For per-task rows, use `GET /runs/{runId}/tasks`; for one task's full record, use `GET /runs/{runId}/tasks/{taskId}`.",
        "operationId": "getRunStatus",
        "parameters": [
          {
            "in": "path",
            "name": "runId",
            "required": true,
            "description": "Run identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Run identifier"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "run": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "description": "Unique run identifier"
                        },
                        "orgId": {
                          "type": "string",
                          "minLength": 1,
                          "description": "Organization that owns this run"
                        },
                        "evaluationId": {
                          "type": "string",
                          "minLength": 1,
                          "description": "Evaluation being run"
                        },
                        "topicId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "description": "Workflow this run belongs to; null for a run started from the app's evaluations view"
                        },
                        "evaluationVersionId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "description": "Evaluation version this run uses; null only for runs created before evaluation versions existed"
                        },
                        "runById": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "description": "User who started this run"
                        },
                        "axes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "model"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A model the held agent runs"
                                  },
                                  "minItems": 1,
                                  "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              },
                                              "versionId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                              },
                                              "followsLatest": {
                                                "type": "boolean",
                                                "enum": [
                                                  true
                                                ],
                                                "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A held skill as fixed by the run. A skill ID on its own means the run started before versions were fixed."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every model ran on, and the skills it ran with, each at its fixed version"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Model: one agent and its skills are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "skill"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "skill"
                                            ]
                                          },
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          },
                                          "versionId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                          },
                                          "followsLatest": {
                                            "type": "boolean",
                                            "enum": [
                                              true
                                            ],
                                            "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A tested skill as fixed by the run: the version it runs"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "no_skill"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false,
                                        "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                      }
                                    ]
                                  },
                                  "minItems": 1,
                                  "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "model"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every skill runs on, and the model it runs"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Skill: one agent and its model are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "agent"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent"
                                        ]
                                      },
                                      "agentId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "An agent in the evaluation's organization"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "agentId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "An agent"
                                  },
                                  "minItems": 1,
                                  "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              },
                                              "versionId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                              },
                                              "followsLatest": {
                                                "type": "boolean",
                                                "enum": [
                                                  true
                                                ],
                                                "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A held skill as fixed by the run. A skill ID on its own means the run started before versions were fixed."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "model",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The model every agent ran, and the skills they ran with, each at its fixed version"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Agent: the model and the skills are held fixed"
                            }
                          ],
                          "description": "The axes a run executed, fixed when it started, with every model resolved and every skill version fixed. Reports use these, not the evaluation's current settings."
                        },
                        "cells": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "cellId": {
                                "type": "string",
                                "format": "uuid",
                                "description": "Identifies one cell within its run. A run's results, dispatches, and exports are keyed by it."
                              },
                              "value": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A model the held agent runs"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "skill"
                                        ]
                                      },
                                      "skillId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      },
                                      "version": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                      },
                                      "versionId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                      },
                                      "followsLatest": {
                                        "type": "boolean",
                                        "enum": [
                                          true
                                        ],
                                        "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "skillId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A tested skill as fixed by the run: the version it runs"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "no_skill"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent"
                                        ]
                                      },
                                      "agentId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "An agent in the evaluation's organization"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "agentId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "An agent"
                                  }
                                ],
                                "description": "The tested value this cell ran: one of the run's `axes.values`"
                              },
                              "attempt": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 5,
                                "description": "Which repeat of that value this is, starting at 1 (shown as \"Run n\"); a run with one run per task has only 1"
                              }
                            },
                            "required": [
                              "cellId",
                              "value",
                              "attempt"
                            ],
                            "additionalProperties": false,
                            "description": "One (value x repeat) of a run. Every task in the run runs once per cell."
                          },
                          "minItems": 1,
                          "description": "The run's cells, ordered by value (in the axes' order), then by repeat within each value: number of values x runs per task"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "RUNNING",
                            "EVALUATING",
                            "COMPLETED",
                            "FAILED",
                            "STOPPED",
                            "UNKNOWN"
                          ],
                          "description": "Current run status, or `UNKNOWN` when the stored value is not one of the allowed values"
                        },
                        "taskCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of (task x cell) pairs to run"
                        },
                        "completedCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of (task x cell) pairs completed so far"
                        },
                        "concurrency": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100,
                          "description": "Tasks run at once for this run (min 1, max 100 or the deployment's lower limit)."
                        },
                        "judgeConcurrency": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100,
                          "description": "Agent judges run at once for this run, across every task (min 1, max 100 or the deployment's lower limit). LLM judges and rules do not count."
                        },
                        "succeededCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of (task x cell) pairs whose task ended as succeeded"
                        },
                        "failedCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of (task x cell) pairs whose task ended as failed"
                        },
                        "cancelledCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of (task x cell) pairs whose task ended as canceled"
                        },
                        "judgedCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Result rows with a score: a judge score and no task error, or, on a criteria-graded run, a task where at least one criterion reached a verdict. Null until the run's totals are computed."
                        },
                        "passedCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Tasks the judge passed. Null for an evaluation scored on a 0 to 1 scale (no pass or fail), and null until the run's totals are computed."
                        },
                        "maskedCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Result rows left out of the score: the judge gave no score or the task errored, or, on a criteria-graded run, none of the task's criteria reached a verdict (they could not run). Null until the run's totals are computed."
                        },
                        "avgScore": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Mean judged score on the standard 0 to 1 scale. Null until the run's totals are computed, or when nothing was judged."
                        },
                        "heldOutJudgedCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "`judgedCount` for the run's held-out tasks only (tasks the system never learns from). Null until the run's totals are computed, or when the totals come from older stored results that do not record which tasks are held out."
                        },
                        "heldOutAvgScore": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "`avgScore` for the run's held-out tasks only, on the same 0 to 1 scale. Null when `heldOutJudgedCount` is null or 0."
                        },
                        "costUsd": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Task cost plus judge cost for the whole run, in dollars (USD). Null when any part is unknown (never a partial sum)."
                        },
                        "resolvedMismatch": {
                          "type": "boolean",
                          "description": "True when any dispatch was served by a different model than its cell asked for. This is a notice only: the run's result and every list, trend, and chart still show its score."
                        },
                        "resolvedUnknownCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Dispatches whose serving model could not be identified from billing when the run finished. This is not a mismatch, only unknown, and it never holds back the run's result. Null until the run's totals are computed."
                        },
                        "costUnknownReason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "ledger_not_final",
                            "device_calls_unbounded",
                            "no_rows",
                            "unrated_rows",
                            "warehouse_session_missing",
                            "judge_cost_unknown",
                            "ledger_reroll_failed",
                            null
                          ],
                          "description": "Why `costUsd` is null on an ended run, by order of precedence. Null when the cost is known, while the run is still going, and on an ended run whose totals have not been computed."
                        },
                        "startedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time",
                          "description": "When the run started"
                        },
                        "completedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time",
                          "description": "When the run finished, whether it succeeded or failed"
                        },
                        "error": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Error message if the run failed"
                        },
                        "stopRequestedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time",
                          "description": "When someone asked to stop the run, or null if nobody did. It is set while the run is still going: the run counts as stopping until its status is `STOPPED`."
                        },
                        "stopRequestedByUserId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "description": "Who asked to stop the run: the person, or the person an agent acts for when an agent asked. Null when nobody did."
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Creation timestamp"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Last update timestamp"
                        },
                        "runByName": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Display name of who started the run; null for a run the system started or when that user no longer exists"
                        },
                        "result": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "available"
                                  ]
                                },
                                "mode": {
                                  "type": "string",
                                  "enum": [
                                    "pass",
                                    "score"
                                  ],
                                  "description": "Whether the result is a boolean pass rate or a scaled score"
                                },
                                "valuePct": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 100,
                                  "description": "The result as a percentage from 0 to 100"
                                }
                              },
                              "required": [
                                "state",
                                "mode",
                                "valuePct"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "unavailable"
                                  ]
                                },
                                "reason": {
                                  "type": "string",
                                  "enum": [
                                    "not-scored",
                                    "invalid-rollup",
                                    "version-unavailable"
                                  ],
                                  "description": "Why a completed run cannot report a comparable result"
                                }
                              },
                              "required": [
                                "state",
                                "reason"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The result of a completed run; null while the run has not completed or if it failed"
                        },
                        "headlinePct": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "minimum": 0,
                          "maximum": 100,
                          "description": "The run's headline figure, as the evaluations list shows it (its card's headline and trend point): the best cell for a run graded by criteria, otherwise `result.valuePct`. Null when `result` is not available."
                        },
                        "heldOutResult": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "valuePct": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 100,
                              "description": "The result over the held-out tasks, on the same scale as `result.valuePct`"
                            },
                            "rowCount": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "Number of held-out tasks the run graded"
                            }
                          },
                          "required": [
                            "valuePct",
                            "rowCount"
                          ],
                          "additionalProperties": false,
                          "description": "The run's result over its held-out tasks only (tasks the system never learns from), on the same scale as `result.valuePct`; null when the run has no available result or graded no held-out task"
                        },
                        "heldOutTaskCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Number of held-out (Validation) tasks in the task set this run pinned; a sampled run can hold fewer than its dataset. Unlike `heldOutResult.rowCount`, it counts tasks, not graded rows, and is set whether or not the run has a result. Null when the run pinned no dataset version, so it recorded no Split."
                        },
                        "cellResultsAvailable": {
                          "type": [
                            "boolean",
                            "null"
                          ],
                          "description": "Null when the run has no available result; false when its per-cell results cannot be read"
                        },
                        "cellResults": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "cellId": {
                                "type": "string",
                                "format": "uuid",
                                "description": "One of the run's cells"
                              },
                              "valuePct": {
                                "type": [
                                  "number",
                                  "null"
                                ],
                                "minimum": 0,
                                "maximum": 100,
                                "description": "This cell's result on the run's scale (a mean score for a run graded by criteria; a pass rate when the recorded results are pass/fail); null when nothing in the cell was graded"
                              }
                            },
                            "required": [
                              "cellId",
                              "valuePct"
                            ],
                            "additionalProperties": false,
                            "description": "One cell's result within a completed run"
                          },
                          "description": "One result per cell, in the order of the run's cells; empty unless `cellResultsAvailable` is true"
                        },
                        "bestScorePct": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "minimum": 0,
                          "maximum": 100,
                          "description": "The best cell's result; null when no cell result is available"
                        },
                        "aboveThresholdCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Number of cells whose result is at or above the evaluation's current threshold; null when the evaluation has no threshold or no cell result is available"
                        },
                        "costPerTaskUsd": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "The run's final cost divided by its (task x cell) pairs, given only when every pair ran (the run completed and the platform canceled none). Null for a failed or stopped run, a run with a canceled pair, a run still in progress, or an unknown cost. `costUsd` is still the run's total spend."
                        },
                        "erroredCheckCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Number of checks that could not run across the run's settled tasks, in all cells: outcomes with no verdict (never started, files or sandbox unavailable, crashed, timed out). Each is shown as failed and left out of every score. Subtract `taskEnds.criteriaTaken` to get the judge's own failures, which the Runs table shows as \"couldn't be judged.\" 0 when there are none, including on a completed run that scored nothing. Null for a run that did not complete, a completed run whose cell details are unknown, or an older run that recorded no checks."
                        },
                        "taskEnds": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "agentFailed": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "Tasks whose agent run failed (criteria recorded `subject_failed`)"
                            },
                            "agentTimedOut": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "Tasks that hit the agent's working-time limit (criteria recorded `subject_timed_out`)"
                            },
                            "notStarted": {
                              "type": "object",
                              "properties": {
                                "sandbox": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "ai_budget": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "not_picked_up": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "not_ready": {
                                  "type": "integer",
                                  "minimum": 0
                                },
                                "credits_exhausted": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "default": 0
                                },
                                "user_budget_exceeded": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "default": 0
                                }
                              },
                              "required": [
                                "sandbox",
                                "ai_budget",
                                "not_picked_up",
                                "not_ready"
                              ],
                              "additionalProperties": false,
                              "description": "Tasks that never started, by reason: withdrawn at the run's start limit, or refused at dispatch for budget reasons (criteria recorded `not_started`)"
                            },
                            "stopped": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "Tasks cut short because a person stopped the run (a `STOPPED` run; criteria recorded `cancelled`). These are not failures."
                            },
                            "criteriaTaken": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "Number of criteria on the failed, timed-out, and never-started tasks, each of which recorded how the task ended instead of a verdict. Subtract this from a no-verdict check count (one that already excludes a person's stop) to get the judge's own failures."
                            }
                          },
                          "required": [
                            "agentFailed",
                            "agentTimedOut",
                            "notStarted",
                            "stopped",
                            "criteriaTaken"
                          ],
                          "additionalProperties": false,
                          "description": "How the run's settled tasks that gave no answer ended, across all cells, counted once per task: the agent's task failed, the agent ran out of time, the task never started (by reason), or a person's stop cut it short. All zeros when every task answered. Present on a completed run that scored nothing, where it explains why. Null for a run that did not complete, a completed run whose cell details are unknown, or an older run that recorded no task endings."
                        },
                        "stopRequestedByName": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Display name of the person who asked to stop this run; null when nobody did or that user cannot be found"
                        }
                      },
                      "required": [
                        "id",
                        "orgId",
                        "evaluationId",
                        "topicId",
                        "evaluationVersionId",
                        "runById",
                        "axes",
                        "cells",
                        "taskCount",
                        "completedCount",
                        "concurrency",
                        "judgeConcurrency",
                        "succeededCount",
                        "failedCount",
                        "cancelledCount",
                        "judgedCount",
                        "passedCount",
                        "maskedCount",
                        "avgScore",
                        "heldOutJudgedCount",
                        "heldOutAvgScore",
                        "costUsd",
                        "resolvedMismatch",
                        "resolvedUnknownCount",
                        "costUnknownReason",
                        "startedAt",
                        "completedAt",
                        "error",
                        "stopRequestedAt",
                        "stopRequestedByUserId",
                        "createdAt",
                        "updatedAt",
                        "runByName",
                        "result",
                        "headlinePct",
                        "heldOutResult",
                        "heldOutTaskCount",
                        "cellResultsAvailable",
                        "cellResults",
                        "bestScorePct",
                        "aboveThresholdCount",
                        "costPerTaskUsd",
                        "erroredCheckCount",
                        "taskEnds",
                        "stopRequestedByName"
                      ],
                      "additionalProperties": false,
                      "description": "The run's row as the Runs table shows it, with the display names of who started it and who asked to stop it"
                    },
                    "threshold": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "maximum": 100,
                      "description": "The evaluation's current pass threshold, which `run.aboveThresholdCount` counts against. A cell passes when its `run.cellResults` `valuePct` is at or above it. Null when the evaluation has no threshold."
                    },
                    "stats": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "cellId": {
                            "type": "string",
                            "description": "The run cell these results belong to; the run's `cells` says which value and repeat it is"
                          },
                          "total": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Total tasks run"
                          },
                          "succeeded": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Tasks that completed successfully"
                          },
                          "failed": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Tasks that failed"
                          },
                          "avgScore": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Average judge score (null until there are scores)"
                          }
                        },
                        "required": [
                          "cellId",
                          "total",
                          "succeeded",
                          "failed",
                          "avgScore"
                        ],
                        "additionalProperties": false,
                        "description": "Aggregated stats for one cell of a run"
                      },
                      "description": "Per-cell aggregate stats for this run, one entry per cell, from its settled tasks (the same figures `GET /runs/{runId}/tasks` reports)"
                    },
                    "waitingCounts": {
                      "type": "object",
                      "properties": {
                        "sandbox": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Cells waiting for a sandbox to run in"
                        },
                        "aiBudget": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Cells on hold because the AI budget is used up"
                        },
                        "judgeSlot": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Cells whose agent judges are waiting for a free agent judge slot in the run"
                        }
                      },
                      "required": [
                        "sandbox",
                        "aiBudget",
                        "judgeSlot"
                      ],
                      "additionalProperties": false,
                      "description": "Cells of the run waiting now, by reason (the same figures `GET /runs/{runId}/tasks` reports)"
                    }
                  },
                  "required": [
                    "run",
                    "threshold",
                    "stats",
                    "waitingCounts"
                  ],
                  "additionalProperties": false,
                  "description": "Run status: the run's row as the Runs table shows it, the threshold it is measured against, its aggregate stats, and its waiting counts"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/runs/$RUN_ID/status\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nrun_id = os.environ[\"RUN_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/runs/{run_id}/status\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/runs/${encodeURIComponent(env(\"RUN_ID\"))}/status`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/runs/{runId}/tasks": {
      "get": {
        "tags": [
          "Runs"
        ],
        "summary": "List a run's task results",
        "description": "The tasks of one cell in the run's order, each with its score, its criteria outcomes (pending, completed with a 0 to 1 score, error, or didn't run), a preview of its recorded answer, its cost and latency, and why it is not running when it is not. Also includes the run's whole-run figures (stats per cell, waiting counts). To page, pass the previous page's `nextCursor` as `cursor`; a cursor outside the run's pinned task set is rejected.",
        "operationId": "listRunTasks",
        "parameters": [
          {
            "in": "path",
            "name": "runId",
            "required": true,
            "description": "Run identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Run identifier"
            }
          },
          {
            "in": "query",
            "name": "cellId",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "One of this run's cells"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Last task identifier from the previous page of this run (its `nextCursor`)"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50,
              "description": "Tasks per page"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "run": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "description": "Unique run identifier"
                        },
                        "orgId": {
                          "type": "string",
                          "minLength": 1,
                          "description": "Organization that owns this run"
                        },
                        "evaluationId": {
                          "type": "string",
                          "minLength": 1,
                          "description": "Evaluation being run"
                        },
                        "topicId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "description": "Workflow this run belongs to; null for a run started from the app's evaluations view"
                        },
                        "evaluationVersionId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "description": "Evaluation version this run uses; null only for runs created before evaluation versions existed"
                        },
                        "runById": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "description": "User who started this run"
                        },
                        "axes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "model"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A model the held agent runs"
                                  },
                                  "minItems": 1,
                                  "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              },
                                              "versionId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                              },
                                              "followsLatest": {
                                                "type": "boolean",
                                                "enum": [
                                                  true
                                                ],
                                                "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A held skill as fixed by the run. A skill ID on its own means the run started before versions were fixed."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every model ran on, and the skills it ran with, each at its fixed version"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Model: one agent and its skills are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "skill"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "skill"
                                            ]
                                          },
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          },
                                          "versionId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                          },
                                          "followsLatest": {
                                            "type": "boolean",
                                            "enum": [
                                              true
                                            ],
                                            "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A tested skill as fixed by the run: the version it runs"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "no_skill"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false,
                                        "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                      }
                                    ]
                                  },
                                  "minItems": 1,
                                  "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "model"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every skill runs on, and the model it runs"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Skill: one agent and its model are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "agent"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent"
                                        ]
                                      },
                                      "agentId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "An agent in the evaluation's organization"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "agentId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "An agent"
                                  },
                                  "minItems": 1,
                                  "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              },
                                              "versionId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                              },
                                              "followsLatest": {
                                                "type": "boolean",
                                                "enum": [
                                                  true
                                                ],
                                                "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A held skill as fixed by the run. A skill ID on its own means the run started before versions were fixed."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "model",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The model every agent ran, and the skills they ran with, each at its fixed version"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Agent: the model and the skills are held fixed"
                            }
                          ],
                          "description": "The axes a run executed, fixed when it started, with every model resolved and every skill version fixed. Reports use these, not the evaluation's current settings."
                        },
                        "cells": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "cellId": {
                                "type": "string",
                                "format": "uuid",
                                "description": "Identifies one cell within its run. A run's results, dispatches, and exports are keyed by it."
                              },
                              "value": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A model the held agent runs"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "skill"
                                        ]
                                      },
                                      "skillId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "A skill in the evaluation's organization"
                                      },
                                      "version": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                      },
                                      "versionId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "ID of the skill version this run uses. Present exactly when `version` is present."
                                      },
                                      "followsLatest": {
                                        "type": "boolean",
                                        "enum": [
                                          true
                                        ],
                                        "description": "Present when the evaluation asked for the newest version and this run fixed it when the run started; absent when the evaluation pinned the version"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "skillId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A tested skill as fixed by the run: the version it runs"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "no_skill"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent"
                                        ]
                                      },
                                      "agentId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "An agent in the evaluation's organization"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "agentId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "An agent"
                                  }
                                ],
                                "description": "The tested value this cell ran: one of the run's `axes.values`"
                              },
                              "attempt": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 5,
                                "description": "Which repeat of that value this is, starting at 1 (shown as \"Run n\"); a run with one run per task has only 1"
                              }
                            },
                            "required": [
                              "cellId",
                              "value",
                              "attempt"
                            ],
                            "additionalProperties": false,
                            "description": "One (value x repeat) of a run. Every task in the run runs once per cell."
                          },
                          "minItems": 1,
                          "description": "The run's cells, ordered by value (in the axes' order), then by repeat within each value: number of values x runs per task"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "RUNNING",
                            "EVALUATING",
                            "COMPLETED",
                            "FAILED",
                            "STOPPED",
                            "UNKNOWN"
                          ],
                          "description": "Current run status, or `UNKNOWN` when the stored value is not one of the allowed values"
                        },
                        "taskCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total number of (task x cell) pairs to run"
                        },
                        "completedCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of (task x cell) pairs completed so far"
                        },
                        "concurrency": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100,
                          "description": "Tasks run at once for this run (min 1, max 100 or the deployment's lower limit)."
                        },
                        "judgeConcurrency": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100,
                          "description": "Agent judges run at once for this run, across every task (min 1, max 100 or the deployment's lower limit). LLM judges and rules do not count."
                        },
                        "succeededCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of (task x cell) pairs whose task ended as succeeded"
                        },
                        "failedCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of (task x cell) pairs whose task ended as failed"
                        },
                        "cancelledCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of (task x cell) pairs whose task ended as canceled"
                        },
                        "judgedCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Result rows with a score: a judge score and no task error, or, on a criteria-graded run, a task where at least one criterion reached a verdict. Null until the run's totals are computed."
                        },
                        "passedCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Tasks the judge passed. Null for an evaluation scored on a 0 to 1 scale (no pass or fail), and null until the run's totals are computed."
                        },
                        "maskedCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Result rows left out of the score: the judge gave no score or the task errored, or, on a criteria-graded run, none of the task's criteria reached a verdict (they could not run). Null until the run's totals are computed."
                        },
                        "avgScore": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Mean judged score on the standard 0 to 1 scale. Null until the run's totals are computed, or when nothing was judged."
                        },
                        "heldOutJudgedCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "`judgedCount` for the run's held-out tasks only (tasks the system never learns from). Null until the run's totals are computed, or when the totals come from older stored results that do not record which tasks are held out."
                        },
                        "heldOutAvgScore": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "`avgScore` for the run's held-out tasks only, on the same 0 to 1 scale. Null when `heldOutJudgedCount` is null or 0."
                        },
                        "costUsd": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Task cost plus judge cost for the whole run, in dollars (USD). Null when any part is unknown (never a partial sum)."
                        },
                        "resolvedMismatch": {
                          "type": "boolean",
                          "description": "True when any dispatch was served by a different model than its cell asked for. This is a notice only: the run's result and every list, trend, and chart still show its score."
                        },
                        "resolvedUnknownCount": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Dispatches whose serving model could not be identified from billing when the run finished. This is not a mismatch, only unknown, and it never holds back the run's result. Null until the run's totals are computed."
                        },
                        "costUnknownReason": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "ledger_not_final",
                            "device_calls_unbounded",
                            "no_rows",
                            "unrated_rows",
                            "warehouse_session_missing",
                            "judge_cost_unknown",
                            "ledger_reroll_failed",
                            null
                          ],
                          "description": "Why `costUsd` is null on an ended run, by order of precedence. Null when the cost is known, while the run is still going, and on an ended run whose totals have not been computed."
                        },
                        "startedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time",
                          "description": "When the run started"
                        },
                        "completedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time",
                          "description": "When the run finished, whether it succeeded or failed"
                        },
                        "error": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Error message if the run failed"
                        },
                        "stopRequestedAt": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time",
                          "description": "When someone asked to stop the run, or null if nobody did. It is set while the run is still going: the run counts as stopping until its status is `STOPPED`."
                        },
                        "stopRequestedByUserId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "description": "Who asked to stop the run: the person, or the person an agent acts for when an agent asked. Null when nobody did."
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Creation timestamp"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Last update timestamp"
                        },
                        "runByName": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Display name of the user who started this run, or null if `runById` is null or the user cannot be found"
                        },
                        "stopRequestedByName": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Display name of the person who asked to stop this run; null when nobody did or that user cannot be found"
                        }
                      },
                      "required": [
                        "id",
                        "orgId",
                        "evaluationId",
                        "topicId",
                        "evaluationVersionId",
                        "runById",
                        "axes",
                        "cells",
                        "taskCount",
                        "completedCount",
                        "concurrency",
                        "judgeConcurrency",
                        "succeededCount",
                        "failedCount",
                        "cancelledCount",
                        "judgedCount",
                        "passedCount",
                        "maskedCount",
                        "avgScore",
                        "heldOutJudgedCount",
                        "heldOutAvgScore",
                        "costUsd",
                        "resolvedMismatch",
                        "resolvedUnknownCount",
                        "costUnknownReason",
                        "startedAt",
                        "completedAt",
                        "error",
                        "stopRequestedAt",
                        "stopRequestedByUserId",
                        "createdAt",
                        "updatedAt",
                        "runByName",
                        "stopRequestedByName"
                      ],
                      "additionalProperties": false,
                      "description": "The run, with the display names of who started it and who asked to stop it"
                    },
                    "version": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "legacy"
                              ]
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false,
                          "description": "A run created before evaluation versions were pinned"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "available"
                              ]
                            },
                            "versionId": {
                              "type": "string",
                              "minLength": 1,
                              "description": "ID of the immutable version the run is pinned to"
                            },
                            "version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "description": "Evaluation version number; it only increases"
                            },
                            "taskCount": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "Number of tasks fixed in this version's task set"
                            },
                            "judgeOutputType": {
                              "type": "string",
                              "enum": [
                                "float",
                                "boolean"
                              ],
                              "description": "Format this version's results were recorded in"
                            },
                            "sample": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "all"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "sample"
                                      ]
                                    },
                                    "size": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "description": "Number of tasks drawn (equals `caseSet.itemCount`)"
                                    },
                                    "seed": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 4294967295,
                                      "description": "Unsigned 32-bit seed; the same seed over the same tasks draws the same sample"
                                    },
                                    "populationCount": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "description": "Number of tasks the sample was drawn from"
                                    },
                                    "draw": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "sampler": {
                                              "type": "string",
                                              "enum": [
                                                "uniform-v1"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "sampler"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One uniform draw over every task, blind to Split: how every sample was drawn before Split-aware sampling"
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "sampler": {
                                              "type": "string",
                                              "enum": [
                                                "by-split-v1"
                                              ]
                                            },
                                            "drawn": {
                                              "type": "object",
                                              "properties": {
                                                "train": {
                                                  "type": "integer",
                                                  "minimum": 0,
                                                  "description": "Train tasks: used for learning"
                                                },
                                                "validation": {
                                                  "type": "integer",
                                                  "minimum": 0,
                                                  "description": "Validation tasks: scored separately (stored as held out)"
                                                }
                                              },
                                              "required": [
                                                "train",
                                                "validation"
                                              ],
                                              "additionalProperties": false,
                                              "description": "Tasks the draw took from each Split; they add up to `size`"
                                            }
                                          },
                                          "required": [
                                            "sampler",
                                            "drawn"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One draw per Split: each Split gets its share of the sample (proportional, largest remainder), and a Split that holds any task draws at least one"
                                        }
                                      ],
                                      "description": "Which sampler drew the tasks. Defaults on read to `uniform-v1`: samples frozen before samplers were versioned recorded none, and were drawn uniformly",
                                      "default": {
                                        "sampler": "uniform-v1"
                                      }
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "size",
                                    "seed",
                                    "populationCount"
                                  ],
                                  "additionalProperties": false
                                }
                              ],
                              "description": "Whether the run measured every task or a seeded sample (`taskCount` is the sample size)"
                            },
                            "datasets": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "state": {
                                      "type": "string",
                                      "enum": [
                                        "recorded"
                                      ]
                                    },
                                    "items": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "datasetId": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "datasetName": {
                                            "type": [
                                              "string",
                                              "null"
                                            ],
                                            "description": "Null when the dataset has since been deleted (its versions remain)"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0
                                          },
                                          "taskCount": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "description": "Tasks in that version"
                                          },
                                          "heldOutCount": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "description": "Validation tasks in that version (stored as held out); the version as saved, whatever part of it a sampled run drew"
                                          }
                                        },
                                        "required": [
                                          "datasetId",
                                          "datasetName",
                                          "version",
                                          "taskCount",
                                          "heldOutCount"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "description": "The version of each linked dataset that the run graded, in link order"
                                    }
                                  },
                                  "required": [
                                    "state",
                                    "items"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "state": {
                                      "type": "string",
                                      "enum": [
                                        "working_copy_preview"
                                      ]
                                    },
                                    "itemId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "The working copy of the task that the preview graded"
                                    }
                                  },
                                  "required": [
                                    "state",
                                    "itemId"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "state": {
                                      "type": "string",
                                      "enum": [
                                        "unrecorded"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "state"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The run was created before dataset versions existed"
                                }
                              ],
                              "description": "Which dataset versions a run graded"
                            }
                          },
                          "required": [
                            "state",
                            "versionId",
                            "version",
                            "taskCount",
                            "judgeOutputType",
                            "sample",
                            "datasets"
                          ],
                          "additionalProperties": false,
                          "description": "The immutable version details the run used"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "unavailable"
                              ]
                            },
                            "versionId": {
                              "type": "string",
                              "minLength": 1,
                              "description": "ID of the pinned version whose record is missing"
                            }
                          },
                          "required": [
                            "state",
                            "versionId"
                          ],
                          "additionalProperties": false,
                          "description": "The run is pinned to a version whose record is missing"
                        }
                      ],
                      "description": "State of the evaluation version pinned for this run"
                    },
                    "resultContract": {
                      "type": "string",
                      "enum": [
                        "native",
                        "legacy",
                        "unavailable"
                      ],
                      "description": "Which recorded-result export this run supports"
                    },
                    "pinnedCriteriaCount": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Number of criteria the run's version pins across its tasks; 0 for a run nothing could grade; null for a run not graded by criteria"
                    },
                    "stats": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "cellId": {
                            "type": "string",
                            "description": "The run cell these results belong to; the run's `cells` says which value and repeat it is"
                          },
                          "total": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Total tasks run"
                          },
                          "succeeded": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Tasks that completed successfully"
                          },
                          "failed": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Tasks that failed"
                          },
                          "avgScore": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Average judge score (null until there are scores)"
                          },
                          "costPerTaskUsd": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Mean cost per settled task, including the agent and its checks; null until the run completes, when any charge is unknown, and for older runs"
                          },
                          "p95LatencyMs": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Agent latency that 95 percent of tasks beat across the whole cell; null when no task has a duration"
                          },
                          "passedCount": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Number of tasks whose score is at or above the evaluation's current threshold; null when there is no threshold"
                          },
                          "criterionCount": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Number of distinct checks with a settled outcome on this cell (checks may be capped)"
                          },
                          "criteria": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "criterionKey": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "`evaluation:<id>`, `dataset:<id>`, or `task:<id>`, as on task rows"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "Check display name as fixed in the run's version"
                                },
                                "scored": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Settled tasks where this check completed: `passed` + `failed` + `graded`"
                                },
                                "errored": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Settled tasks where this check reached no verdict (it could not run) for a reason other than a person's stop. Shown as failed with its reason, and left out of `meanScore` and of the task's score."
                                },
                                "stopped": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Settled tasks where a person's stop cut this check short (the same reading as a task's `stoppedBeforeFinish`). Left out of `meanScore` like `errored`, and counted separately because a stop is not a failure. 0 on a run that was not stopped."
                                },
                                "passed": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Completed pass/fail verdicts that passed"
                                },
                                "failed": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Completed pass/fail verdicts that failed. A graded (0 to 1) verdict is never counted here, whatever its score."
                                },
                                "graded": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Completed graded verdicts (a 0 to 1 score); their credit is in `meanScore`, not in `passed` or `failed`"
                                },
                                "meanScore": {
                                  "type": [
                                    "number",
                                    "null"
                                  ],
                                  "minimum": 0,
                                  "maximum": 1,
                                  "description": "Mean 0 to 1 score over this check's verdicts: a passed verdict counts as 1, a failed one as 0, a graded one as its score. Outcomes with no verdict (errored) are left out. Null when no outcome reached a verdict."
                                }
                              },
                              "required": [
                                "criterionKey",
                                "name",
                                "scored",
                                "errored",
                                "stopped",
                                "passed",
                                "failed",
                                "graded",
                                "meanScore"
                              ],
                              "additionalProperties": false,
                              "description": "One check's whole-run outcome for one cell"
                            },
                            "maxItems": 50,
                            "description": "The evaluation's, datasets', and tasks' criteria, by name; empty for older runs, which recorded none"
                          },
                          "taskEnds": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "agentFailed": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Tasks whose agent run failed (criteria recorded `subject_failed`)"
                              },
                              "agentTimedOut": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Tasks that hit the agent's working-time limit (criteria recorded `subject_timed_out`)"
                              },
                              "notStarted": {
                                "type": "object",
                                "properties": {
                                  "sandbox": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "ai_budget": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "not_picked_up": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "not_ready": {
                                    "type": "integer",
                                    "minimum": 0
                                  },
                                  "credits_exhausted": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "default": 0
                                  },
                                  "user_budget_exceeded": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "default": 0
                                  }
                                },
                                "required": [
                                  "sandbox",
                                  "ai_budget",
                                  "not_picked_up",
                                  "not_ready"
                                ],
                                "additionalProperties": false,
                                "description": "Tasks that never started, by reason: withdrawn at the run's start limit, or refused at dispatch for budget reasons (criteria recorded `not_started`)"
                              },
                              "stopped": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Tasks cut short because a person stopped the run (a `STOPPED` run; criteria recorded `cancelled`). These are not failures."
                              },
                              "criteriaTaken": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Number of criteria on the failed, timed-out, and never-started tasks, each of which recorded how the task ended instead of a verdict. Subtract this from a no-verdict check count (one that already excludes a person's stop) to get the judge's own failures."
                              }
                            },
                            "required": [
                              "agentFailed",
                              "agentTimedOut",
                              "notStarted",
                              "stopped",
                              "criteriaTaken"
                            ],
                            "additionalProperties": false,
                            "description": "How this cell's settled tasks that gave no answer ended, counted once per task (the agent's task failed, the agent ran out of time, the task never started (by reason), or a person's stop cut it short). These are the same figures the Runs table row adds up. All zeros when every settled task answered; null for an older run, which recorded no task endings."
                          }
                        },
                        "required": [
                          "cellId",
                          "total",
                          "succeeded",
                          "failed",
                          "avgScore",
                          "costPerTaskUsd",
                          "p95LatencyMs",
                          "passedCount",
                          "criterionCount",
                          "criteria",
                          "taskEnds"
                        ],
                        "additionalProperties": false,
                        "description": "Whole-run totals for one cell, including the per-criterion figures"
                      },
                      "description": "Whole-run totals, one per cell of the run in cell order; never an average over the current page"
                    },
                    "statsAvailable": {
                      "type": "boolean",
                      "description": "False when results for this run cannot be read"
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "taskId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "position": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "exclusiveMinimum": 0,
                            "description": "Position in the run's fixed task order; null for runs without an ordered version"
                          },
                          "heldOut": {
                            "type": "boolean",
                            "description": "The task's Split in the dataset version this run pinned: true is Validation (scored separately, never learned from), false is Train. False too for a run that pinned no dataset version: it recorded no Split."
                          },
                          "text": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "captured"
                                    ]
                                  },
                                  "prompt": {
                                    "type": "object",
                                    "properties": {
                                      "text": {
                                        "type": "string",
                                        "maxLength": 512
                                      },
                                      "truncated": {
                                        "type": "boolean",
                                        "description": "The value is cut short; read the full value from `GET /runs/{runId}/tasks/{taskId}`"
                                      }
                                    },
                                    "required": [
                                      "text",
                                      "truncated"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "expected": {
                                    "type": [
                                      "object",
                                      "null"
                                    ],
                                    "properties": {
                                      "text": {
                                        "type": "string",
                                        "maxLength": 512
                                      },
                                      "truncated": {
                                        "type": "boolean",
                                        "description": "The value is cut short; read the full value from `GET /runs/{runId}/tasks/{taskId}`"
                                      }
                                    },
                                    "required": [
                                      "text",
                                      "truncated"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "expectedFileCount": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "description": "Number of expected files (answer keys) the run pinned for this task, alongside its expected text. A task may expect files and no text."
                                  }
                                },
                                "required": [
                                  "state",
                                  "prompt",
                                  "expected",
                                  "expectedFileCount"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "unavailable"
                                    ]
                                  },
                                  "reason": {
                                    "type": "string",
                                    "enum": [
                                      "not_captured",
                                      "version_unavailable",
                                      "snapshot_missing"
                                    ]
                                  }
                                },
                                "required": [
                                  "state",
                                  "reason"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          },
                          "output": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "text": {
                                "type": "string",
                                "maxLength": 512
                              },
                              "truncated": {
                                "type": "boolean",
                                "description": "The value is cut short; read the full value from `GET /runs/{runId}/tasks/{taskId}`"
                              }
                            },
                            "required": [
                              "text",
                              "truncated"
                            ],
                            "additionalProperties": false,
                            "description": "Preview of the agent's recorded output, or null when not available"
                          },
                          "outputStatus": {
                            "type": "string",
                            "enum": [
                              "answered",
                              "pending",
                              "unavailable",
                              "didnt_run"
                            ],
                            "description": "Exact state of the agent command's answer; an empty answer is not a missing one. `didnt_run`: no answer came before the run ended, and none will (`notRunning` says why)."
                          },
                          "criteriaAvailable": {
                            "type": "boolean",
                            "description": "False when this run did not record task checks or the pinned task record is missing"
                          },
                          "criteria": {
                            "type": "object",
                            "properties": {
                              "totalCount": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "entries": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "key": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "owner": {
                                      "type": "string",
                                      "enum": [
                                        "evaluation",
                                        "dataset",
                                        "task"
                                      ],
                                      "description": "An evaluation's verifiers grade every task it runs; a dataset's criteria grade every task in that dataset; a task's criteria grade only that task"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    },
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "llm_judge",
                                        "agent_judge",
                                        "exact_match",
                                        "code_verifier",
                                        "rule"
                                      ]
                                    },
                                    "weight": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    },
                                    "outcome": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "status": {
                                              "type": "string",
                                              "enum": [
                                                "pending"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "status"
                                          ],
                                          "additionalProperties": false,
                                          "description": "The task has not settled and the run is still going"
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "status": {
                                              "type": "string",
                                              "enum": [
                                                "didnt_run"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "status"
                                          ],
                                          "additionalProperties": false,
                                          "description": "The run ended before the task settled; the row's `notRunning` says why"
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "status": {
                                              "type": "string",
                                              "enum": [
                                                "completed"
                                              ]
                                            },
                                            "score": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            }
                                          },
                                          "required": [
                                            "status",
                                            "score"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "status": {
                                              "type": "string",
                                              "enum": [
                                                "error"
                                              ]
                                            },
                                            "code": {
                                              "type": "string",
                                              "enum": [
                                                "invalid_code",
                                                "invalid_verdict",
                                                "execution_failed",
                                                "timed_out",
                                                "cancelled",
                                                "input_unavailable",
                                                "output_limit",
                                                "runtime_unavailable",
                                                "batch_deadline",
                                                "inference_unavailable",
                                                "not_started",
                                                "malformed_output",
                                                "subject_failed",
                                                "subject_timed_out"
                                              ]
                                            },
                                            "message": {
                                              "type": "string",
                                              "maxLength": 512,
                                              "description": "The error's recorded message, cut to the preview length (for example, the shared message for `runtime_unavailable`)"
                                            }
                                          },
                                          "required": [
                                            "status",
                                            "code",
                                            "message"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "key",
                                    "owner",
                                    "name",
                                    "kind",
                                    "weight",
                                    "outcome"
                                  ],
                                  "additionalProperties": false,
                                  "description": "One of a task's checks with its outcome on this run"
                                },
                                "maxItems": 8
                              }
                            },
                            "required": [
                              "totalCount",
                              "entries"
                            ],
                            "additionalProperties": false
                          },
                          "recordedCriteria": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "total": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "errored": {
                                "type": "integer",
                                "minimum": 0
                              }
                            },
                            "required": [
                              "total",
                              "errored"
                            ],
                            "additionalProperties": false,
                            "description": "The outcomes this task's settled execution recorded, which make up its score; null until it settles. A run recorded while an evaluation could own checks holds more outcomes than the task has pinned checks."
                          },
                          "dispatch": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "dispatchId": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1
                              },
                              "taskId": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1
                              },
                              "taskPath": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "agentId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "status": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "error": {
                                "type": [
                                  "object",
                                  "null"
                                ],
                                "properties": {
                                  "text": {
                                    "type": "string",
                                    "maxLength": 512
                                  },
                                  "truncated": {
                                    "type": "boolean",
                                    "description": "The value is cut short; read the full value from `GET /runs/{runId}/tasks/{taskId}`"
                                  }
                                },
                                "required": [
                                  "text",
                                  "truncated"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "dispatchId",
                              "taskId",
                              "taskPath",
                              "agentId",
                              "status",
                              "error"
                            ],
                            "additionalProperties": false
                          },
                          "score": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 1
                          },
                          "costUsd": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Set only when the full cost of the agent and its checks is known; otherwise null"
                          },
                          "latencyMs": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "How long the agent took to complete, from its dispatch timestamps"
                          },
                          "notRunning": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "waiting"
                                    ]
                                  },
                                  "wait": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "since": {
                                            "type": "string",
                                            "format": "date-time",
                                            "description": "When the longest current wait began (ISO 8601)"
                                          },
                                          "waiting": {
                                            "type": "array",
                                            "items": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "enum": [
                                                        "subject"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "kind"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "The cell's own task (the agent being evaluated) is still waiting for a sandbox to run in"
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "enum": [
                                                        "check"
                                                      ]
                                                    },
                                                    "key": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "description": "The waiting judge check's verifier key, as on task rows"
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "key"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "An agent-judge check whose own task is still waiting for a sandbox to run in"
                                                }
                                              ],
                                              "description": "One part of a cell that is waiting for a sandbox to run in"
                                            },
                                            "minItems": 1,
                                            "description": "Every part of the cell waiting now: the agent being evaluated first, then checks in the order they began waiting"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "sandbox"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "since",
                                          "waiting",
                                          "reason"
                                        ],
                                        "additionalProperties": false,
                                        "description": "Waiting for a sandbox to run in: none was free when the agent or a judge check tried to start"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "ai_budget"
                                            ]
                                          },
                                          "since": {
                                            "type": "string",
                                            "format": "date-time",
                                            "description": "When the budget refusal holding the cell's model was observed (ISO 8601)"
                                          }
                                        },
                                        "required": [
                                          "reason",
                                          "since"
                                        ],
                                        "additionalProperties": false,
                                        "description": "On hold: the AI budget is used up, so the agent's task is not started"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "reason": {
                                            "type": "string",
                                            "enum": [
                                              "judge_slot"
                                            ]
                                          },
                                          "since": {
                                            "type": "string",
                                            "format": "date-time",
                                            "description": "When the cell's longest-waiting agent judge asked for its turn (ISO 8601)"
                                          }
                                        },
                                        "required": [
                                          "reason",
                                          "since"
                                        ],
                                        "additionalProperties": false,
                                        "description": "Judging, waiting for a free agent judge slot: the run already has as many agent judges running as it allows"
                                      }
                                    ],
                                    "description": "Why the cell is waiting now"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "wait"
                                ],
                                "additionalProperties": false,
                                "description": "The run is live and the task is waiting (for a sandbox to run in, or on hold because of the AI budget)"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "didnt_run"
                                    ]
                                  },
                                  "reason": {
                                    "type": "object",
                                    "properties": {
                                      "text": {
                                        "type": "string",
                                        "maxLength": 512,
                                        "minLength": 1
                                      },
                                      "truncated": {
                                        "type": "boolean",
                                        "description": "The reason is cut to 512 characters; the run's whole error is `error` on `GET /runs/{runId}`."
                                      }
                                    },
                                    "required": [
                                      "text",
                                      "truncated"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Why, as the run recorded it: the run's own error (cut to the preview length; the full run record has all of it), or a fixed sentence for a run that ended without one. Display it as is; do not parse it."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "reason"
                                ],
                                "additionalProperties": false,
                                "description": "Didn't run: the run ended before this task settled"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Why the unsettled task is not running now: it is waiting (live run), or it didn't run (the run ended before it settled). Null while it runs, once it settles, and for runs not graded by criteria."
                          },
                          "stoppedBeforeFinish": {
                            "type": "boolean",
                            "description": "A person stopped the run before this task finished: it didn't run, or it settled with what the stop canceled. Not a failure. False for a task that settled on its own (even with an error) and on a run that completed or failed."
                          }
                        },
                        "required": [
                          "taskId",
                          "position",
                          "heldOut",
                          "text",
                          "output",
                          "outputStatus",
                          "criteriaAvailable",
                          "criteria",
                          "recordedCriteria",
                          "dispatch",
                          "score",
                          "costUsd",
                          "latencyMs",
                          "notRunning",
                          "stoppedBeforeFinish"
                        ],
                        "additionalProperties": false
                      },
                      "maxItems": 50
                    },
                    "totalCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of tasks known to be in this run"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1
                    },
                    "waitingCounts": {
                      "type": "object",
                      "properties": {
                        "sandbox": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Cells waiting for a sandbox to run in"
                        },
                        "aiBudget": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Cells on hold because the AI budget is used up"
                        },
                        "judgeSlot": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Cells whose agent judges are waiting for a free agent judge slot in the run"
                        }
                      },
                      "required": [
                        "sandbox",
                        "aiBudget",
                        "judgeSlot"
                      ],
                      "additionalProperties": false,
                      "description": "Tasks across every cell of the run waiting now, by reason (alongside the run's settled and total figures)"
                    }
                  },
                  "required": [
                    "run",
                    "version",
                    "resultContract",
                    "pinnedCriteriaCount",
                    "stats",
                    "statsAvailable",
                    "rows",
                    "totalCount",
                    "nextCursor",
                    "waitingCounts"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid (`error` is `Invalid request`, with `details`); or `cellId`, `cursor` or `taskId` is not part of this run (`error` says which; no `details`, no `code`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/runs/$RUN_ID/tasks\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode \"cellId=$CELL_ID\" \\\n  --data-urlencode 'limit=50'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nrun_id = os.environ[\"RUN_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/runs/{run_id}/tasks\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"cellId\": os.environ[\"CELL_ID\"], \"limit\": 50},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/runs/${encodeURIComponent(env(\"RUN_ID\"))}/tasks`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"cellId\", env(\"CELL_ID\"))\nurl.searchParams.set(\"limit\", \"50\")\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          },
          {
            "lang": "shell",
            "label": "CLI",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n\n# Each task's score and the criteria it did not fully pass, on one cell (page with --cursor <nextCursor>)\ncontext evals benchmark run tasks $RUN_ID --cell $CELL_ID | jq '.rows[] | {taskId, score, failed: [.criteria.entries[] | select(.outcome.status == \"completed\" and .outcome.score < 1) | .name]}'"
          }
        ]
      }
    },
    "/runs/{runId}/tasks/{taskId}": {
      "get": {
        "tags": [
          "Runs"
        ],
        "summary": "Get one task's result",
        "description": "The task's full record, as the full export writes it: the pinned task text, the complete recorded answer (or why there is none), every criterion's settled outcome with its reasoning, the task's cost, its criteria cost, and its latency. A task outside the run's pinned task set is rejected.",
        "operationId": "getRunTask",
        "parameters": [
          {
            "in": "path",
            "name": "runId",
            "required": true,
            "description": "Run identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Run identifier"
            }
          },
          {
            "in": "path",
            "name": "taskId",
            "required": true,
            "description": "Task identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "A task in this run's pinned task set"
            }
          },
          {
            "in": "query",
            "name": "cellId",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "One of this run's cells"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "taskId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "cellId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "position": {
                      "type": "integer",
                      "exclusiveMinimum": 0
                    },
                    "heldOut": {
                      "type": "boolean",
                      "description": "The task's Split in the dataset version this run pinned: true is Validation (scored separately, never learned from), false is Train. False too for a run that pinned no dataset version: it recorded no Split."
                    },
                    "task": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "captured"
                              ]
                            },
                            "prompt": {
                              "type": "string"
                            },
                            "expected": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "expectedFileCount": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "Number of expected files (answer keys) the run pinned for this task, alongside its expected text. A task may expect files and no text."
                            }
                          },
                          "required": [
                            "state",
                            "prompt",
                            "expected",
                            "expectedFileCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "unavailable"
                              ]
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "not_captured",
                                "version_unavailable",
                                "snapshot_missing"
                              ]
                            }
                          },
                          "required": [
                            "state",
                            "reason"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "description": "Full pinned prompt and expected text, or an explicit state saying the snapshot is missing"
                    },
                    "output": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "answered"
                              ]
                            },
                            "text": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "state",
                            "text"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "pending"
                              ]
                            },
                            "phase": {
                              "type": "string",
                              "enum": [
                                "not_dispatched",
                                "queued",
                                "running"
                              ]
                            }
                          },
                          "required": [
                            "state",
                            "phase"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "unavailable"
                              ]
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "runtime_missing",
                                "turn_missing",
                                "turn_failed",
                                "turn_cancelled",
                                "reader_failed"
                              ]
                            },
                            "errorCode": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "message": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "state",
                            "reason",
                            "errorCode",
                            "message"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "didnt_run"
                              ]
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false,
                          "description": "No answer came before the run ended, and none will; the row's `notRunning` says why"
                        }
                      ],
                      "description": "The answer from the agent's registered command itself, never a later turn or text taken from elsewhere in the task"
                    },
                    "result": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "revision": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "outcome": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "status": {
                                        "type": "string",
                                        "enum": [
                                          "completed"
                                        ]
                                      },
                                      "verdict": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "enum": [
                                                  "boolean"
                                                ]
                                              },
                                              "passed": {
                                                "type": "boolean"
                                              },
                                              "reasoning": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "passed",
                                              "reasoning"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "enum": [
                                                  "float"
                                                ]
                                              },
                                              "score": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              },
                                              "reasoning": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "score",
                                              "reasoning"
                                            ],
                                            "additionalProperties": false
                                          }
                                        ],
                                        "description": "Validated check output; a failing judgment is a valid result, not an execution error"
                                      }
                                    },
                                    "required": [
                                      "status",
                                      "verdict"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "status": {
                                        "type": "string",
                                        "enum": [
                                          "error"
                                        ]
                                      },
                                      "code": {
                                        "type": "string",
                                        "enum": [
                                          "invalid_code",
                                          "invalid_verdict",
                                          "execution_failed",
                                          "timed_out",
                                          "cancelled",
                                          "input_unavailable",
                                          "output_limit",
                                          "runtime_unavailable",
                                          "batch_deadline",
                                          "inference_unavailable",
                                          "not_started"
                                        ]
                                      },
                                      "message": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2048,
                                        "description": "Why, in words. For a crash, the error itself (a check's exception and where it was raised, or a judge's reason), with untrusted text redacted."
                                      }
                                    },
                                    "required": [
                                      "status",
                                      "code",
                                      "message"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "status": {
                                        "type": "string",
                                        "enum": [
                                          "error"
                                        ]
                                      },
                                      "code": {
                                        "type": "string",
                                        "enum": [
                                          "subject_failed",
                                          "subject_timed_out"
                                        ]
                                      },
                                      "message": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2048,
                                        "description": "Why, in words. For a crash, the error itself (a check's exception and where it was raised, or a judge's reason), with untrusted text redacted."
                                      }
                                    },
                                    "required": [
                                      "status",
                                      "code",
                                      "message"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The agent's task failed or ran out of time, so this criterion could not be judged; the message gives the task's own reason"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "status": {
                                        "type": "string",
                                        "enum": [
                                          "error"
                                        ]
                                      },
                                      "code": {
                                        "type": "string",
                                        "enum": [
                                          "malformed_output"
                                        ]
                                      },
                                      "message": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2048,
                                        "description": "Why, in words. For a crash, the error itself (a check's exception and where it was raised, or a judge's reason), with untrusted text redacted."
                                      },
                                      "judgeAnswer": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 4000,
                                        "description": "The opening characters of what the judge returned on its last attempt, with untrusted text redacted"
                                      }
                                    },
                                    "required": [
                                      "status",
                                      "code",
                                      "message",
                                      "judgeAnswer"
                                    ],
                                    "additionalProperties": false,
                                    "description": "An LLM judge answered, but its answer could not be read as a verdict"
                                  }
                                ],
                                "description": "Execution outcome. An error is not a verdict: it is shown as a failure with its reason and left out of the score."
                              }
                            },
                            "required": [
                              "key",
                              "outcome"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "score": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "minimum": 0,
                          "maximum": 1,
                          "description": "Weighted mean of the checks that reached a verdict. Null when this task has no configured checks or none of them reached a verdict."
                        },
                        "errorCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of checks that reached no verdict (could not run): shown as failed and left out of `score`"
                        },
                        "judgeCostUsd": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "The checks' cost known when they returned: the LLM judges' charge (null if any is unavailable), and zero for deterministic checks and for agent judges, whose cost is tracked through `judgeTaskRunIds`"
                        },
                        "judgeTaskRunIds": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1
                          },
                          "default": [],
                          "description": "The judge task runs that agent judges started for this task; they are billed with the agent's run. Absent on results settled before agent-judge runs were recorded (those have a null `judgeCostUsd`, so their cost stays unknown)."
                        }
                      },
                      "required": [
                        "revision",
                        "results",
                        "score",
                        "errorCount",
                        "judgeCostUsd"
                      ],
                      "additionalProperties": false,
                      "description": "All settled check outcomes with full reasoning; null until the task settles"
                    },
                    "costUsd": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Cost of the task run plus its checks, set only when both are final and known"
                    },
                    "criteriaCostUsd": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "The checks' cost: LLM judges' charges plus the billed cost of agent judges' task runs; null while any part is unknown or the task has not settled"
                    },
                    "latencyMs": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "minimum": 0,
                      "description": "Duration of this registered command's turn"
                    },
                    "taskPath": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "notRunning": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "didnt_run"
                          ]
                        },
                        "reason": {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string",
                              "maxLength": 512,
                              "minLength": 1
                            },
                            "truncated": {
                              "type": "boolean",
                              "description": "The reason is cut to 512 characters; the run's whole error is `error` on `GET /runs/{runId}`."
                            }
                          },
                          "required": [
                            "text",
                            "truncated"
                          ],
                          "additionalProperties": false,
                          "description": "Why, as the run recorded it: the run's own error (cut to the preview length; the full run record has all of it), or a fixed sentence for a run that ended without one. Display it as is; do not parse it."
                        }
                      },
                      "required": [
                        "kind",
                        "reason"
                      ],
                      "additionalProperties": false,
                      "description": "Set when the run ended before this task settled; an export never shows a live wait"
                    },
                    "stoppedBeforeFinish": {
                      "type": "boolean",
                      "description": "A person stopped the run before this task finished: it didn't run, or it settled with what the stop canceled. Not a failure. False for a task that settled on its own (even with an error) and on a run that completed or failed."
                    }
                  },
                  "required": [
                    "taskId",
                    "cellId",
                    "position",
                    "heldOut",
                    "task",
                    "output",
                    "result",
                    "costUsd",
                    "criteriaCostUsd",
                    "latencyMs",
                    "taskPath",
                    "notRunning",
                    "stoppedBeforeFinish"
                  ],
                  "additionalProperties": false,
                  "description": "One task's full record on one cell, as the full export writes it"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid (`error` is `Invalid request`, with `details`); or `cellId`, `cursor` or `taskId` is not part of this run (`error` says which; no `details`, no `code`). Or the run is from before per-task records were kept (`This historical run recorded no per-task record`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/runs/$RUN_ID/tasks/$TASK_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode \"cellId=$CELL_ID\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nrun_id = os.environ[\"RUN_ID\"]\ntask_id = os.environ[\"TASK_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/runs/{run_id}/tasks/{task_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"cellId\": os.environ[\"CELL_ID\"]},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/runs/${encodeURIComponent(env(\"RUN_ID\"))}/tasks/${encodeURIComponent(env(\"TASK_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"cellId\", env(\"CELL_ID\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          },
          {
            "lang": "shell",
            "label": "CLI",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n\n# Every criterion's verdict and reasoning for one task\ncontext evals benchmark run task \"$RUN_ID\" \"$TASK_ID\" --cell \"$CELL_ID\" | jq '.result.results[] | {key, outcome}'"
          }
        ]
      }
    },
    "/feedback/enabled": {
      "get": {
        "tags": [
          "Feedback"
        ],
        "summary": "Check whether feedback is on",
        "description": "Deployment-wide: whether Evals is turned on for this deployment; the same answer for every organization.",
        "operationId": "getFeedbackEnabled",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "enabled": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "enabled"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`), or its owner is not a member of the organization. A key limited to specific agents is not refused here.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "orgRead",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/feedback/enabled\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/feedback/enabled\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/feedback/enabled`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/feedback/schemas": {
      "get": {
        "tags": [
          "Feedback"
        ],
        "summary": "List feedback schemas",
        "description": "Returns the feedback forms people fill in for this organization: each active automatic scorecard whose scope is the whole organization or that has no scope, as the scorecard version a submission names. Any member of the organization can read it.",
        "operationId": "listFeedbackSchemas",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemas": {
                      "type": "array",
                      "items": {}
                    }
                  },
                  "required": [
                    "schemas"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`), or its owner is not a member of the organization. A key limited to specific agents is not refused here.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "orgRead",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/feedback/schemas\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/feedback/schemas\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/feedback/schemas`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/feedback": {
      "get": {
        "tags": [
          "Feedback"
        ],
        "summary": "List feedback",
        "description": "Returns the organization's feedback entries, newest first, one page at a time (`page` from 1, `limit` up to 100, 20 by default), with the total count. Pass `sessionId` to read one session's feedback.",
        "operationId": "listFeedback",
        "parameters": [
          {
            "in": "query",
            "name": "sessionId",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Filter by session identifier"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {}
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer"
                        },
                        "limit": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "totalPages": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "totalPages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "entries",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/feedback\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/feedback\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/feedback`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          },
          {
            "lang": "shell",
            "label": "CLI",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n\n# Feedback on one session, 50 a page (GET /feedback takes only sessionId, page and limit)\ncontext evals feedback list --session \"$SESSION_ID\" --page-size 50"
          }
        ]
      }
    },
    "/judges": {
      "get": {
        "tags": [
          "Judges"
        ],
        "summary": "List judges",
        "description": "Returns the organization's judges and the shared `SYSTEM` judges, `SYSTEM` judges first and each group newest first, each with the number of scorecards that use it.",
        "operationId": "listJudges",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Unique judge identifier"
                      },
                      "orgId": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "Organization that owns this judge (null for `SYSTEM` judges)"
                      },
                      "createdById": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "User who created this judge"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "description": "Judge display name"
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 1000,
                        "description": "Optional judge description"
                      },
                      "instructions": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 10000,
                        "description": "Evaluation criteria for the judge: what to assess. The system builds the full prompt, with the trace input and output, when the judge runs."
                      },
                      "outputType": {
                        "type": "string",
                        "enum": [
                          "FLOAT",
                          "BOOLEAN",
                          "TEXT"
                        ],
                        "description": "How the judge outputs its evaluation"
                      },
                      "model": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Model the judge uses for evaluation"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "SYSTEM",
                          "USER"
                        ],
                        "description": "Whether this is a system-provided or user-created judge"
                      },
                      "scaleLabels": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "additionalProperties": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "description": "A FLOAT judge's rating-scale captions, keyed by scale point; null shows the bare numbers (always null for BOOLEAN and TEXT)"
                      },
                      "scorecardCount": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Number of scorecards that use this judge"
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Creation timestamp"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Last update timestamp"
                      }
                    },
                    "required": [
                      "id",
                      "orgId",
                      "createdById",
                      "name",
                      "description",
                      "instructions",
                      "outputType",
                      "model",
                      "type",
                      "scaleLabels",
                      "createdAt",
                      "updatedAt"
                    ],
                    "additionalProperties": false,
                    "description": "An LLM-as-judge evaluator configuration"
                  },
                  "description": "Judges visible to the organization"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/judges\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/judges\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/judges`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      },
      "post": {
        "tags": [
          "Judges"
        ],
        "summary": "Create a judge",
        "description": "An LLM judge in the organization's library, for scorecards and monitors.",
        "operationId": "createJudge",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "description": "A key you choose for this request (a UUID works; at most 255 characters; a blank one is refused 400, code `idempotency_key_empty`). A retry with the same key and the same body answers the first success again instead of acting twice; kept 24 hours. Send one on every create and run start you might retry.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "Judge display name"
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 1000,
                    "description": "Optional description"
                  },
                  "instructions": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000,
                    "description": "Evaluation criteria -- what the judge should assess"
                  },
                  "outputType": {
                    "type": "string",
                    "enum": [
                      "FLOAT",
                      "BOOLEAN",
                      "TEXT"
                    ],
                    "description": "Output format",
                    "default": "FLOAT"
                  },
                  "model": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Provider-prefixed LLM model to use; omitted records this deployment's small model"
                  },
                  "scaleLabels": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "description": "FLOAT only: captions for the rating scale's points; omitted shows the bare numbers"
                  }
                },
                "required": [
                  "name",
                  "instructions"
                ],
                "additionalProperties": false,
                "description": "Input for creating a new judge"
              },
              "example": {
                "name": "rest-writes politeness",
                "instructions": "Score 1 to 5 for how polite the reply is.",
                "outputType": "FLOAT"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success. A retry with the same `Idempotency-Key` and the same request answers this again, with `Idempotent-Replayed: true`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique judge identifier"
                    },
                    "orgId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Organization that owns this judge (null for `SYSTEM` judges)"
                    },
                    "createdById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "User who created this judge"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100,
                      "description": "Judge display name"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 1000,
                      "description": "Optional judge description"
                    },
                    "instructions": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 10000,
                      "description": "Evaluation criteria for the judge: what to assess. The system builds the full prompt, with the trace input and output, when the judge runs."
                    },
                    "outputType": {
                      "type": "string",
                      "enum": [
                        "FLOAT",
                        "BOOLEAN",
                        "TEXT"
                      ],
                      "description": "How the judge outputs its evaluation"
                    },
                    "model": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Model the judge uses for evaluation"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "SYSTEM",
                        "USER"
                      ],
                      "description": "Whether this is a system-provided or user-created judge"
                    },
                    "scaleLabels": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                      },
                      "description": "A FLOAT judge's rating-scale captions, keyed by scale point; null shows the bare numbers (always null for BOOLEAN and TEXT)"
                    },
                    "scorecardCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of scorecards that use this judge"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "createdById",
                    "name",
                    "description",
                    "instructions",
                    "outputType",
                    "model",
                    "type",
                    "scaleLabels",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false,
                  "description": "An LLM-as-judge evaluator configuration"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "This `Idempotency-Key` was already used on a different request (code `idempotency_key_reused`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "judge.create",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n# One Idempotency-Key per request you mean to make once; send the same key again to retry it.\ncurl -sS --fail-with-body -X POST \"$CONTEXT_APP_ORIGIN/api/v1/evals/judges\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  -H \"Idempotency-Key: $IDEMPOTENCY_KEY\" \\\n  --data-binary @- <<'JSON'\n{\n  \"name\": \"rest-writes politeness\",\n  \"instructions\": \"Score 1 to 5 for how polite the reply is.\",\n  \"outputType\": \"FLOAT\"\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.post(\n    f\"{origin}/api/v1/evals/judges\",\n    headers={\"Authorization\": f\"Bearer {api_key}\", \"Idempotency-Key\": os.environ[\"IDEMPOTENCY_KEY\"]},\n    json={\n        \"name\": \"rest-writes politeness\",\n        \"instructions\": \"Score 1 to 5 for how polite the reply is.\",\n        \"outputType\": \"FLOAT\"\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/judges`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"name\": \"rest-writes politeness\",\n  \"instructions\": \"Score 1 to 5 for how polite the reply is.\",\n  \"outputType\": \"FLOAT\"\n}\nconst res = await fetch(url, {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\", \"Idempotency-Key\": env(\"IDEMPOTENCY_KEY\") },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/judges/{judgeId}": {
      "get": {
        "tags": [
          "Judges"
        ],
        "summary": "Get a judge",
        "description": "Returns one judge: its instructions, model, output type and the number of scorecards that use it. A `SYSTEM` judge is readable from every organization; another organization's judge answers 404.",
        "operationId": "getJudge",
        "parameters": [
          {
            "in": "path",
            "name": "judgeId",
            "required": true,
            "description": "Judge identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Judge identifier"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique judge identifier"
                    },
                    "orgId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Organization that owns this judge (null for `SYSTEM` judges)"
                    },
                    "createdById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "User who created this judge"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100,
                      "description": "Judge display name"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 1000,
                      "description": "Optional judge description"
                    },
                    "instructions": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 10000,
                      "description": "Evaluation criteria for the judge: what to assess. The system builds the full prompt, with the trace input and output, when the judge runs."
                    },
                    "outputType": {
                      "type": "string",
                      "enum": [
                        "FLOAT",
                        "BOOLEAN",
                        "TEXT"
                      ],
                      "description": "How the judge outputs its evaluation"
                    },
                    "model": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Model the judge uses for evaluation"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "SYSTEM",
                        "USER"
                      ],
                      "description": "Whether this is a system-provided or user-created judge"
                    },
                    "scaleLabels": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                      },
                      "description": "A FLOAT judge's rating-scale captions, keyed by scale point; null shows the bare numbers (always null for BOOLEAN and TEXT)"
                    },
                    "scorecardCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of scorecards that use this judge"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "createdById",
                    "name",
                    "description",
                    "instructions",
                    "outputType",
                    "model",
                    "type",
                    "scaleLabels",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false,
                  "description": "An LLM-as-judge evaluator configuration"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/judges/$JUDGE_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\njudge_id = os.environ[\"JUDGE_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/judges/{judge_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/judges/${encodeURIComponent(env(\"JUDGE_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      },
      "patch": {
        "tags": [
          "Judges"
        ],
        "summary": "Edit a judge",
        "description": "Changes only the fields you send.",
        "operationId": "updateJudge",
        "parameters": [
          {
            "in": "path",
            "name": "judgeId",
            "required": true,
            "description": "Judge identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Judge (from the path)"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "New name"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000,
                    "description": "New description"
                  },
                  "instructions": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000,
                    "description": "New evaluation criteria"
                  },
                  "outputType": {
                    "type": "string",
                    "enum": [
                      "FLOAT",
                      "BOOLEAN",
                      "TEXT"
                    ],
                    "description": "New output format"
                  },
                  "model": {
                    "type": "string",
                    "description": "New LLM model"
                  },
                  "scaleLabels": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "description": "FLOAT only: new rating-scale captions (null clears them; omit to leave unchanged). Changing outputType away from FLOAT clears them"
                  }
                },
                "additionalProperties": false,
                "description": "Input for updating an existing judge"
              },
              "example": {
                "instructions": "Score 1 to 5 for how polite and how clear the reply is."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique judge identifier"
                    },
                    "orgId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Organization that owns this judge (null for `SYSTEM` judges)"
                    },
                    "createdById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "User who created this judge"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100,
                      "description": "Judge display name"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 1000,
                      "description": "Optional judge description"
                    },
                    "instructions": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 10000,
                      "description": "Evaluation criteria for the judge: what to assess. The system builds the full prompt, with the trace input and output, when the judge runs."
                    },
                    "outputType": {
                      "type": "string",
                      "enum": [
                        "FLOAT",
                        "BOOLEAN",
                        "TEXT"
                      ],
                      "description": "How the judge outputs its evaluation"
                    },
                    "model": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Model the judge uses for evaluation"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "SYSTEM",
                        "USER"
                      ],
                      "description": "Whether this is a system-provided or user-created judge"
                    },
                    "scaleLabels": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "additionalProperties": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                      },
                      "description": "A FLOAT judge's rating-scale captions, keyed by scale point; null shows the bare numbers (always null for BOOLEAN and TEXT)"
                    },
                    "scorecardCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of scorecards that use this judge"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "createdById",
                    "name",
                    "description",
                    "instructions",
                    "outputType",
                    "model",
                    "type",
                    "scaleLabels",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false,
                  "description": "An LLM-as-judge evaluator configuration"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "judge.update",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body -X PATCH \"$CONTEXT_APP_ORIGIN/api/v1/evals/judges/$JUDGE_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary @- <<'JSON'\n{\n  \"instructions\": \"Score 1 to 5 for how polite and how clear the reply is.\"\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\njudge_id = os.environ[\"JUDGE_ID\"]\n\nresp = requests.patch(\n    f\"{origin}/api/v1/evals/judges/{judge_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    json={\n        \"instructions\": \"Score 1 to 5 for how polite and how clear the reply is.\"\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/judges/${encodeURIComponent(env(\"JUDGE_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"instructions\": \"Score 1 to 5 for how polite and how clear the reply is.\"\n}\nconst res = await fetch(url, {\n  method: \"PATCH\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/scorecards": {
      "get": {
        "tags": [
          "Scorecards"
        ],
        "summary": "List scorecards",
        "description": "Returns the organization's automatic scorecards in their display order, each with its judges in order and its scopes. Skill rubrics are not listed.",
        "operationId": "listScorecards",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Unique scorecard identifier"
                      },
                      "orgId": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Organization that owns this scorecard"
                      },
                      "createdById": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "description": "User who created this scorecard"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "description": "Scorecard display name"
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 1000,
                        "description": "Optional scorecard description"
                      },
                      "isActive": {
                        "type": "boolean",
                        "description": "Whether the scorecard is active"
                      },
                      "isAdditionalCommentsRequired": {
                        "type": "boolean",
                        "description": "Whether the additional comments field is required when submitting feedback"
                      },
                      "displayOrder": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Position in the scorecard list"
                      },
                      "kind": {
                        "type": "string",
                        "enum": [
                          "auto",
                          "skill-rubric"
                        ],
                        "description": "Always `auto` on this API (automatic feedback scorecards). Skill rubrics, managed with `context evals scorecard`, are never served here; a skill rubric's ID answers 404."
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Creation timestamp"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Last update timestamp"
                      },
                      "judges": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "description": "Unique link identifier"
                            },
                            "scorecardId": {
                              "type": "string",
                              "minLength": 1,
                              "description": "Scorecard this link belongs to"
                            },
                            "judgeId": {
                              "type": "string",
                              "minLength": 1,
                              "description": "Linked judge"
                            },
                            "order": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "Execution and display order within the scorecard"
                            },
                            "isRequired": {
                              "type": "boolean",
                              "description": "Whether this judge must pass for the scorecard to pass"
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time",
                              "description": "When the judge was added to the scorecard"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "description": "Linked judge's display name"
                            },
                            "instructions": {
                              "type": "string",
                              "description": "Linked judge's evaluation instructions"
                            },
                            "outputType": {
                              "type": "string",
                              "enum": [
                                "FLOAT",
                                "BOOLEAN",
                                "TEXT"
                              ],
                              "description": "Linked judge's output type"
                            },
                            "scaleLabels": {
                              "type": [
                                "object",
                                "null"
                              ],
                              "additionalProperties": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "description": "Linked judge's rating-scale captions (FLOAT only); null shows the bare numbers"
                            }
                          },
                          "required": [
                            "id",
                            "scorecardId",
                            "judgeId",
                            "order",
                            "isRequired",
                            "createdAt",
                            "name",
                            "instructions",
                            "outputType",
                            "scaleLabels"
                          ],
                          "additionalProperties": false,
                          "description": "Links a judge to a scorecard, with its order, required flag, and the judge's content"
                        },
                        "description": "Attached judges, in order"
                      },
                      "scopes": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "description": "Unique scope identifier"
                            },
                            "scorecardId": {
                              "type": "string",
                              "minLength": 1,
                              "description": "Scorecard this link belongs to"
                            },
                            "orgId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "minLength": 1,
                              "description": "Organization filter (null matches any organization)"
                            },
                            "workspaceId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "minLength": 1,
                              "description": "Workspace filter (null matches any workspace)"
                            },
                            "userId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "minLength": 1,
                              "description": "User filter (null matches any user)"
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time",
                              "description": "When this scope was added"
                            }
                          },
                          "required": [
                            "id",
                            "scorecardId",
                            "orgId",
                            "workspaceId",
                            "userId",
                            "createdAt"
                          ],
                          "additionalProperties": false,
                          "description": "Scope filter for a scorecard: null fields match any value"
                        },
                        "description": "Scope filters"
                      },
                      "judgeCount": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Number of attached judges"
                      },
                      "evalRunCount": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Number of evaluation runs that use this scorecard"
                      }
                    },
                    "required": [
                      "id",
                      "orgId",
                      "createdById",
                      "name",
                      "description",
                      "isActive",
                      "isAdditionalCommentsRequired",
                      "displayOrder",
                      "kind",
                      "createdAt",
                      "updatedAt",
                      "judges",
                      "scopes",
                      "judgeCount"
                    ],
                    "additionalProperties": false,
                    "description": "A scorecard with its judges and scopes"
                  },
                  "description": "The organization's automatic feedback scorecards, with their judges and scopes. Skill rubrics are not included."
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/scorecards\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/scorecards\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/scorecards`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/scorecards/{scorecardId}": {
      "get": {
        "tags": [
          "Scorecards"
        ],
        "summary": "Get a scorecard",
        "description": "Returns one automatic scorecard with its judges and scopes. A skill rubric's ID, or another organization's scorecard, answers 404.",
        "operationId": "getScorecard",
        "parameters": [
          {
            "in": "path",
            "name": "scorecardId",
            "required": true,
            "description": "Scorecard identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Scorecard identifier"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique scorecard identifier"
                    },
                    "orgId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Organization that owns this scorecard"
                    },
                    "createdById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "User who created this scorecard"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100,
                      "description": "Scorecard display name"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 1000,
                      "description": "Optional scorecard description"
                    },
                    "isActive": {
                      "type": "boolean",
                      "description": "Whether the scorecard is active"
                    },
                    "isAdditionalCommentsRequired": {
                      "type": "boolean",
                      "description": "Whether the additional comments field is required when submitting feedback"
                    },
                    "displayOrder": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Position in the scorecard list"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "auto",
                        "skill-rubric"
                      ],
                      "description": "Always `auto` on this API (automatic feedback scorecards). Skill rubrics, managed with `context evals scorecard`, are never served here; a skill rubric's ID answers 404."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    },
                    "judges": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Unique link identifier"
                          },
                          "scorecardId": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Scorecard this link belongs to"
                          },
                          "judgeId": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Linked judge"
                          },
                          "order": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Execution and display order within the scorecard"
                          },
                          "isRequired": {
                            "type": "boolean",
                            "description": "Whether this judge must pass for the scorecard to pass"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "description": "When the judge was added to the scorecard"
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Linked judge's display name"
                          },
                          "instructions": {
                            "type": "string",
                            "description": "Linked judge's evaluation instructions"
                          },
                          "outputType": {
                            "type": "string",
                            "enum": [
                              "FLOAT",
                              "BOOLEAN",
                              "TEXT"
                            ],
                            "description": "Linked judge's output type"
                          },
                          "scaleLabels": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 40
                            },
                            "description": "Linked judge's rating-scale captions (FLOAT only); null shows the bare numbers"
                          }
                        },
                        "required": [
                          "id",
                          "scorecardId",
                          "judgeId",
                          "order",
                          "isRequired",
                          "createdAt",
                          "name",
                          "instructions",
                          "outputType",
                          "scaleLabels"
                        ],
                        "additionalProperties": false,
                        "description": "Links a judge to a scorecard, with its order, required flag, and the judge's content"
                      },
                      "description": "Attached judges, in order"
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Unique scope identifier"
                          },
                          "scorecardId": {
                            "type": "string",
                            "minLength": 1,
                            "description": "Scorecard this link belongs to"
                          },
                          "orgId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "minLength": 1,
                            "description": "Organization filter (null matches any organization)"
                          },
                          "workspaceId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "minLength": 1,
                            "description": "Workspace filter (null matches any workspace)"
                          },
                          "userId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "minLength": 1,
                            "description": "User filter (null matches any user)"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "description": "When this scope was added"
                          }
                        },
                        "required": [
                          "id",
                          "scorecardId",
                          "orgId",
                          "workspaceId",
                          "userId",
                          "createdAt"
                        ],
                        "additionalProperties": false,
                        "description": "Scope filter for a scorecard: null fields match any value"
                      },
                      "description": "Scope filters"
                    },
                    "judgeCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of attached judges"
                    },
                    "evalRunCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of evaluation runs that use this scorecard"
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "createdById",
                    "name",
                    "description",
                    "isActive",
                    "isAdditionalCommentsRequired",
                    "displayOrder",
                    "kind",
                    "createdAt",
                    "updatedAt",
                    "judges",
                    "scopes",
                    "judgeCount"
                  ],
                  "additionalProperties": false,
                  "description": "A scorecard with its judges and scopes"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/scorecards/$SCORECARD_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nscorecard_id = os.environ[\"SCORECARD_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/scorecards/{scorecard_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/scorecards/${encodeURIComponent(env(\"SCORECARD_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/scorecards/scope-options": {
      "get": {
        "tags": [
          "Scorecards"
        ],
        "summary": "List scorecard scope options",
        "description": "Returns the workspaces and users you can choose from when setting a scorecard's scope: up to 50 of each, by name.",
        "operationId": "getScorecardScopeOptions",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "workspaces": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Workspace identifier"
                          },
                          "name": {
                            "type": "string",
                            "description": "Display name"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false,
                        "description": "An option you can pick when setting a scorecard's scope"
                      },
                      "description": "Up to 50 workspaces in the organization, by name"
                    },
                    "users": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "User identifier"
                          },
                          "name": {
                            "type": "string",
                            "description": "Display name"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false,
                        "description": "An option you can pick when setting a scorecard's scope"
                      },
                      "description": "Up to 50 users in the organization, by name"
                    }
                  },
                  "required": [
                    "workspaces",
                    "users"
                  ],
                  "additionalProperties": false,
                  "description": "Workspaces and users you can choose from when setting a scorecard's scope"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or, on this endpoint, the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "evals",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/scorecards/scope-options\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/scorecards/scope-options\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/scorecards/scope-options`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/traces/sessions": {
      "get": {
        "tags": [
          "Traces"
        ],
        "summary": "List trace sessions",
        "description": "Returns trace sessions one window at a time, latest activity first (ordered by each session's latest call in the range). Follow `nextCursor` until it is null. The first page fixes three things that the cursor carries through the rest of the walk: the calls stored by the time of that read (`window.writtenBy`), the range end it used (`window.to`), and the data source it read (`readSource`). As a result, every session with such a call is returned once, in last-activity order, with no duplicates; calls stored later appear in the next walk. `startedAt` is the session's first call, even if it falls before the range; calls, tokens, cost, and duration cover only the range. `filters` is a JSON-encoded array of filter conditions. `totalCount` stops at 10,000; `totalCountIsCapped: true` marks a capped count.",
        "operationId": "listTraceSessions",
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Start of the date range (ISO 8601)"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "End of the date range (ISO 8601)"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "description": "Page number, starting at 1, for table-style paging. Ignored when `cursor` is set."
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Token from a previous response's `nextCursor`. Gives stable iteration and is the preferred way to page through results in code. A walk keeps the range end it started with (returned as `window.to`). A token from the older start-time order, or a malformed token, returns 400 `INVALID_CURSOR`: start again from the first page."
            }
          },
          {
            "in": "query",
            "name": "pageSize",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 15,
              "description": "Sessions per page"
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 500,
              "description": "Token search over trace text. Terms match as whole tokens (runs of letters, digits, or non-ASCII characters; punctuation and underscores split terms). Matching ignores ASCII case, and every term must match. A `*` widens a term: `zip*` matches words starting with zip (zip, zipped, zipping), `*ip` matches words ending in `ip`, and `*ognit*` matches any text containing `ognit`. A match covers the whole conversation: every turn of a conversation whose text contains all the terms is returned, not only the turn that introduced them, and the terms may appear in different turns. Terms must occur inside the queried time range. Input with no searchable tokens (punctuation only) returns 400. Some time ranges are served from a data source that matches terms by substring instead; `readSource` in the response says which source served the range."
            }
          },
          {
            "in": "query",
            "name": "filters",
            "required": false,
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "field": {
                        "type": "string",
                        "enum": [
                          "success",
                          "cost_usd",
                          "duration_ms",
                          "model",
                          "model_provider",
                          "input_tokens",
                          "output_tokens",
                          "error_message",
                          "agent_id",
                          "user_id",
                          "workspace_id",
                          "chat_id",
                          "skill_id",
                          "origin"
                        ],
                        "description": "Field to filter on"
                      },
                      "operator": {
                        "type": "string",
                        "enum": [
                          "equals",
                          "not_equals",
                          "greater_than",
                          "less_than",
                          "gte",
                          "lte",
                          "contains",
                          "in",
                          "not_in"
                        ],
                        "description": "Comparison operator for a filter condition"
                      },
                      "value": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Filter value as a string, interpreted according to the field's type"
                      }
                    },
                    "required": [
                      "field",
                      "operator",
                      "value"
                    ],
                    "additionalProperties": false,
                    "description": "One filter condition: a field, an operator, and a value"
                  },
                  "maxItems": 20,
                  "description": "Filter conditions"
                }
              }
            },
            "description": "Send it as JSON in one value, for example `filters=[{\"field\":\"success\",\"operator\":\"equals\",\"value\":\"false\"}]`. Any other value is refused with 400."
          },
          {
            "in": "query",
            "name": "matchAll",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true,
              "description": "Combine filter conditions with AND (true) or with OR (false)"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "sessionId": {
                            "type": "string",
                            "description": "Session ID"
                          },
                          "taskId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "ID of the linked task; null when no task is linked"
                          },
                          "taskTitle": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Title of the linked task; null when no task is linked"
                          },
                          "startedAt": {
                            "type": "string",
                            "description": "The session's first call (ISO 8601), even if it falls outside the requested range"
                          },
                          "totalDurationMs": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Sum of call durations within the requested range, in milliseconds"
                          },
                          "turnCount": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Number of assistant turns"
                          },
                          "totalTokens": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Billed tokens: the sum of input, output, reasoning, cache write, and cache read tokens across all calls. Null when no call in the session reported token usage (different from a real 0)."
                          },
                          "totalCost": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Session cost in USD, computed the same way for the session list and session detail. When the session's calls in scope (inside the requested range, if one is given) belong to task runs, this is the billed amount for those runs, summed. A run's bill is its full total, including its sub-agents' and auxiliary calls, so on a range-bounded read it can include calls of that run outside the range; a run with no calls in the range is not counted. Null for a sub-agent session, for a session whose calls in scope mix calls with and without a run, for a run that another session of the same chat also belongs to, and when any run's billed amount is unknown (not final, missing, or not rated) or billing data could not be read. When no call in scope belongs to a run, this is the sum of those calls' costs, or null when no call reported a cost (unknown, different from a real 0). `totalCostSource` says which method was used."
                          },
                          "models": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Distinct models used in this session"
                          },
                          "allSuccess": {
                            "type": "boolean",
                            "description": "`false` if any turn failed"
                          },
                          "errorCount": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Number of failed turns in this session"
                          },
                          "errorMessageSample": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "One example error message from a failed turn; null if all turns succeeded or none had a message"
                          },
                          "agentId": {
                            "type": "string",
                            "description": "Agent ID (the same for the whole session)"
                          },
                          "userId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "User ID of the agent owner"
                          },
                          "agentName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Agent display name"
                          },
                          "userName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "User display name"
                          },
                          "workspaceId": {
                            "type": "string",
                            "description": "Workspace ID for the chat; empty when the task had no workspace when its traces were recorded"
                          },
                          "workspaceName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Workspace display name; null when `workspaceId` is empty or the workspace is not found"
                          },
                          "skills": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Distinct skill IDs invoked across all turns in this session"
                          },
                          "sessionRole": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "root",
                              "subtask",
                              "continuation",
                              null
                            ],
                            "description": "`root`, `subtask` (a sub-agent session), or `continuation`. Null when the session has no role on record (sessions recorded before roles were tracked)."
                          },
                          "parentSessionId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Session ID of the session that started this one; set for `subtask` sessions, null otherwise"
                          },
                          "subagents": {
                            "type": "object",
                            "properties": {
                              "count": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Number of sub-agent (`subtask`) sessions started under this session, including nested ones"
                              },
                              "costUsd": {
                                "type": "number",
                                "minimum": 0,
                                "description": "Estimated provider cost of those sub-agent sessions' model calls in the query range (sum of per-call costs), not billed credits. Billing data is not tracked per session."
                              }
                            },
                            "required": [
                              "count",
                              "costUsd"
                            ],
                            "additionalProperties": false,
                            "description": "Sub-agent summary for this session; count 0 and cost 0 when it started none"
                          },
                          "origin": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "evaluation-run"
                                    ]
                                  },
                                  "run": {
                                    "type": [
                                      "object",
                                      "null"
                                    ],
                                    "properties": {
                                      "runId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "The evaluation run that started this task (or the task its sub-agent belongs to)"
                                      },
                                      "evaluationId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "The run's evaluation, so you can link to the run page"
                                      },
                                      "evaluationName": {
                                        "type": "string",
                                        "description": "The run's evaluation name, so you can label the task with it instead of its generated title (run and task IDs)"
                                      }
                                    },
                                    "required": [
                                      "runId",
                                      "evaluationId",
                                      "evaluationName"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The run to link to; null when no run records it anymore (its evaluation was deleted)"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "run"
                                ],
                                "additionalProperties": false,
                                "description": "A task started by an evaluation run, or a sub-agent of one"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "judge"
                                    ],
                                    "description": "A judge's session"
                                  },
                                  "monitor": {
                                    "type": [
                                      "object",
                                      "null"
                                    ],
                                    "properties": {
                                      "monitorId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "The monitor whose agent judge ran in this session, so you can link to it"
                                      },
                                      "monitorName": {
                                        "type": "string",
                                        "description": "The monitor's name, so you can group the session under it instead of among the person's chats"
                                      }
                                    },
                                    "required": [
                                      "monitorId",
                                      "monitorName"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The monitor whose verdict names this session's task as its judge. Null for the organization's judge agent grading an evaluation, a sub-agent of a judge, or a monitor judge that has not posted a verdict."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "monitor"
                                ],
                                "additionalProperties": false,
                                "description": "A task of the organization's judge agent grading another task's output, or a monitor's agent judge grading a person's turn"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "skill-learning-replay"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false,
                                "description": "A skill-learning replay scoring a prompt candidate"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "production"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false,
                                "description": "The organization's own work: classified into workflows and counted as production"
                              }
                            ],
                            "description": "What started this session's chat: an evaluation run (with the run to link to), a judge, a skill-learning replay, or production. Only production sessions are included in workflows."
                          },
                          "lastActivityAt": {
                            "type": "string",
                            "description": "Latest call of this session inside the requested range (ISO 8601). The list is ordered by this, newest first."
                          },
                          "feedbackSummary": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "summary"
                                    ]
                                  },
                                  "summary": {
                                    "type": "object",
                                    "properties": {
                                      "count": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "description": "Number of feedback submissions on this record"
                                      },
                                      "avgRating": {
                                        "type": [
                                          "number",
                                          "null"
                                        ],
                                        "minimum": 1,
                                        "maximum": 5,
                                        "description": "Mean numeric rating on the 1 to 5 scale, or null when there is no numeric rating"
                                      },
                                      "maxRating": {
                                        "type": [
                                          "number",
                                          "null"
                                        ],
                                        "minimum": 1,
                                        "maximum": 5,
                                        "description": "Highest numeric rating on the 1 to 5 scale, or null when there is no numeric rating"
                                      },
                                      "withTextCount": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "description": "Number of submissions with a non-empty comment"
                                      }
                                    },
                                    "required": [
                                      "count",
                                      "avgRating",
                                      "maxRating",
                                      "withTextCount"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Feedback summary for one task, run, or trace session"
                                  }
                                },
                                "required": [
                                  "state",
                                  "summary"
                                ],
                                "additionalProperties": false,
                                "description": "Feedback summary loaded; a count of zero means no feedback"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "unavailable"
                                    ]
                                  }
                                },
                                "required": [
                                  "state"
                                ],
                                "additionalProperties": false,
                                "description": "Feedback summary could not be loaded; trace data is still available"
                              }
                            ],
                            "description": "Feedback state for list rows, telling no feedback apart from feedback that could not be loaded"
                          },
                          "chatUrl": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Absolute link to the chat in the app (`<APP_ORIGIN>/client/tasks/<id>`); null when no task is linked"
                          },
                          "originKind": {
                            "type": "string",
                            "enum": [
                              "evaluation-run",
                              "judge",
                              "skill-learning-replay",
                              "production"
                            ],
                            "description": "`origin.kind` as a flat field, for tabular use"
                          },
                          "preview": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "loaded"
                                    ]
                                  },
                                  "firstUserMessage": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "The first message the person typed in this chat; null when the range contains none"
                                  },
                                  "matchSnippet": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "description": "The first text in the chat that matches a search term; null when no search is given"
                                  }
                                },
                                "required": [
                                  "state",
                                  "firstUserMessage",
                                  "matchSnippet"
                                ],
                                "additionalProperties": false,
                                "description": "Preview read from the chat's message parts"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "not-loaded"
                                    ]
                                  },
                                  "reason": {
                                    "type": "string",
                                    "enum": [
                                      "not-chats-scope",
                                      "legacy-source"
                                    ],
                                    "description": "`not-chats-scope`: previews load only in the chats scope. `legacy-source`: this range is served from a data source that has no per-part text."
                                  }
                                },
                                "required": [
                                  "state",
                                  "reason"
                                ],
                                "additionalProperties": false,
                                "description": "No preview for this row, with the reason"
                              }
                            ],
                            "description": "First user message and matching text for a listed chat"
                          },
                          "totalCostSource": {
                            "type": "string",
                            "enum": [
                              "billing_ledger",
                              "warehouse"
                            ],
                            "description": "Where the session's `totalCost` comes from. `billing_ledger`: the session's calls in scope (inside the requested range, if one is given) belong to task runs, and `totalCost` is the billed amount for those runs, including sub-agents' and auxiliary calls (null while the billed amount cannot be determined). `warehouse`: no call in scope belongs to a run, and `totalCost` is the sum of those calls' costs, which excludes sub-agents."
                          },
                          "workflows": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "loaded"
                                    ]
                                  },
                                  "workflows": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "topicId": {
                                          "type": "string",
                                          "description": "Workflow ID; the workflow page is `/client/evals/workflows/t/<topicId>`"
                                        },
                                        "name": {
                                          "type": "string",
                                          "description": "Workflow display name"
                                        }
                                      },
                                      "required": [
                                        "topicId",
                                        "name"
                                      ],
                                      "additionalProperties": false,
                                      "description": "An active workflow the session's chat belongs to"
                                    },
                                    "description": "The chat's current workflows, most confident first; empty when the chat belongs to none (unassigned)"
                                  }
                                },
                                "required": [
                                  "state",
                                  "workflows"
                                ],
                                "additionalProperties": false,
                                "description": "Workflow membership read from the chat's current workflows"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "unavailable"
                                    ]
                                  }
                                },
                                "required": [
                                  "state"
                                ],
                                "additionalProperties": false,
                                "description": "Workflow membership could not be read; trace data is still available"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "withheld"
                                    ]
                                  }
                                },
                                "required": [
                                  "state"
                                ],
                                "additionalProperties": false,
                                "description": "Workflow names are hidden from this caller (workflows are turned off for the organization, or the caller lacks organization-wide evaluations access); membership was not read"
                              }
                            ],
                            "description": "Workflow membership, telling unassigned apart from unreadable and from hidden"
                          }
                        },
                        "required": [
                          "sessionId",
                          "taskId",
                          "taskTitle",
                          "startedAt",
                          "totalDurationMs",
                          "turnCount",
                          "totalTokens",
                          "totalCost",
                          "models",
                          "allSuccess",
                          "errorCount",
                          "errorMessageSample",
                          "agentId",
                          "userId",
                          "agentName",
                          "userName",
                          "workspaceId",
                          "workspaceName",
                          "skills",
                          "sessionRole",
                          "parentSessionId",
                          "subagents",
                          "origin",
                          "lastActivityAt",
                          "feedbackSummary",
                          "chatUrl",
                          "originKind",
                          "preview",
                          "totalCostSource",
                          "workflows"
                        ],
                        "additionalProperties": false,
                        "description": "Trace session list row with a feedback summary, link, and preview. Counts, tokens, and duration cover calls inside the requested range. When `totalCostSource` is `billing_ledger`, `totalCost` is the bill for the runs those calls belong to, computed the same way as in session detail."
                      }
                    },
                    "totalCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of matching sessions for pagination, counted up to a cap of 10,000"
                    },
                    "totalCountIsCapped": {
                      "type": "boolean",
                      "description": "`true` when more sessions matched than the cap; `totalCount` is then the cap, not the exact total"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Token for the next window; null when every matching session has been returned"
                    },
                    "window": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "string",
                          "description": "Start of the range searched (ISO 8601), after applying the server's maximum range"
                        },
                        "to": {
                          "type": "string",
                          "description": "End of the range searched (ISO 8601). On a cursor page, this is the end the cursor carries, not the request's `to`."
                        },
                        "writtenBy": {
                          "type": "string",
                          "description": "Cutoff time (ISO 8601, server clock): only calls stored by this time are listed and counted. A first page sets it when it reads; a cursor page uses the one its token carries, so a whole walk reads one fixed set of calls."
                        },
                        "clamped": {
                          "type": "boolean",
                          "description": "`true` when the requested start was earlier than the server's maximum range allows and was moved forward"
                        },
                        "maxDays": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "description": "Maximum range width the server allows, in days"
                        }
                      },
                      "required": [
                        "from",
                        "to",
                        "writtenBy",
                        "clamped",
                        "maxDays"
                      ],
                      "additionalProperties": false,
                      "description": "The time range the server searched, so you can display it"
                    },
                    "readSource": {
                      "type": "string",
                      "enum": [
                        "v2",
                        "legacy"
                      ],
                      "description": "Which data source served this range; it decides how search terms match"
                    },
                    "searchMode": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "How the search was matched, in words (for example, 'zip* (starts with), earlier (whole word)'); null when no search is given"
                    },
                    "viewerTimeZone": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "IANA time zone from the requesting person's profile, for showing dates in their zone; null when no person is behind the request or no zone is set"
                    }
                  },
                  "required": [
                    "data",
                    "totalCount",
                    "totalCountIsCapped",
                    "nextCursor",
                    "window",
                    "readSource",
                    "searchMode",
                    "viewerTimeZone"
                  ],
                  "additionalProperties": false,
                  "description": "One window of the session list; follow `nextCursor` for the rest"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`), or its owner is not a member of the organization. A key limited to specific agents is not refused here: it reads those agents' traces only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Trace data can't be read: this deployment has no trace store configured (code `CLICKHOUSE_UNAVAILABLE`), or the server could not yet tell which store holds this range (`TRACE_READ_SOURCE_UNRESOLVED`, retry). A trace store that fails during the query answers 500 with code `QUERY_FAILED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "traces",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/traces/sessions\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode 'from=2026-10-01T00:00:00Z' \\\n  --data-urlencode 'to=2026-10-31T00:00:00Z' \\\n  --data-urlencode 'pageSize=50' \\\n  --data-urlencode 'filters=[{\"field\":\"success\",\"operator\":\"equals\",\"value\":\"false\"}]'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/traces/sessions\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"from\": \"2026-10-01T00:00:00Z\", \"to\": \"2026-10-31T00:00:00Z\", \"pageSize\": 50, \"filters\": json.dumps([{\"field\": \"success\", \"operator\": \"equals\", \"value\": \"false\"}])},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/traces/sessions`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"from\", \"2026-10-01T00:00:00Z\")\nurl.searchParams.set(\"to\", \"2026-10-31T00:00:00Z\")\nurl.searchParams.set(\"pageSize\", \"50\")\nurl.searchParams.set(\"filters\", JSON.stringify([{\"field\": \"success\", \"operator\": \"equals\", \"value\": \"false\"}]))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          },
          {
            "lang": "shell",
            "label": "CLI",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n\n# Production sessions only: no judge, Evaluation-run or replay work (rows stored before origin was recorded are not listed)\ncontext evals traces list --from 7d --where \"origin=production\"\n\n# FTS over the last week\ncontext evals traces list --from 7d --search \"rate limit\"\n\n# Failed turns over 50 cents in the last month\ncontext evals traces list --from 30d --where \"success=false\" --where \"cost_usd>0.50\"\n\n# Triage failure patterns from row data alone, with no per-session fetches\ncontext evals traces list --from 7d --where \"success=false\" | jq -r '.data[] | select(.errorCount > 0) | \"\\(.sessionId)\\t\\(.errorCount)\\t\\(.errorMessageSample)\"'\n\n# Workspace-scoped sessions that used either PDF or DOCX skill\ncontext evals traces list --from 7d --where \"workspace_id=$WORKSPACE_ID\" --where \"skill_id in $PDF_SKILL_ID,$DOCX_SKILL_ID\"\n\n# Sessions that used BOTH skills (--match all is the default, so repeated --where flags must all match)\ncontext evals traces list --from 7d --where \"skill_id=$PDF_SKILL_ID\" --where \"skill_id=$DOCX_SKILL_ID\"\n\n# Drill in to every session in the last 24h (each get writes its own file)\ncontext evals traces list --from 24h --page-size 50 | jq -r '.data[].sessionId' | xargs -I {} context evals traces get {}"
          }
        ]
      }
    },
    "/traces/sessions/{sessionId}": {
      "get": {
        "tags": [
          "Traces"
        ],
        "summary": "Get a trace session",
        "description": "An unknown session ID answers 200 with an empty session (`turnCount` 0, `taskId` null) and no calls, not 404.",
        "operationId": "getTraceSessionDetail",
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "required": true,
            "description": "Trace session ID",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Trace session ID"
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Optional range start (ISO 8601). When both bounds are given, the server skips data outside the range."
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Optional range end (ISO 8601)"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Token from a previous response's `nextCursor`; omit it for the first window"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "session": {
                      "type": "object",
                      "properties": {
                        "sessionId": {
                          "type": "string",
                          "description": "Session ID"
                        },
                        "taskId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "ID of the linked task; null when no task is linked"
                        },
                        "taskTitle": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Title of the linked task; null when no task is linked"
                        },
                        "startedAt": {
                          "type": "string",
                          "description": "The session's first call (ISO 8601), even if it falls outside the requested range"
                        },
                        "totalDurationMs": {
                          "type": "number",
                          "minimum": 0,
                          "description": "Sum of call durations within the requested range, in milliseconds"
                        },
                        "turnCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of assistant turns"
                        },
                        "totalTokens": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Billed tokens: the sum of input, output, reasoning, cache write, and cache read tokens across all calls. Null when no call in the session reported token usage (different from a real 0)."
                        },
                        "totalCost": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "minimum": 0,
                          "description": "Session cost in USD, computed the same way for the session list and session detail. When the session's calls in scope (inside the requested range, if one is given) belong to task runs, this is the billed amount for those runs, summed. A run's bill is its full total, including its sub-agents' and auxiliary calls, so on a range-bounded read it can include calls of that run outside the range; a run with no calls in the range is not counted. Null for a sub-agent session, for a session whose calls in scope mix calls with and without a run, for a run that another session of the same chat also belongs to, and when any run's billed amount is unknown (not final, missing, or not rated) or billing data could not be read. When no call in scope belongs to a run, this is the sum of those calls' costs, or null when no call reported a cost (unknown, different from a real 0). `totalCostSource` says which method was used."
                        },
                        "models": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Distinct models used in this session"
                        },
                        "allSuccess": {
                          "type": "boolean",
                          "description": "`false` if any turn failed"
                        },
                        "errorCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Number of failed turns in this session"
                        },
                        "errorMessageSample": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "One example error message from a failed turn; null if all turns succeeded or none had a message"
                        },
                        "agentId": {
                          "type": "string",
                          "description": "Agent ID (the same for the whole session)"
                        },
                        "userId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "User ID of the agent owner"
                        },
                        "agentName": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Agent display name"
                        },
                        "userName": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "User display name"
                        },
                        "workspaceId": {
                          "type": "string",
                          "description": "Workspace ID for the chat; empty when the task had no workspace when its traces were recorded"
                        },
                        "workspaceName": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Workspace display name; null when `workspaceId` is empty or the workspace is not found"
                        },
                        "skills": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Distinct skill IDs invoked across all turns in this session"
                        },
                        "sessionRole": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "root",
                            "subtask",
                            "continuation",
                            null
                          ],
                          "description": "`root`, `subtask` (a sub-agent session), or `continuation`. Null when the session has no role on record (sessions recorded before roles were tracked)."
                        },
                        "parentSessionId": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Session ID of the session that started this one; set for `subtask` sessions, null otherwise"
                        },
                        "subagents": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "minimum": 0,
                              "description": "Number of sub-agent (`subtask`) sessions started under this session, including nested ones"
                            },
                            "costUsd": {
                              "type": "number",
                              "minimum": 0,
                              "description": "Estimated provider cost of those sub-agent sessions' model calls in the query range (sum of per-call costs), not billed credits. Billing data is not tracked per session."
                            }
                          },
                          "required": [
                            "count",
                            "costUsd"
                          ],
                          "additionalProperties": false,
                          "description": "Sub-agent summary for this session; count 0 and cost 0 when it started none"
                        },
                        "origin": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "evaluation-run"
                                  ]
                                },
                                "run": {
                                  "type": [
                                    "object",
                                    "null"
                                  ],
                                  "properties": {
                                    "runId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "The evaluation run that started this task (or the task its sub-agent belongs to)"
                                    },
                                    "evaluationId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "The run's evaluation, so you can link to the run page"
                                    },
                                    "evaluationName": {
                                      "type": "string",
                                      "description": "The run's evaluation name, so you can label the task with it instead of its generated title (run and task IDs)"
                                    }
                                  },
                                  "required": [
                                    "runId",
                                    "evaluationId",
                                    "evaluationName"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The run to link to; null when no run records it anymore (its evaluation was deleted)"
                                }
                              },
                              "required": [
                                "kind",
                                "run"
                              ],
                              "additionalProperties": false,
                              "description": "A task started by an evaluation run, or a sub-agent of one"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "judge"
                                  ],
                                  "description": "A judge's session"
                                },
                                "monitor": {
                                  "type": [
                                    "object",
                                    "null"
                                  ],
                                  "properties": {
                                    "monitorId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "The monitor whose agent judge ran in this session, so you can link to it"
                                    },
                                    "monitorName": {
                                      "type": "string",
                                      "description": "The monitor's name, so you can group the session under it instead of among the person's chats"
                                    }
                                  },
                                  "required": [
                                    "monitorId",
                                    "monitorName"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The monitor whose verdict names this session's task as its judge. Null for the organization's judge agent grading an evaluation, a sub-agent of a judge, or a monitor judge that has not posted a verdict."
                                }
                              },
                              "required": [
                                "kind",
                                "monitor"
                              ],
                              "additionalProperties": false,
                              "description": "A task of the organization's judge agent grading another task's output, or a monitor's agent judge grading a person's turn"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "skill-learning-replay"
                                  ]
                                }
                              },
                              "required": [
                                "kind"
                              ],
                              "additionalProperties": false,
                              "description": "A skill-learning replay scoring a prompt candidate"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "production"
                                  ]
                                }
                              },
                              "required": [
                                "kind"
                              ],
                              "additionalProperties": false,
                              "description": "The organization's own work: classified into workflows and counted as production"
                            }
                          ],
                          "description": "What started this session's chat: an evaluation run (with the run to link to), a judge, a skill-learning replay, or production. Only production sessions are included in workflows."
                        }
                      },
                      "required": [
                        "sessionId",
                        "taskId",
                        "taskTitle",
                        "startedAt",
                        "totalDurationMs",
                        "turnCount",
                        "totalTokens",
                        "totalCost",
                        "models",
                        "allSuccess",
                        "errorCount",
                        "errorMessageSample",
                        "agentId",
                        "userId",
                        "agentName",
                        "userName",
                        "workspaceId",
                        "workspaceName",
                        "skills",
                        "sessionRole",
                        "parentSessionId",
                        "subagents",
                        "origin"
                      ],
                      "additionalProperties": false,
                      "description": "Session summary computed over the whole session, not only the returned window. Totals are exact no matter how many windows you have fetched."
                    },
                    "calls": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "traceId": {
                            "type": "string",
                            "description": "Composite trace ID: `sessionId:messageId`"
                          },
                          "timestamp": {
                            "type": "string",
                            "description": "Turn timestamp (ISO 8601)"
                          },
                          "durationMs": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Turn duration in milliseconds"
                          },
                          "model": {
                            "type": "string",
                            "description": "Model used"
                          },
                          "modelProvider": {
                            "type": "string",
                            "description": "Model provider"
                          },
                          "input": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Input messages as a JSON string. When `parts` is present, this is a 2048-character preview; the full content is in `parts` and `GET /traces/payloads`."
                          },
                          "output": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Assistant output parts as JSON. When `parts` is present, this is a 2048-character preview; render from `parts` instead."
                          },
                          "inputTokens": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Input token count"
                          },
                          "outputTokens": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Output token count"
                          },
                          "reasoningTokens": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Reasoning token count"
                          },
                          "cacheReadTokens": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Cache read token count"
                          },
                          "cacheWriteTokens": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Cache write token count"
                          },
                          "costUsd": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Cost in USD"
                          },
                          "success": {
                            "type": "boolean",
                            "description": "Whether this turn succeeded"
                          },
                          "errorMessage": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Error message if the turn failed"
                          },
                          "workspaceId": {
                            "type": "string",
                            "description": "Workspace that owns the chat for this call; empty when the task had no workspace"
                          },
                          "skillsUsed": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Skill IDs invoked in this turn"
                          },
                          "parts": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "messageId": {
                                  "type": "string",
                                  "description": "ID of the message the part belongs to"
                                },
                                "partIndex": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Position of the part within its source array"
                                },
                                "role": {
                                  "type": "string",
                                  "enum": [
                                    "user",
                                    "assistant"
                                  ],
                                  "description": "Message role the part was stored under"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "user_text",
                                    "assistant_text",
                                    "tool_call",
                                    "tool_result",
                                    "compaction",
                                    "legacy_snapshot"
                                  ],
                                  "description": "Stored content kind"
                                },
                                "toolName": {
                                  "type": "string",
                                  "description": "Tool name for `tool_call` and `tool_result` parts; empty string otherwise"
                                },
                                "text": {
                                  "type": "string",
                                  "description": "Searchable text of the part, capped at 64 KB (see `truncated`)"
                                },
                                "truncated": {
                                  "type": "boolean",
                                  "description": "`true` when the text was capped; fetch the payload for the full content"
                                },
                                "payloadKey": {
                                  "type": "object",
                                  "properties": {
                                    "chatId": {
                                      "type": "string",
                                      "description": "Stable conversation ID"
                                    },
                                    "messageId": {
                                      "type": "string",
                                      "description": "ID of the message that owns the part"
                                    },
                                    "partIndex": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "description": "Position of the part (an identifier, not a dense sequence)"
                                    },
                                    "day": {
                                      "type": "string",
                                      "description": "Date of the trace row that introduced the part (YYYY-MM-DD)"
                                    }
                                  },
                                  "required": [
                                    "chatId",
                                    "messageId",
                                    "partIndex",
                                    "day"
                                  ],
                                  "additionalProperties": false,
                                  "description": "Pass these fields to `GET /traces/payloads` to fetch the part's full raw JSON"
                                }
                              },
                              "required": [
                                "messageId",
                                "partIndex",
                                "role",
                                "kind",
                                "toolName",
                                "text",
                                "truncated",
                                "payloadKey"
                              ],
                              "additionalProperties": false,
                              "description": "One stored message part: `text` is the capped searchable text, and `payloadKey` fetches the full content"
                            },
                            "description": "This call's own message parts; present only when the session is stored in the current trace format"
                          },
                          "turnIndex": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Index into the response's `turns` array; present only when the session is stored in the current trace format"
                          }
                        },
                        "required": [
                          "traceId",
                          "timestamp",
                          "durationMs",
                          "model",
                          "modelProvider",
                          "input",
                          "output",
                          "inputTokens",
                          "outputTokens",
                          "reasoningTokens",
                          "cacheReadTokens",
                          "cacheWriteTokens",
                          "costUsd",
                          "success",
                          "errorMessage",
                          "workspaceId",
                          "skillsUsed"
                        ],
                        "additionalProperties": false,
                        "description": "One model turn within a trace session"
                      },
                      "description": "This window's turns, ordered by timestamp, then trace ID, ascending"
                    },
                    "turns": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "turnIndex": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Turn position within the session, starting at 0"
                          },
                          "userText": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Text of the user message that started the turn; null for continuation segments or segments after compaction"
                          },
                          "traceIds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Trace IDs of the calls that make up this turn, in chronological order"
                          }
                        },
                        "required": [
                          "turnIndex",
                          "userText",
                          "traceIds"
                        ],
                        "additionalProperties": false,
                        "description": "Turn boundary computed by the server (current trace format only)"
                      },
                      "description": "Turn boundaries for this window, computed by the server (`turnIndex` counts from the start of this window). Present only when the session is stored in the current trace format. When joining windows, offset the indexes by the number of turns collected so far, and merge the first turn into the previous window's last turn when `windowStartsMidTurn` is true."
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Token for the next window; null when the whole session has been returned. You can fetch any amount; keep following windows."
                    },
                    "totalCostSource": {
                      "type": "string",
                      "enum": [
                        "billing_ledger",
                        "warehouse"
                      ],
                      "description": "Where the session's `totalCost` comes from. `billing_ledger`: the session's calls in scope (inside the requested range, if one is given) belong to task runs, and `totalCost` is the billed amount for those runs, including sub-agents' and auxiliary calls (null while the billed amount cannot be determined). `warehouse`: no call in scope belongs to a run, and `totalCost` is the sum of those calls' costs, which excludes sub-agents."
                    },
                    "workflows": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "loaded"
                              ]
                            },
                            "workflows": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "topicId": {
                                    "type": "string",
                                    "description": "Workflow ID; the workflow page is `/client/evals/workflows/t/<topicId>`"
                                  },
                                  "name": {
                                    "type": "string",
                                    "description": "Workflow display name"
                                  }
                                },
                                "required": [
                                  "topicId",
                                  "name"
                                ],
                                "additionalProperties": false,
                                "description": "An active workflow the session's chat belongs to"
                              },
                              "description": "The chat's current workflows, most confident first; empty when the chat belongs to none (unassigned)"
                            }
                          },
                          "required": [
                            "state",
                            "workflows"
                          ],
                          "additionalProperties": false,
                          "description": "Workflow membership read from the chat's current workflows"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "unavailable"
                              ]
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false,
                          "description": "Workflow membership could not be read; trace data is still available"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "withheld"
                              ]
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false,
                          "description": "Workflow names are hidden from this caller (workflows are turned off for the organization, or the caller lacks organization-wide evaluations access); membership was not read"
                        }
                      ],
                      "description": "The workflows of the session's chat, read the same way as in the list row"
                    },
                    "windowStartsMidTurn": {
                      "type": "boolean",
                      "description": "`true` when this window's first calls continue a turn that started in a previous window (no boundary before them); use it to join windows. `false` or absent when the first turn starts in this window (with user text or compaction) or this is the first window of a continuation session. Current trace format only."
                    }
                  },
                  "required": [
                    "session",
                    "calls",
                    "nextCursor",
                    "totalCostSource",
                    "workflows"
                  ],
                  "additionalProperties": false,
                  "description": "One window of session detail, with a summary of the whole session; follow `nextCursor` for the rest"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`), or its owner is not a member of the organization. A key limited to specific agents is not refused here: it reads those agents' traces only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Trace data can't be read: this deployment has no trace store configured (code `CLICKHOUSE_UNAVAILABLE`), or the server could not yet tell which store holds this range (`TRACE_READ_SOURCE_UNRESOLVED`, retry). A trace store that fails during the query answers 500 with code `QUERY_FAILED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "traces",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/traces/sessions/$SESSION_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nsession_id = os.environ[\"SESSION_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/traces/sessions/{session_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/traces/sessions/${encodeURIComponent(env(\"SESSION_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          },
          {
            "lang": "shell",
            "label": "CLI",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n\n# One session: the file lands under ~/.context-cli/runs/, summary on stdout\ncontext evals traces get $SESSION_ID\n\n# Explicit output path\ncontext evals traces get $SESSION_ID --out /tmp/session.json"
          }
        ]
      }
    },
    "/traces/calls": {
      "get": {
        "tags": [
          "Traces"
        ],
        "summary": "List model calls",
        "description": "Paginated flat list of calls (one row per model turn), with the same filter and search syntax as the session list but applied to each call. Numeric filters (`cost_usd`, `duration_ms`, `input_tokens`, `output_tokens`) compare the call's own value rather than a session total. Each row includes `sessionId`, `taskId`, `taskTitle`, `agentName`, `userName`, and `workspaceName`, so the response is self-contained for bulk export. Rows carry `inputPreview` and `outputPreview` (first 2048 characters) instead of full `input` and `output`; use the session detail endpoint for the full text. `totalCount` stops at 10,000; `totalCountIsCapped: true` marks a capped count.",
        "operationId": "listTraceCalls",
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Start of the date range (ISO 8601)"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "End of the date range (ISO 8601)"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "description": "Page number, starting at 1"
            }
          },
          {
            "in": "query",
            "name": "pageSize",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 15,
              "description": "Calls per page"
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 500,
              "description": "Token search over trace text. Terms match as whole tokens (runs of letters, digits, or non-ASCII characters; punctuation and underscores split terms). Matching ignores ASCII case, and every term must match. A `*` widens a term: `zip*` matches words starting with zip (zip, zipped, zipping), `*ip` matches words ending in `ip`, and `*ognit*` matches any text containing `ognit`. A match covers the whole conversation: every turn of a conversation whose text contains all the terms is returned, not only the turn that introduced them, and the terms may appear in different turns. Terms must occur inside the queried time range. Input with no searchable tokens (punctuation only) returns 400. Some time ranges are served from an older data source that matches terms by substring instead; this response does not say which (`GET /traces/sessions` does, in `readSource`)."
            }
          },
          {
            "in": "query",
            "name": "filters",
            "required": false,
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "field": {
                        "type": "string",
                        "enum": [
                          "success",
                          "cost_usd",
                          "duration_ms",
                          "model",
                          "model_provider",
                          "input_tokens",
                          "output_tokens",
                          "error_message",
                          "agent_id",
                          "user_id",
                          "workspace_id",
                          "chat_id",
                          "skill_id",
                          "origin"
                        ],
                        "description": "Field to filter on"
                      },
                      "operator": {
                        "type": "string",
                        "enum": [
                          "equals",
                          "not_equals",
                          "greater_than",
                          "less_than",
                          "gte",
                          "lte",
                          "contains",
                          "in",
                          "not_in"
                        ],
                        "description": "Comparison operator for a filter condition"
                      },
                      "value": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Filter value as a string, interpreted according to the field's type"
                      }
                    },
                    "required": [
                      "field",
                      "operator",
                      "value"
                    ],
                    "additionalProperties": false,
                    "description": "One filter condition: a field, an operator, and a value"
                  },
                  "maxItems": 20,
                  "description": "Filter conditions, applied per call: numeric filters compare each call's own values"
                }
              }
            },
            "description": "Send it as JSON in one value, for example `filters=[{\"field\":\"success\",\"operator\":\"equals\",\"value\":\"false\"}]`. Any other value is refused with 400."
          },
          {
            "in": "query",
            "name": "matchAll",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true,
              "description": "Combine filter conditions with AND (true) or with OR (false)"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "traceId": {
                            "type": "string",
                            "description": "Composite trace ID: `sessionId:messageId`"
                          },
                          "timestamp": {
                            "type": "string",
                            "description": "Turn timestamp (ISO 8601)"
                          },
                          "durationMs": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Turn duration in milliseconds"
                          },
                          "model": {
                            "type": "string",
                            "description": "Model used"
                          },
                          "modelProvider": {
                            "type": "string",
                            "description": "Model provider"
                          },
                          "inputTokens": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Input token count"
                          },
                          "outputTokens": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Output token count"
                          },
                          "reasoningTokens": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Reasoning token count"
                          },
                          "cacheReadTokens": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Cache read token count"
                          },
                          "cacheWriteTokens": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Cache write token count"
                          },
                          "costUsd": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "minimum": 0,
                            "description": "Cost in USD"
                          },
                          "success": {
                            "type": "boolean",
                            "description": "Whether this turn succeeded"
                          },
                          "errorMessage": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Error message if the turn failed"
                          },
                          "workspaceId": {
                            "type": "string",
                            "description": "Workspace that owns the chat for this call; empty when the task had no workspace"
                          },
                          "skillsUsed": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Skill IDs invoked in this turn"
                          },
                          "parts": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "messageId": {
                                  "type": "string",
                                  "description": "ID of the message the part belongs to"
                                },
                                "partIndex": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Position of the part within its source array"
                                },
                                "role": {
                                  "type": "string",
                                  "enum": [
                                    "user",
                                    "assistant"
                                  ],
                                  "description": "Message role the part was stored under"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "user_text",
                                    "assistant_text",
                                    "tool_call",
                                    "tool_result",
                                    "compaction",
                                    "legacy_snapshot"
                                  ],
                                  "description": "Stored content kind"
                                },
                                "toolName": {
                                  "type": "string",
                                  "description": "Tool name for `tool_call` and `tool_result` parts; empty string otherwise"
                                },
                                "text": {
                                  "type": "string",
                                  "description": "Searchable text of the part, capped at 64 KB (see `truncated`)"
                                },
                                "truncated": {
                                  "type": "boolean",
                                  "description": "`true` when the text was capped; fetch the payload for the full content"
                                },
                                "payloadKey": {
                                  "type": "object",
                                  "properties": {
                                    "chatId": {
                                      "type": "string",
                                      "description": "Stable conversation ID"
                                    },
                                    "messageId": {
                                      "type": "string",
                                      "description": "ID of the message that owns the part"
                                    },
                                    "partIndex": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "description": "Position of the part (an identifier, not a dense sequence)"
                                    },
                                    "day": {
                                      "type": "string",
                                      "description": "Date of the trace row that introduced the part (YYYY-MM-DD)"
                                    }
                                  },
                                  "required": [
                                    "chatId",
                                    "messageId",
                                    "partIndex",
                                    "day"
                                  ],
                                  "additionalProperties": false,
                                  "description": "Pass these fields to `GET /traces/payloads` to fetch the part's full raw JSON"
                                }
                              },
                              "required": [
                                "messageId",
                                "partIndex",
                                "role",
                                "kind",
                                "toolName",
                                "text",
                                "truncated",
                                "payloadKey"
                              ],
                              "additionalProperties": false,
                              "description": "One stored message part: `text` is the capped searchable text, and `payloadKey` fetches the full content"
                            },
                            "description": "This call's own message parts; present only when the session is stored in the current trace format"
                          },
                          "turnIndex": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Index into the response's `turns` array; present only when the session is stored in the current trace format"
                          },
                          "inputPreview": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "First 2048 characters of the input (empty string when the call had no input). The full text is available from the session detail endpoint."
                          },
                          "outputPreview": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "First 2048 characters of the output (empty string when the call had no output). The full text is available from the session detail endpoint."
                          },
                          "sessionId": {
                            "type": "string",
                            "description": "Session ID this call belongs to"
                          },
                          "chatId": {
                            "type": "string",
                            "description": "Stable chat (conversation) ID"
                          },
                          "taskId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "ID of the task linked to this chat; null when no task is linked"
                          },
                          "taskTitle": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Title of the linked task; null when no task is linked"
                          },
                          "agentId": {
                            "type": "string",
                            "description": "ID of the agent that made this call"
                          },
                          "agentName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Agent display name"
                          },
                          "userId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "User ID of the agent owner"
                          },
                          "userName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "User display name"
                          },
                          "workspaceName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Workspace display name; null when `workspaceId` is empty or unknown"
                          }
                        },
                        "required": [
                          "traceId",
                          "timestamp",
                          "durationMs",
                          "model",
                          "modelProvider",
                          "inputTokens",
                          "outputTokens",
                          "reasoningTokens",
                          "cacheReadTokens",
                          "cacheWriteTokens",
                          "costUsd",
                          "success",
                          "errorMessage",
                          "workspaceId",
                          "skillsUsed",
                          "inputPreview",
                          "outputPreview",
                          "sessionId",
                          "chatId",
                          "taskId",
                          "taskTitle",
                          "agentId",
                          "agentName",
                          "userId",
                          "userName",
                          "workspaceName"
                        ],
                        "additionalProperties": false,
                        "description": "One model call with its related names and IDs"
                      }
                    },
                    "totalCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Number of matching calls for pagination, counted up to a cap of 10,000"
                    },
                    "totalCountIsCapped": {
                      "type": "boolean",
                      "description": "`true` when more calls matched than the cap; `totalCount` is then the cap, not the exact total"
                    }
                  },
                  "required": [
                    "data",
                    "totalCount",
                    "totalCountIsCapped"
                  ],
                  "additionalProperties": false,
                  "description": "Paginated flat list of calls"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`), or its owner is not a member of the organization. A key limited to specific agents is not refused here: it reads those agents' traces only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Trace data can't be read: this deployment has no trace store configured (code `CLICKHOUSE_UNAVAILABLE`), or the server could not yet tell which store holds this range (`TRACE_READ_SOURCE_UNRESOLVED`, retry). A trace store that fails during the query answers 500 with code `QUERY_FAILED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "traces",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/traces/calls\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode 'from=2026-10-01T00:00:00Z' \\\n  --data-urlencode 'to=2026-10-31T00:00:00Z'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/traces/calls\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"from\": \"2026-10-01T00:00:00Z\", \"to\": \"2026-10-31T00:00:00Z\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/traces/calls`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"from\", \"2026-10-01T00:00:00Z\")\nurl.searchParams.set(\"to\", \"2026-10-31T00:00:00Z\")\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/traces/payloads": {
      "get": {
        "tags": [
          "Traces"
        ],
        "summary": "Get a message part's full content",
        "description": "Looks up the raw JSON of one stored message part by key (complete tool results, every nested field). The session detail endpoint returns the key fields (`chatId`, `messageId`, `partIndex`, `day`) on each part's `payloadKey`; pass them back unchanged. Returns 404 for unknown keys.",
        "operationId": "getTracePartPayload",
        "parameters": [
          {
            "in": "query",
            "name": "chatId",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Stable conversation ID the part belongs to"
            }
          },
          {
            "in": "query",
            "name": "messageId",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "ID of the message (`msg_...`) that owns the part"
            }
          },
          {
            "in": "query",
            "name": "partIndex",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "description": "Position of the part within its source array (an identifier, not a dense sequence)"
            }
          },
          {
            "in": "query",
            "name": "day",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "description": "Date of the trace row that introduced the part (YYYY-MM-DD); narrows the lookup to one day"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "payload": {
                      "type": "string",
                      "description": "Raw part JSON exactly as stored (complete tool results, every nested field)"
                    },
                    "partType": {
                      "type": "string",
                      "description": "Raw part type: `text`, `tool`, `file`, `step-start`, `compaction`, and others"
                    }
                  },
                  "required": [
                    "payload",
                    "partType"
                  ],
                  "additionalProperties": false,
                  "description": "Full payload for one stored message part"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`), or its owner is not a member of the organization. A key limited to specific agents is not refused here: it reads those agents' traces only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Trace data can't be read: this deployment has no trace store configured (code `CLICKHOUSE_UNAVAILABLE`), or the server could not yet tell which store holds this range (`TRACE_READ_SOURCE_UNRESOLVED`, retry). A trace store that fails during the query answers 500 with code `QUERY_FAILED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "traces",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n# chatId, messageId, partIndex and day: a part's payloadKey from GET /traces/sessions/{sessionId}\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/traces/payloads\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode \"chatId=$CHAT_ID\" \\\n  --data-urlencode \"messageId=$MESSAGE_ID\" \\\n  --data-urlencode \"partIndex=$PART_INDEX\" \\\n  --data-urlencode \"day=$DAY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\n# chatId, messageId, partIndex and day: a part's payloadKey from GET /traces/sessions/{sessionId}\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/traces/payloads\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"chatId\": os.environ[\"CHAT_ID\"], \"messageId\": os.environ[\"MESSAGE_ID\"], \"partIndex\": int(os.environ[\"PART_INDEX\"]), \"day\": os.environ[\"DAY\"]},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\n// chatId, messageId, partIndex and day: a part's payloadKey from GET /traces/sessions/{sessionId}\nconst url = new URL(`/api/v1/evals/traces/payloads`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"chatId\", env(\"CHAT_ID\"))\nurl.searchParams.set(\"messageId\", env(\"MESSAGE_ID\"))\nurl.searchParams.set(\"partIndex\", env(\"PART_INDEX\"))\nurl.searchParams.set(\"day\", env(\"DAY\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/traces/histogram": {
      "get": {
        "tags": [
          "Traces"
        ],
        "summary": "Get the session histogram",
        "description": "Counts the sessions matching the filters over time: each bucket holds its sessions and the ones with at least one failure. Buckets are hourly for a range of up to 7 days, daily up to 90 days and weekly beyond that.",
        "operationId": "getTraceHistogram",
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Start of the date range (ISO 8601)"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "End of the date range (ISO 8601)"
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 500,
              "description": "Token search over trace text. Terms match as whole tokens (runs of letters, digits, or non-ASCII characters; punctuation and underscores split terms). Matching ignores ASCII case, and every term must match. A `*` widens a term: `zip*` matches words starting with zip (zip, zipped, zipping), `*ip` matches words ending in `ip`, and `*ognit*` matches any text containing `ognit`. A match covers the whole conversation: every turn of a conversation whose text contains all the terms is returned, not only the turn that introduced them, and the terms may appear in different turns. Terms must occur inside the queried time range. Input with no searchable tokens (punctuation only) returns 400. Some time ranges are served from an older data source that matches terms by substring instead; this response does not say which (`GET /traces/sessions` does, in `readSource`)."
            }
          },
          {
            "in": "query",
            "name": "filters",
            "required": false,
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "field": {
                        "type": "string",
                        "enum": [
                          "success",
                          "cost_usd",
                          "duration_ms",
                          "model",
                          "model_provider",
                          "input_tokens",
                          "output_tokens",
                          "error_message",
                          "agent_id",
                          "user_id",
                          "workspace_id",
                          "chat_id",
                          "skill_id",
                          "origin"
                        ],
                        "description": "Field to filter on"
                      },
                      "operator": {
                        "type": "string",
                        "enum": [
                          "equals",
                          "not_equals",
                          "greater_than",
                          "less_than",
                          "gte",
                          "lte",
                          "contains",
                          "in",
                          "not_in"
                        ],
                        "description": "Comparison operator for a filter condition"
                      },
                      "value": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Filter value as a string, interpreted according to the field's type"
                      }
                    },
                    "required": [
                      "field",
                      "operator",
                      "value"
                    ],
                    "additionalProperties": false,
                    "description": "One filter condition: a field, an operator, and a value"
                  },
                  "maxItems": 20
                }
              }
            },
            "description": "Send it as JSON in one value, for example `filters=[{\"field\":\"success\",\"operator\":\"equals\",\"value\":\"false\"}]`. Any other value is refused with 400."
          },
          {
            "in": "query",
            "name": "matchAll",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "buckets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "bucket": {
                            "type": "string",
                            "description": "Start of the time bucket (ISO 8601)"
                          },
                          "total": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Total sessions in the bucket"
                          },
                          "errors": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Sessions with at least one failure"
                          }
                        },
                        "required": [
                          "bucket",
                          "total",
                          "errors"
                        ],
                        "additionalProperties": false,
                        "description": "One histogram time bucket"
                      }
                    }
                  },
                  "required": [
                    "buckets"
                  ],
                  "additionalProperties": false,
                  "description": "Session counts over time"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`), or its owner is not a member of the organization. A key limited to specific agents is not refused here: it reads those agents' traces only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Trace data can't be read: this deployment has no trace store configured (code `CLICKHOUSE_UNAVAILABLE`), or the server could not yet tell which store holds this range (`TRACE_READ_SOURCE_UNRESOLVED`, retry). A trace store that fails during the query answers 500 with code `QUERY_FAILED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "traces",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/traces/histogram\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode 'from=2026-10-01T00:00:00Z' \\\n  --data-urlencode 'to=2026-10-31T00:00:00Z'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/traces/histogram\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"from\": \"2026-10-01T00:00:00Z\", \"to\": \"2026-10-31T00:00:00Z\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/traces/histogram`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"from\", \"2026-10-01T00:00:00Z\")\nurl.searchParams.set(\"to\", \"2026-10-31T00:00:00Z\")\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/traces/filter-options": {
      "get": {
        "tags": [
          "Traces"
        ],
        "summary": "List trace filter values",
        "description": "Returns the values you can filter traces by, read from the last 90 days of traces you can see: models, providers, agents, users, workspaces and skills. The workspace list is capped, and `workspacesTruncated` says when it is incomplete.",
        "operationId": "getTraceFilterOptions",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Distinct model names from recent traces"
                    },
                    "providers": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Distinct provider names from recent traces"
                    },
                    "agents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false,
                        "description": "Filter option with an ID and display name"
                      },
                      "description": "Agents with trace data"
                    },
                    "users": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false,
                        "description": "Filter option with an ID and display name"
                      },
                      "description": "Users who own agents with trace data"
                    },
                    "workspaces": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false,
                        "description": "Filter option with an ID and display name"
                      },
                      "description": "First page of workspaces that appear in recent traces, with names (capped; see `workspacesTruncated`). Search for workspaces in the app to find the full set."
                    },
                    "workspacesTruncated": {
                      "type": "boolean",
                      "description": "`true` when more workspaces appear in recent traces than this list holds, so the list is incomplete"
                    },
                    "skills": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false,
                        "description": "Filter option with an ID and display name"
                      },
                      "description": "Skills invoked in recent traces, with names"
                    }
                  },
                  "required": [
                    "models",
                    "providers",
                    "agents",
                    "users",
                    "workspaces",
                    "workspacesTruncated",
                    "skills"
                  ],
                  "additionalProperties": false,
                  "description": "Available values for filters"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`), or its owner is not a member of the organization. A key limited to specific agents is not refused here: it reads those agents' traces only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Trace data can't be read: this deployment has no trace store configured (code `CLICKHOUSE_UNAVAILABLE`), or the server could not yet tell which store holds this range (`TRACE_READ_SOURCE_UNRESOLVED`, retry). A trace store that fails during the query answers 500 with code `QUERY_FAILED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "traces",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/traces/filter-options\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/traces/filter-options\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/traces/filter-options`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          },
          {
            "lang": "shell",
            "label": "CLI",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n\n# Find agents by name\ncontext evals filter-options | jq '.agents[] | select(.name | contains(\"marketing\"))'\n\n# Snapshot every agent's monthly profile to its own file\ncontext evals filter-options | jq -r '.agents[].id' | xargs -I {} context evals agent {} --from 30d --out runs/agent-{}.json"
          }
        ]
      }
    },
    "/traces/agents/{agentId}/profile": {
      "get": {
        "tags": [
          "Traces"
        ],
        "summary": "Get an agent's usage profile",
        "description": "Returns one agent's usage from `since` to `until` (now by default): its sessions, cost, duration and tokens, the models it used and its cost per day. An agent with no traces in the range, or one you can't read, returns a profile of zeros.",
        "operationId": "getAgentProfile",
        "parameters": [
          {
            "in": "path",
            "name": "agentId",
            "required": true,
            "description": "Agent ID",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Agent ID"
            }
          },
          {
            "in": "query",
            "name": "since",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "totalSessions": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Total number of sessions"
                    },
                    "totalCost": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total cost in USD"
                    },
                    "totalDurationMs": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total duration in milliseconds"
                    },
                    "avgSessionDurationMs": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Average session duration in milliseconds"
                    },
                    "avgCostPerSession": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Average cost per session in USD"
                    },
                    "totalTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Billed tokens (input, output, reasoning, cache write, and cache read)"
                    },
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Distinct models used"
                    },
                    "dailyCost": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string",
                            "description": "Date (YYYY-MM-DD)"
                          },
                          "cost": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Total cost in USD for this day"
                          },
                          "tokens": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Billed tokens for this day"
                          }
                        },
                        "required": [
                          "date",
                          "cost"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Daily cost breakdown, oldest date first"
                    },
                    "modelBreakdown": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "model": {
                            "type": "string",
                            "description": "Model ID"
                          },
                          "totalCost": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Total cost in USD for this model"
                          },
                          "totalTokens": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Billed tokens for this model"
                          }
                        },
                        "required": [
                          "model",
                          "totalCost",
                          "totalTokens"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Per-model cost and token usage"
                    }
                  },
                  "required": [
                    "totalSessions",
                    "totalCost",
                    "totalDurationMs",
                    "avgSessionDurationMs",
                    "avgCostPerSession",
                    "totalTokens",
                    "models",
                    "dailyCost"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`), or its owner is not a member of the organization. A key limited to specific agents is not refused here: it reads those agents' traces only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Trace data can't be read: this deployment has no trace store configured (code `CLICKHOUSE_UNAVAILABLE`), or the server could not yet tell which store holds this range (`TRACE_READ_SOURCE_UNRESOLVED`, retry). A trace store that fails during the query answers 500 with code `QUERY_FAILED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "traces",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/traces/agents/$AGENT_ID/profile\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode 'since=2026-10-01T00:00:00Z'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nagent_id = os.environ[\"AGENT_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/traces/agents/{agent_id}/profile\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"since\": \"2026-10-01T00:00:00Z\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/traces/agents/${encodeURIComponent(env(\"AGENT_ID\"))}/profile`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"since\", \"2026-10-01T00:00:00Z\")\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          },
          {
            "lang": "shell",
            "label": "CLI",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n\n# Last-30-day cost / token / daily-cost profile for one agent\ncontext evals agent $AGENT_ID --from 30d"
          }
        ]
      }
    },
    "/traces/users/{userId}/profile": {
      "get": {
        "tags": [
          "Traces"
        ],
        "summary": "Get a user's usage profile",
        "description": "Returns one person's usage from `since` to `until` (now by default): their sessions, cost, duration and tokens, the models and agents they used and their cost per day. Work an evaluation started, such as runs, judges and monitors, is not counted.",
        "operationId": "getUserProfile",
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "description": "User ID",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "User ID"
            }
          },
          {
            "in": "query",
            "name": "since",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "totalSessions": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Total number of sessions"
                    },
                    "totalCost": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total cost in USD"
                    },
                    "totalDurationMs": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total duration in milliseconds"
                    },
                    "avgSessionDurationMs": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Average session duration in milliseconds"
                    },
                    "avgCostPerSession": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Average cost per session in USD"
                    },
                    "totalTokens": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Billed tokens (input, output, reasoning, cache write, and cache read)"
                    },
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Distinct models used"
                    },
                    "dailyCost": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string",
                            "description": "Date (YYYY-MM-DD)"
                          },
                          "cost": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Total cost in USD for this day"
                          },
                          "tokens": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Billed tokens for this day"
                          }
                        },
                        "required": [
                          "date",
                          "cost"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Daily cost breakdown, oldest date first"
                    },
                    "modelBreakdown": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "model": {
                            "type": "string",
                            "description": "Model ID"
                          },
                          "totalCost": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Total cost in USD for this model"
                          },
                          "totalTokens": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Billed tokens for this model"
                          }
                        },
                        "required": [
                          "model",
                          "totalCost",
                          "totalTokens"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Per-model cost and token usage"
                    },
                    "agentBreakdown": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "agentId": {
                            "type": "string",
                            "description": "Agent ID"
                          },
                          "agentName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Agent display name"
                          },
                          "sessionCount": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Number of sessions for this agent"
                          },
                          "totalCost": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Total cost in USD for this agent"
                          },
                          "totalTokens": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Billed tokens used by this agent"
                          }
                        },
                        "required": [
                          "agentId",
                          "agentName",
                          "sessionCount",
                          "totalCost",
                          "totalTokens"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Per-agent usage breakdown"
                    }
                  },
                  "required": [
                    "totalSessions",
                    "totalCost",
                    "totalDurationMs",
                    "avgSessionDurationMs",
                    "avgCostPerSession",
                    "totalTokens",
                    "models",
                    "dailyCost",
                    "agentBreakdown"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`), or its owner is not a member of the organization. A key limited to specific agents is not refused here: it reads those agents' traces only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Trace data can't be read: this deployment has no trace store configured (code `CLICKHOUSE_UNAVAILABLE`), or the server could not yet tell which store holds this range (`TRACE_READ_SOURCE_UNRESOLVED`, retry). A trace store that fails during the query answers 500 with code `QUERY_FAILED`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "traces",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/traces/users/$USER_ID/profile\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode 'since=2026-10-01T00:00:00Z'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nuser_id = os.environ[\"USER_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/traces/users/{user_id}/profile\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"since\": \"2026-10-01T00:00:00Z\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/traces/users/${encodeURIComponent(env(\"USER_ID\"))}/profile`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"since\", \"2026-10-01T00:00:00Z\")\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          },
          {
            "lang": "shell",
            "label": "CLI",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n\n# Last-7-day profile for one user, including per-agent breakdown\ncontext evals user $USER_ID --from 7d"
          }
        ]
      }
    },
    "/traces/cost-dashboard": {
      "get": {
        "tags": [
          "Traces"
        ],
        "summary": "Get the cost dashboard",
        "description": "Returns the organization's cost from `since` to `until` (now by default): a row per agent with its trend against the previous period of the same length, organization totals, cost per day, media and image generation cost, and cost per skill. It needs organization-wide trace access.",
        "operationId": "getOrgCostDashboard",
        "parameters": [
          {
            "in": "query",
            "name": "since",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Start date (ISO 8601)"
            }
          },
          {
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "End date (ISO 8601); defaults to now"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "agentId": {
                            "type": "string",
                            "description": "Agent ID"
                          },
                          "agentName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Agent display name"
                          },
                          "workspaceName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Workspace (team) name"
                          },
                          "totalSessions": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Total sessions in the period"
                          },
                          "totalCost": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Total cost in USD"
                          },
                          "avgCostPerSession": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Average cost per session in USD"
                          },
                          "avgDurationMs": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Average session duration in milliseconds"
                          },
                          "totalTokens": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Billed tokens (input, output, reasoning, cache write, and cache read)"
                          },
                          "trend": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Percent change from the previous period of the same length; null when there is no previous data"
                          }
                        },
                        "required": [
                          "agentId",
                          "agentName",
                          "workspaceName",
                          "totalSessions",
                          "totalCost",
                          "avgCostPerSession",
                          "avgDurationMs",
                          "totalTokens",
                          "trend"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Per-agent cost rows, highest `totalCost` first (includes media generation cost)"
                    },
                    "orgTotalCost": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Organization-wide total cost in USD for the period, including media and image generation"
                    },
                    "orgTotalSessions": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Organization-wide total sessions for the period"
                    },
                    "orgAvgCostPerSession": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Organization-wide average cost per session in USD"
                    },
                    "orgTotalDurationMs": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Organization-wide total session duration in milliseconds"
                    },
                    "dailyCost": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string",
                            "description": "Date (YYYY-MM-DD)"
                          },
                          "cost": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Total cost in USD for this day"
                          },
                          "tokens": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Billed tokens for this day"
                          }
                        },
                        "required": [
                          "date",
                          "cost"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Daily cost breakdown, oldest date first (includes media generation cost)"
                    },
                    "mediaGeneration": {
                      "type": "object",
                      "properties": {
                        "totalCost": {
                          "type": "number",
                          "minimum": 0,
                          "description": "Total billed media and image generation cost in USD for the period"
                        },
                        "generationCount": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "Total billed media and image generations in the period"
                        },
                        "byModel": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "modelId": {
                                "type": "string",
                                "description": "Provider model or endpoint ID (for example, a fal endpoint or gpt-image model); `unknown` when none was recorded"
                              },
                              "totalCost": {
                                "type": "number",
                                "minimum": 0,
                                "description": "Billed cost in USD for this model in the period"
                              },
                              "generationCount": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Number of billed generations for this model"
                              }
                            },
                            "required": [
                              "modelId",
                              "totalCost",
                              "generationCount"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Per-model breakdown, highest `totalCost` first"
                        }
                      },
                      "required": [
                        "totalCost",
                        "generationCount",
                        "byModel"
                      ],
                      "additionalProperties": false,
                      "description": "Media and image generation share of the period's spend"
                    },
                    "skills": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "skillId": {
                            "type": "string",
                            "description": "Skill ID as recorded when the call was traced"
                          },
                          "skillName": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Skill display name; null when the skill no longer exists"
                          },
                          "uses": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Model steps in the period whose output invoked the skill"
                          },
                          "sessions": {
                            "type": "integer",
                            "minimum": 0,
                            "description": "Distinct sessions in which the skill was invoked"
                          },
                          "totalCost": {
                            "type": "number",
                            "minimum": 0,
                            "description": "Estimated provider cost in USD summed over the steps that invoked the skill, not billed credits"
                          },
                          "avgCostPerUse": {
                            "type": "number",
                            "minimum": 0,
                            "description": "`totalCost` divided by `uses`"
                          }
                        },
                        "required": [
                          "skillId",
                          "skillName",
                          "uses",
                          "sessions",
                          "totalCost",
                          "avgCostPerUse"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Per-skill cost for the current period, highest `totalCost` first. Estimated provider cost only. Empty when the period's costs come from billing records, which do not track skills."
                    }
                  },
                  "required": [
                    "agents",
                    "orgTotalCost",
                    "orgTotalSessions",
                    "orgAvgCostPerSession",
                    "orgTotalDurationMs",
                    "dailyCost",
                    "mediaGeneration",
                    "skills"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner does not read traces org-wide (an organization admin does; a workspace admin and a member do not, as in the app); or the key is limited to specific agents. Only the first carries a `code`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-access": "tracesOrgWide",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/traces/cost-dashboard\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode 'since=2026-10-01T00:00:00Z'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/traces/cost-dashboard\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"since\": \"2026-10-01T00:00:00Z\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/traces/cost-dashboard`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"since\", \"2026-10-01T00:00:00Z\")\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/datasets/{datasetId}/version": {
      "get": {
        "tags": [
          "Datasets"
        ],
        "summary": "Get a dataset's saved-version state",
        "description": "The dataset with its version state: the head version, whether its working copy has unsaved changes, and the `workingCopyHash` a save names. Read it right before `POST /datasets/{datasetId}/versions`.",
        "operationId": "getDatasetVersionState",
        "parameters": [
          {
            "in": "path",
            "name": "datasetId",
            "required": true,
            "description": "Dataset identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Dataset (from the path)"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Unique dataset identifier"
                    },
                    "orgId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Organization that owns this dataset"
                    },
                    "workspaceId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "The workspace this dataset belongs to; null means organization-wide, shown in every workspace"
                    },
                    "createdById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "User who created this dataset"
                    },
                    "ownerUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "The person who owns this dataset; null for datasets made before owners were recorded (organization-wide, and changeable by an organization admin)"
                    },
                    "visibility": {
                      "type": "string",
                      "enum": [
                        "org",
                        "workspace",
                        "personal"
                      ],
                      "description": "Where this dataset is placed: organization-wide, shared into its workspace, or private to its owner"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "Dataset display name"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 2000,
                      "description": "Optional dataset description"
                    },
                    "isPublic": {
                      "type": "boolean",
                      "description": "Whether this dataset is publicly shared"
                    },
                    "source": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Where the dataset came from (for example, `huggingface:openai/gsm8k`). Null for datasets created by hand."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Creation timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Last update timestamp"
                    },
                    "createdByName": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Display name of the user who created this dataset, or null if createdById is null or the user row could not be resolved (resolver logs a warn in the missing-row case)"
                    },
                    "version": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "clean"
                              ]
                            },
                            "head": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "Immutable version row id"
                                },
                                "datasetId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "Dataset this version was saved from"
                                },
                                "version": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "description": "Version number: 1 for the first, one more for each save"
                                },
                                "taskCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Tasks frozen in this version"
                                },
                                "heldOutCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Validation tasks frozen in this version (stored as held out): graded like every task, never learned from, and scored a second time on their own. The rest, `taskCount` minus this, are Train. Counted from the frozen tasks on every read, never stored."
                                },
                                "createdById": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "description": "Who saved it; null for the v1 every dataset received when versions were introduced"
                                },
                                "createdAt": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "When it was saved"
                                }
                              },
                              "required": [
                                "id",
                                "datasetId",
                                "version",
                                "taskCount",
                                "heldOutCount",
                                "createdById",
                                "createdAt"
                              ],
                              "additionalProperties": false,
                              "description": "One saved, immutable version of a dataset"
                            }
                          },
                          "required": [
                            "state",
                            "head"
                          ],
                          "additionalProperties": false,
                          "description": "The working copy equals the head version"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "edited"
                              ]
                            },
                            "head": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "Immutable version row id"
                                },
                                "datasetId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "Dataset this version was saved from"
                                },
                                "version": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "description": "Version number: 1 for the first, one more for each save"
                                },
                                "taskCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Tasks frozen in this version"
                                },
                                "heldOutCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Validation tasks frozen in this version (stored as held out): graded like every task, never learned from, and scored a second time on their own. The rest, `taskCount` minus this, are Train. Counted from the frozen tasks on every read, never stored."
                                },
                                "createdById": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "description": "Who saved it; null for the v1 every dataset received when versions were introduced"
                                },
                                "createdAt": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "When it was saved"
                                }
                              },
                              "required": [
                                "id",
                                "datasetId",
                                "version",
                                "taskCount",
                                "heldOutCount",
                                "createdById",
                                "createdAt"
                              ],
                              "additionalProperties": false,
                              "description": "One saved, immutable version of a dataset"
                            },
                            "workingCopyHash": {
                              "type": "string",
                              "minLength": 1,
                              "description": "Identity of the working copy as read; Save and Discard send it back so nobody publishes or throws away edits they have not seen"
                            },
                            "changes": {
                              "type": "object",
                              "properties": {
                                "added": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Tasks in the working copy that the head does not have"
                                },
                                "removed": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Tasks in the head that the working copy no longer has"
                                },
                                "modified": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "Tasks in both whose content differs"
                                },
                                "reordered": {
                                  "type": "boolean",
                                  "description": "Whether tasks present in both appear in a different order"
                                },
                                "criteria": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "description": "The dataset's own criteria added, removed or changed since the head, matched by id; their order alone is not a change"
                                }
                              },
                              "required": [
                                "added",
                                "removed",
                                "modified",
                                "reordered",
                                "criteria"
                              ],
                              "additionalProperties": false,
                              "description": "How the working copy differs from the head version"
                            }
                          },
                          "required": [
                            "state",
                            "head",
                            "workingCopyHash",
                            "changes"
                          ],
                          "additionalProperties": false,
                          "description": "The working copy has edits that no version holds yet; runs grade the head without them"
                        }
                      ],
                      "description": "A dataset's head version and whether its working copy differs from it. Worked out on every read, never stored. Every dataset has a head (v1 at least)."
                    },
                    "workflows": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "listed"
                              ]
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "topicId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "Workflow identifier"
                                  },
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "description": "Workflow display name"
                                  }
                                },
                                "required": [
                                  "topicId",
                                  "name"
                                ],
                                "additionalProperties": false,
                                "description": "A workflow one of the dataset's Evaluations is attached to"
                              },
                              "description": "Every non-archived workflow an Evaluation linking this dataset is attached to, once each, by name; empty when none is"
                            }
                          },
                          "required": [
                            "state",
                            "items"
                          ],
                          "additionalProperties": false,
                          "description": "The caller may read workflow names in this organization"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "enum": [
                                "unavailable"
                              ]
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "workflows-off",
                                "no-organization"
                              ],
                              "description": "workflows-off: workflows are not enabled for this organization, so their names are not read. no-organization: the dataset belongs to no organization, and workflows are read within one"
                            }
                          },
                          "required": [
                            "state",
                            "reason"
                          ],
                          "additionalProperties": false,
                          "description": "Workflow names are withheld; a client tells this apart from a dataset that reaches none"
                        }
                      ],
                      "description": "The workflows a dataset reaches through the Evaluations that link it, or why they are not shown"
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "workspaceId",
                    "createdById",
                    "ownerUserId",
                    "visibility",
                    "name",
                    "description",
                    "isPublic",
                    "source",
                    "createdAt",
                    "updatedAt",
                    "createdByName",
                    "version",
                    "workflows"
                  ],
                  "additionalProperties": false,
                  "description": "Dataset detail with the creator's display name, its saved-version state and the workflows it reaches embedded"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or the key is limited to specific agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:read",
        "x-runs-procedure": "benchmark.getDataset",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/datasets/$DATASET_ID/version\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\ndataset_id = os.environ[\"DATASET_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/datasets/{dataset_id}/version\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/datasets/${encodeURIComponent(env(\"DATASET_ID\"))}/version`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/datasets/{datasetId}/versions": {
      "post": {
        "tags": [
          "Datasets"
        ],
        "summary": "Save a dataset version",
        "description": "Saves the working copy as the next version. Name the head version and `workingCopyHash` you read (`GET /datasets/{datasetId}/version`): another save in between is refused 409 (`head_moved`, `working_copy_changed`), and a working copy with no changes 400 (`nothing_to_save`).",
        "operationId": "saveDatasetVersion",
        "parameters": [
          {
            "in": "path",
            "name": "datasetId",
            "required": true,
            "description": "Dataset identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Dataset to act on"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "baseVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "description": "The head version the caller saw; refused with head_moved when another save landed first"
                  },
                  "workingCopyHash": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The workingCopyHash the caller saw; refused with working_copy_changed when the tasks or the dataset's criteria changed since"
                  }
                },
                "required": [
                  "baseVersion",
                  "workingCopyHash"
                ],
                "additionalProperties": false,
                "description": "Save the working copy as the next version (head + 1)"
              },
              "example": {
                "baseVersion": 1,
                "workingCopyHash": "<from GET /datasets/{datasetId}/version>"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Immutable version row id"
                    },
                    "datasetId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Dataset this version was saved from"
                    },
                    "version": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "description": "Version number: 1 for the first, one more for each save"
                    },
                    "taskCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Tasks frozen in this version"
                    },
                    "heldOutCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Validation tasks frozen in this version (stored as held out): graded like every task, never learned from, and scored a second time on their own. The rest, `taskCount` minus this, are Train. Counted from the frozen tasks on every read, never stored."
                    },
                    "createdById": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "description": "Who saved it; null for the v1 every dataset received when versions were introduced"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When it was saved"
                    }
                  },
                  "required": [
                    "id",
                    "datasetId",
                    "version",
                    "taskCount",
                    "heldOutCount",
                    "createdById",
                    "createdAt"
                  ],
                  "additionalProperties": false,
                  "description": "One saved, immutable version of a dataset"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "benchmark.saveDatasetVersion",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body -X POST \"$CONTEXT_APP_ORIGIN/api/v1/evals/datasets/$DATASET_ID/versions\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary @- <<'JSON'\n{\n  \"baseVersion\": 1,\n  \"workingCopyHash\": \"<from GET /datasets/{datasetId}/version>\"\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\ndataset_id = os.environ[\"DATASET_ID\"]\n\nresp = requests.post(\n    f\"{origin}/api/v1/evals/datasets/{dataset_id}/versions\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    json={\n        \"baseVersion\": 1,\n        \"workingCopyHash\": \"<from GET /datasets/{datasetId}/version>\"\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/datasets/${encodeURIComponent(env(\"DATASET_ID\"))}/versions`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"baseVersion\": 1,\n  \"workingCopyHash\": \"<from GET /datasets/{datasetId}/version>\"\n}\nconst res = await fetch(url, {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/datasets/{datasetId}/criteria": {
      "put": {
        "tags": [
          "Criteria"
        ],
        "summary": "Replace a dataset's criteria",
        "description": "The dataset's own criteria, replaced whole: each grades every task in the dataset. They land in the working copy, like a task edit.",
        "operationId": "saveDatasetCriteria",
        "parameters": [
          {
            "in": "path",
            "name": "datasetId",
            "required": true,
            "description": "Dataset identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Dataset (from the path)"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "definitions": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128,
                              "description": "Stable identifier within the owning dataset or dataset task"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200,
                              "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                            },
                            "weight": {
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100000,
                              "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                            },
                            "instructions": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100000,
                              "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                            },
                            "outputType": {
                              "type": "string",
                              "enum": [
                                "boolean",
                                "float",
                                "text"
                              ],
                              "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                            },
                            "modelOverride": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "minLength": 1,
                              "description": "Null means use the judge model of the Evaluation that runs it"
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "llm_judge"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "weight",
                            "instructions",
                            "outputType",
                            "modelOverride",
                            "kind"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128,
                              "description": "Stable identifier within the owning dataset or dataset task"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200,
                              "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                            },
                            "weight": {
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100000,
                              "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                            },
                            "instructions": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100000,
                              "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                            },
                            "outputType": {
                              "type": "string",
                              "enum": [
                                "boolean",
                                "float",
                                "text"
                              ],
                              "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                            },
                            "modelOverride": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "minLength": 1,
                              "description": "Null means use the judge model of the Evaluation that runs it"
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "agent_judge"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "weight",
                            "instructions",
                            "outputType",
                            "modelOverride",
                            "kind"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128,
                              "description": "Stable identifier within the owning dataset or dataset task"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200,
                              "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                            },
                            "weight": {
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100000,
                              "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "exact_match"
                              ]
                            },
                            "comparison": {
                              "type": "string",
                              "enum": [
                                "text_identical",
                                "contains",
                                "not_contains",
                                "tool_called"
                              ],
                              "description": "text_identical: the output equals the expected text exactly, including case, whitespace and Unicode code points. contains / not_contains: the output holds `value` anywhere, or nowhere. tool_called: the agent called the tool named `value`"
                            },
                            "value": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000,
                              "description": "The text contains / not_contains look for, or the tool name tool_called looks for; text_identical takes none"
                            },
                            "ignoreCase": {
                              "type": "boolean",
                              "description": "contains / not_contains only: compare without regard to upper and lower case"
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "weight",
                            "kind",
                            "comparison"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128,
                              "description": "Stable identifier within the owning dataset or dataset task"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200,
                              "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                            },
                            "weight": {
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100000,
                              "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "code_verifier"
                              ]
                            },
                            "contractVersion": {
                              "type": "number",
                              "enum": [
                                1
                              ]
                            },
                            "code": {
                              "type": "string",
                              "minLength": 1,
                              "description": "Python defining verify(task, output) and returning a Verdict; the SDK and a working example: `context-cli evals describe verifier-sdk`. It imports the standard library, the context_verifiers SDK and the curated packages (`context-cli evals describe verifier-packages`); a save naming anything else is refused, as the runner refuses it. A criterion holds at most 512 KiB of code, and one dataset's or one task's Python criteria 4 MiB together."
                            },
                            "passMark": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1,
                              "description": "Present: a float verdict passes at or above this 0..1 mark (Monitoring's Python criteria). Absent: a float verdict counts as its raw score"
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "weight",
                            "kind",
                            "contractVersion",
                            "code"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128,
                              "description": "Stable identifier within the owning dataset or dataset task"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200,
                              "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                            },
                            "weight": {
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100000,
                              "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "rule"
                              ]
                            },
                            "rule": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "operator": {
                                      "type": "string",
                                      "enum": [
                                        "contains",
                                        "not_contains",
                                        "starts_with",
                                        "ends_with",
                                        "equals"
                                      ],
                                      "description": "contains / does not contain anywhere; starts with, ends with and is exactly ignore spaces and line breaks around the text"
                                    },
                                    "target": {
                                      "type": "string",
                                      "enum": [
                                        "answer",
                                        "user_message"
                                      ],
                                      "description": "The text the rule reads: the request's final answer, or the person's message"
                                    },
                                    "value": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    },
                                    "ignoreCase": {
                                      "type": "boolean",
                                      "description": "Compare without regard to upper and lower case"
                                    }
                                  },
                                  "required": [
                                    "operator",
                                    "target",
                                    "value",
                                    "ignoreCase"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "operator": {
                                      "type": "string",
                                      "enum": [
                                        "matches",
                                        "not_matches"
                                      ]
                                    },
                                    "target": {
                                      "type": "string",
                                      "enum": [
                                        "answer",
                                        "user_message"
                                      ],
                                      "description": "The text the rule reads: the request's final answer, or the person's message"
                                    },
                                    "pattern": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 500,
                                      "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                    },
                                    "ignoreCase": {
                                      "type": "boolean",
                                      "description": "Compare without regard to upper and lower case"
                                    }
                                  },
                                  "required": [
                                    "operator",
                                    "target",
                                    "pattern",
                                    "ignoreCase"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "operator": {
                                      "type": "string",
                                      "enum": [
                                        "length_between"
                                      ]
                                    },
                                    "target": {
                                      "type": "string",
                                      "enum": [
                                        "answer",
                                        "user_message"
                                      ],
                                      "description": "The text the rule reads: the request's final answer, or the person's message"
                                    },
                                    "min": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 100000000,
                                      "description": "Fewest characters that pass"
                                    },
                                    "max": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 100000000,
                                      "description": "Most characters that pass"
                                    }
                                  },
                                  "required": [
                                    "operator",
                                    "target",
                                    "min",
                                    "max"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "operator": {
                                      "type": "string",
                                      "enum": [
                                        "valid_json"
                                      ]
                                    },
                                    "target": {
                                      "type": "string",
                                      "enum": [
                                        "answer",
                                        "user_message"
                                      ],
                                      "description": "The text the rule reads: the request's final answer, or the person's message"
                                    }
                                  },
                                  "required": [
                                    "operator",
                                    "target"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The whole text parses as JSON"
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "operator": {
                                      "type": "string",
                                      "enum": [
                                        "matches_json_schema"
                                      ]
                                    },
                                    "target": {
                                      "type": "string",
                                      "enum": [
                                        "answer",
                                        "user_message"
                                      ],
                                      "description": "The text the rule reads: the request's final answer, or the person's message"
                                    },
                                    "schema": {
                                      "type": "object",
                                      "additionalProperties": {},
                                      "description": "A JSON Schema (draft 7 keywords) the text, parsed as JSON, must satisfy; unknown keywords, formats and references ($ref) are refused at save"
                                    }
                                  },
                                  "required": [
                                    "operator",
                                    "target",
                                    "schema"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "operator": {
                                      "type": "string",
                                      "enum": [
                                        "tool_called",
                                        "tool_not_called"
                                      ]
                                    },
                                    "tool": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "description": "The tool's name as the agent calls it, for example web_search"
                                    }
                                  },
                                  "required": [
                                    "operator",
                                    "tool"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "operator": {
                                      "type": "string",
                                      "enum": [
                                        "tool_argument_matches"
                                      ]
                                    },
                                    "tool": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "description": "The tool's name as the agent calls it, for example web_search"
                                    },
                                    "argument": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "description": "The argument's name, for example query"
                                    },
                                    "pattern": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 500,
                                      "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                    },
                                    "ignoreCase": {
                                      "type": "boolean",
                                      "description": "Compare without regard to upper and lower case"
                                    }
                                  },
                                  "required": [
                                    "operator",
                                    "tool",
                                    "argument",
                                    "pattern",
                                    "ignoreCase"
                                  ],
                                  "additionalProperties": false,
                                  "description": "Some call of the tool had this argument matching the pattern"
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "operator": {
                                      "type": "string",
                                      "enum": [
                                        "tool_call_count"
                                      ]
                                    },
                                    "tool": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200,
                                      "description": "The tool's name as the agent calls it, for example web_search"
                                    },
                                    "min": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 100000,
                                      "description": "Fewest calls that pass"
                                    },
                                    "max": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 100000,
                                      "description": "Most calls that pass"
                                    }
                                  },
                                  "required": [
                                    "operator",
                                    "tool",
                                    "min",
                                    "max"
                                  ],
                                  "additionalProperties": false
                                }
                              ],
                              "description": "A Monitoring rule, verbatim: every operator and target it has, decided by the rule grader (../monitor/rule-grade)"
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "weight",
                            "kind",
                            "rule"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "description": "A bespoke verifier owned by a dataset or one dataset task; not a shared library reference"
                    }
                  },
                  "removeFromTasks": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": "Criterion names to strip from every task's own set in the same write (case and surrounding spaces ignored). Empty for a plain save. Naming a criterion the saved set holds makes it the dataset's (apply to all); naming one it does not hold removes it from every task (remove from all). A set naming a criterion twice, or one its tasks would still carry after the strip, is refused (criterion_name_taken)"
                  }
                },
                "required": [
                  "definitions",
                  "removeFromTasks"
                ],
                "additionalProperties": false
              },
              "example": {
                "definitions": [
                  {
                    "kind": "llm_judge",
                    "id": "correct-window",
                    "name": "Gives the 30-day refund window",
                    "weight": 1,
                    "instructions": "Pass when {{output}} gives the 30-day refund window.",
                    "outputType": "boolean",
                    "modelOverride": null
                  },
                  {
                    "kind": "exact_match",
                    "id": "names-policy",
                    "name": "Names the refund policy",
                    "weight": 1,
                    "comparison": "contains",
                    "value": "refund policy",
                    "ignoreCase": true
                  }
                ],
                "removeFromTasks": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "saved": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "saved"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "verifier.saveDefinitions",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body -X PUT \"$CONTEXT_APP_ORIGIN/api/v1/evals/datasets/$DATASET_ID/criteria\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary @- <<'JSON'\n{\n  \"definitions\": [\n    {\n      \"kind\": \"llm_judge\",\n      \"id\": \"correct-window\",\n      \"name\": \"Gives the 30-day refund window\",\n      \"weight\": 1,\n      \"instructions\": \"Pass when {{output}} gives the 30-day refund window.\",\n      \"outputType\": \"boolean\",\n      \"modelOverride\": null\n    },\n    {\n      \"kind\": \"exact_match\",\n      \"id\": \"names-policy\",\n      \"name\": \"Names the refund policy\",\n      \"weight\": 1,\n      \"comparison\": \"contains\",\n      \"value\": \"refund policy\",\n      \"ignoreCase\": true\n    }\n  ],\n  \"removeFromTasks\": []\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\ndataset_id = os.environ[\"DATASET_ID\"]\n\nresp = requests.put(\n    f\"{origin}/api/v1/evals/datasets/{dataset_id}/criteria\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    json={\n        \"definitions\": [\n            {\n                \"kind\": \"llm_judge\",\n                \"id\": \"correct-window\",\n                \"name\": \"Gives the 30-day refund window\",\n                \"weight\": 1,\n                \"instructions\": \"Pass when {{output}} gives the 30-day refund window.\",\n                \"outputType\": \"boolean\",\n                \"modelOverride\": None\n            },\n            {\n                \"kind\": \"exact_match\",\n                \"id\": \"names-policy\",\n                \"name\": \"Names the refund policy\",\n                \"weight\": 1,\n                \"comparison\": \"contains\",\n                \"value\": \"refund policy\",\n                \"ignoreCase\": True\n            }\n        ],\n        \"removeFromTasks\": []\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/datasets/${encodeURIComponent(env(\"DATASET_ID\"))}/criteria`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"definitions\": [\n    {\n      \"kind\": \"llm_judge\",\n      \"id\": \"correct-window\",\n      \"name\": \"Gives the 30-day refund window\",\n      \"weight\": 1,\n      \"instructions\": \"Pass when {{output}} gives the 30-day refund window.\",\n      \"outputType\": \"boolean\",\n      \"modelOverride\": null\n    },\n    {\n      \"kind\": \"exact_match\",\n      \"id\": \"names-policy\",\n      \"name\": \"Names the refund policy\",\n      \"weight\": 1,\n      \"comparison\": \"contains\",\n      \"value\": \"refund policy\",\n      \"ignoreCase\": true\n    }\n  ],\n  \"removeFromTasks\": []\n}\nconst res = await fetch(url, {\n  method: \"PUT\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/benchmarks/{evaluationId}/targets": {
      "post": {
        "tags": [
          "Evaluations"
        ],
        "summary": "List an Evaluation on an agent, skill or workflow",
        "description": "Shows the Evaluation on that agent's, skill's or workflow's page; it does not change what a run executes. An agent or skill must be one the Evaluation's axes name; a workflow must be active (`GET /targets/workflows`), and listing on one needs the Workflows curation the app asks for.",
        "operationId": "attachBenchmarkTarget",
        "parameters": [
          {
            "in": "path",
            "name": "evaluationId",
            "required": true,
            "description": "Evaluation identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Evaluation (from the path)"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "target": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "traces"
                            ]
                          },
                          "targetId": {
                            "type": "null"
                          }
                        },
                        "required": [
                          "kind",
                          "targetId"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "skill",
                              "agent",
                              "applet",
                              "workflow"
                            ],
                            "description": "traces: every trace in the organization; skill, agent, applet: turns that used it; workflow: turns its classification files there"
                          },
                          "targetId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          }
                        },
                        "required": [
                          "kind",
                          "targetId"
                        ],
                        "additionalProperties": false
                      }
                    ],
                    "description": "agent or skill: one the Evaluation's axes name (tested or held); workflow: an active workflow. applet and traces are refused: a dataset run executes neither"
                  }
                },
                "required": [
                  "target"
                ],
                "additionalProperties": false,
                "description": "One target of an Offline evaluation"
              },
              "example": {
                "target": {
                  "kind": "workflow",
                  "targetId": "<workflow id>"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "benchmarkId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The Evaluation (benchmark)"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "agent",
                        "skill",
                        "workflow"
                      ],
                      "description": "What the Evaluation is listed on"
                    },
                    "targetId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The agent, skill or workflow (eval_topic) id"
                    },
                    "createdById": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Who attached it; 'system' for a row moved in without a curator"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When it was attached"
                    }
                  },
                  "required": [
                    "benchmarkId",
                    "kind",
                    "targetId",
                    "createdById",
                    "createdAt"
                  ],
                  "additionalProperties": false,
                  "description": "An Offline evaluation's target: the Evaluation is listed on that agent's, skill's or workflow's page. It does not change what a run executes"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "benchmark.attachTarget",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body -X POST \"$CONTEXT_APP_ORIGIN/api/v1/evals/benchmarks/$EVALUATION_ID/targets\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary @- <<'JSON'\n{\n  \"target\": {\n    \"kind\": \"workflow\",\n    \"targetId\": \"<workflow id>\"\n  }\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nevaluation_id = os.environ[\"EVALUATION_ID\"]\n\nresp = requests.post(\n    f\"{origin}/api/v1/evals/benchmarks/{evaluation_id}/targets\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    json={\n        \"target\": {\n            \"kind\": \"workflow\",\n            \"targetId\": \"<workflow id>\"\n        }\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/benchmarks/${encodeURIComponent(env(\"EVALUATION_ID\"))}/targets`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"target\": {\n    \"kind\": \"workflow\",\n    \"targetId\": \"<workflow id>\"\n  }\n}\nconst res = await fetch(url, {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/criteria/code/{criterionId}": {
      "put": {
        "tags": [
          "Criteria"
        ],
        "summary": "Save a Python check",
        "description": "Creates or replaces a shared Python check under an id you choose (a UUID). The code must compile and define `verify`; monitors using it grade with the new code from their next request.",
        "operationId": "saveCodeCriterion",
        "parameters": [
          {
            "in": "path",
            "name": "criterionId",
            "required": true,
            "description": "Criterion identifier, a UUID the caller chooses; saving the same id again replaces it",
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Criterion (from the path)"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "The criterion's label wherever criteria are listed"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000,
                    "description": "The line a monitor's verifier list shows under the name; null clears it, absent keeps the saved one"
                  },
                  "code": {
                    "type": "string",
                    "description": "Python 3.13 source defining verify(evidence) that returns Verdict.boolean(passed=…, reasoning=…) or Verdict.float(score=0..1, reasoning=…) from context_verifiers; standard library only besides that"
                  },
                  "passMark": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "description": "The 0..1 score at or above which a Verdict.float passes; a Verdict.boolean ignores it. Shown as a percentage"
                  }
                },
                "required": [
                  "name",
                  "code",
                  "passMark"
                ],
                "additionalProperties": false,
                "description": "Create or replace a shared Python criterion. The code must compile and define verify; monitors using it grade with the new code and pass mark from their next admission"
              },
              "example": {
                "name": "rest-writes mentions 30 days",
                "code": "def verify(answer, **_):\n    return 1.0 if '30 days' in answer else 0.0\n",
                "passMark": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "code"
                      ]
                    },
                    "criterionId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "name": {
                      "type": "string",
                      "description": "Current shared criterion display text"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The line a monitor's verifier list shows under the name; null when its author wrote none"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When the shared criterion last changed"
                    },
                    "monitorCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Monitors in this organization using this shared criterion"
                    },
                    "code": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Python source as it was saved; checked against the save-time bounds when saved, not when read"
                    },
                    "passMark": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1,
                      "description": "The 0..1 score at or above which a Verdict.float passes; a Verdict.boolean ignores it. Shown as a percentage"
                    }
                  },
                  "required": [
                    "kind",
                    "criterionId",
                    "name",
                    "description",
                    "updatedAt",
                    "monitorCount",
                    "code",
                    "passMark"
                  ],
                  "additionalProperties": false,
                  "description": "A saved shared Python criterion as the picker and editor show it"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "monitor.saveCode",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body -X PUT \"$CONTEXT_APP_ORIGIN/api/v1/evals/criteria/code/$CRITERION_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary @- <<'JSON'\n{\n  \"name\": \"rest-writes mentions 30 days\",\n  \"code\": \"def verify(answer, **_):\\n    return 1.0 if '30 days' in answer else 0.0\\n\",\n  \"passMark\": 1\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\ncriterion_id = os.environ[\"CRITERION_ID\"]\n\nresp = requests.put(\n    f\"{origin}/api/v1/evals/criteria/code/{criterion_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    json={\n        \"name\": \"rest-writes mentions 30 days\",\n        \"code\": \"def verify(answer, **_):\\n    return 1.0 if '30 days' in answer else 0.0\\n\",\n        \"passMark\": 1\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/criteria/code/${encodeURIComponent(env(\"CRITERION_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"name\": \"rest-writes mentions 30 days\",\n  \"code\": \"def verify(answer, **_):\\n    return 1.0 if '30 days' in answer else 0.0\\n\",\n  \"passMark\": 1\n}\nconst res = await fetch(url, {\n  method: \"PUT\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/criteria/agent/{criterionId}": {
      "put": {
        "tags": [
          "Criteria"
        ],
        "summary": "Save an agent criterion",
        "description": "Creates or replaces a shared agent criterion (an agent judge) under an id you choose (a UUID). Its model must be one this deployment serves.",
        "operationId": "saveAgentCriterion",
        "parameters": [
          {
            "in": "path",
            "name": "criterionId",
            "required": true,
            "description": "Criterion identifier, a UUID the caller chooses; saving the same id again replaces it",
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Criterion (from the path)"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "The criterion's label wherever criteria are listed"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1000,
                    "description": "The line a monitor's verifier list shows under the name; null clears it, absent keeps the saved one"
                  },
                  "instructions": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20000,
                    "description": "Plain-language instructions the judge sub-agent follows: what to look at in the turn's files and answer, and what makes it pass"
                  },
                  "model": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "The model the judge sub-agent runs on, as the judge catalog names it"
                  },
                  "outputType": {
                    "type": "string",
                    "enum": [
                      "BOOLEAN",
                      "FLOAT"
                    ],
                    "description": "BOOLEAN: the judge answers Pass or Fail; FLOAT: a 0..1 score that passes at the criterion's pass mark"
                  },
                  "python": {
                    "type": "boolean",
                    "description": "Whether the judge may run Python on a scratch copy of the turn's files (never the originals, no network)"
                  },
                  "passMark": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "description": "The 0..1 score at or above which a FLOAT verdict passes; a BOOLEAN verdict ignores it. Shown as a percentage"
                  }
                },
                "required": [
                  "name",
                  "instructions",
                  "model",
                  "outputType",
                  "python",
                  "passMark"
                ],
                "additionalProperties": false,
                "description": "Create or replace a shared agent criterion. The model must be one this deployment serves; monitors using it judge with the new settings from the next dispatched run"
              },
              "example": {
                "name": "rest-writes cites the policy",
                "instructions": "Pass when the answer quotes the refund policy it relies on.",
                "model": "<a model id this deployment serves>",
                "outputType": "BOOLEAN",
                "python": false,
                "passMark": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "agent"
                      ]
                    },
                    "criterionId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "name": {
                      "type": "string",
                      "description": "Current shared criterion display text"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The line a monitor's verifier list shows under the name; null when its author wrote none"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When the shared criterion last changed"
                    },
                    "monitorCount": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Monitors in this organization using this shared criterion"
                    },
                    "instructions": {
                      "type": "string",
                      "minLength": 1,
                      "description": "Instructions as they were saved; checked against the save-time bounds when saved, not when read"
                    },
                    "model": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "The model the judge sub-agent runs on, as the judge catalog names it"
                    },
                    "outputType": {
                      "type": "string",
                      "enum": [
                        "BOOLEAN",
                        "FLOAT"
                      ],
                      "description": "BOOLEAN: the judge answers Pass or Fail; FLOAT: a 0..1 score that passes at the criterion's pass mark"
                    },
                    "python": {
                      "type": "boolean",
                      "description": "Whether the judge may run Python on a scratch copy of the turn's files (never the originals, no network)"
                    },
                    "passMark": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1,
                      "description": "The 0..1 score at or above which a FLOAT verdict passes; a BOOLEAN verdict ignores it. Shown as a percentage"
                    }
                  },
                  "required": [
                    "kind",
                    "criterionId",
                    "name",
                    "description",
                    "updatedAt",
                    "monitorCount",
                    "instructions",
                    "model",
                    "outputType",
                    "python",
                    "passMark"
                  ],
                  "additionalProperties": false,
                  "description": "A saved shared agent criterion as the picker and editor show it"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "monitor.saveAgent",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body -X PUT \"$CONTEXT_APP_ORIGIN/api/v1/evals/criteria/agent/$CRITERION_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary @- <<'JSON'\n{\n  \"name\": \"rest-writes cites the policy\",\n  \"instructions\": \"Pass when the answer quotes the refund policy it relies on.\",\n  \"model\": \"<a model id this deployment serves>\",\n  \"outputType\": \"BOOLEAN\",\n  \"python\": false,\n  \"passMark\": 1\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\ncriterion_id = os.environ[\"CRITERION_ID\"]\n\nresp = requests.put(\n    f\"{origin}/api/v1/evals/criteria/agent/{criterion_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    json={\n        \"name\": \"rest-writes cites the policy\",\n        \"instructions\": \"Pass when the answer quotes the refund policy it relies on.\",\n        \"model\": \"<a model id this deployment serves>\",\n        \"outputType\": \"BOOLEAN\",\n        \"python\": False,\n        \"passMark\": 1\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/criteria/agent/${encodeURIComponent(env(\"CRITERION_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"name\": \"rest-writes cites the policy\",\n  \"instructions\": \"Pass when the answer quotes the refund policy it relies on.\",\n  \"model\": \"<a model id this deployment serves>\",\n  \"outputType\": \"BOOLEAN\",\n  \"python\": false,\n  \"passMark\": 1\n}\nconst res = await fetch(url, {\n  method: \"PUT\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/criteria": {
      "get": {
        "tags": [
          "Criteria"
        ],
        "summary": "List shared criteria",
        "description": "The organization's library criteria a monitor can bind (LLM judges, Python and agent criteria), by id order, one page at a time.",
        "operationId": "listSharedCriteria",
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200,
              "default": ""
            }
          },
          {
            "in": "query",
            "name": "after",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "minLength": 1,
              "maxLength": 200,
              "default": null
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "llm_judge"
                                ]
                              },
                              "criterionId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "name": {
                                "type": "string",
                                "description": "Current shared criterion display text"
                              },
                              "description": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "The line a monitor's verifier list shows under the name; null when its author wrote none"
                              },
                              "updatedAt": {
                                "type": "string",
                                "format": "date-time",
                                "description": "When the shared criterion last changed"
                              },
                              "monitorCount": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Monitors in this organization using this shared criterion"
                              },
                              "instructions": {
                                "type": "string",
                                "description": "Current criterion instructions, not an execution snapshot"
                              },
                              "outputType": {
                                "type": "string",
                                "enum": [
                                  "FLOAT",
                                  "BOOLEAN",
                                  "TEXT"
                                ],
                                "description": "Judge output format: FLOAT (integer 1–5 score), BOOLEAN (pass/fail), or TEXT (free-form response)"
                              },
                              "scorable": {
                                "type": "boolean",
                                "description": "False when a shared edit changes this criterion to an unsupported scoring shape"
                              },
                              "model": {
                                "type": "string",
                                "description": "Current LLM verifier model"
                              },
                              "readOnly": {
                                "type": "boolean",
                                "description": "System criteria must be cloned through the existing judge API to be edited"
                              }
                            },
                            "required": [
                              "kind",
                              "criterionId",
                              "name",
                              "description",
                              "updatedAt",
                              "monitorCount",
                              "instructions",
                              "outputType",
                              "scorable",
                              "model",
                              "readOnly"
                            ],
                            "additionalProperties": false,
                            "description": "A shared LLM judge with its monitor-specific weight"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "rule"
                                ]
                              },
                              "criterionId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "name": {
                                "type": "string",
                                "description": "Current shared criterion display text"
                              },
                              "description": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "The line a monitor's verifier list shows under the name; null when its author wrote none"
                              },
                              "updatedAt": {
                                "type": "string",
                                "format": "date-time",
                                "description": "When the shared criterion last changed"
                              },
                              "monitorCount": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Monitors in this organization using this shared criterion"
                              },
                              "rule": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "contains",
                                          "not_contains",
                                          "starts_with",
                                          "ends_with",
                                          "equals"
                                        ],
                                        "description": "contains / does not contain anywhere; starts with, ends with and is exactly ignore spaces and line breaks around the text"
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "value": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2000
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "value",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "matches",
                                          "not_matches"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "pattern": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500,
                                        "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "pattern",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "length_between"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "min": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000000,
                                        "description": "Fewest characters that pass"
                                      },
                                      "max": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000000,
                                        "description": "Most characters that pass"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "min",
                                      "max"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "valid_json"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The whole text parses as JSON"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "matches_json_schema"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "schema": {
                                        "type": "object",
                                        "additionalProperties": {},
                                        "description": "A JSON Schema (draft 7 keywords) the text, parsed as JSON, must satisfy; unknown keywords, formats and references ($ref) are refused at save"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "schema"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_called",
                                          "tool_not_called"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_argument_matches"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      },
                                      "argument": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The argument's name, for example query"
                                      },
                                      "pattern": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500,
                                        "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool",
                                      "argument",
                                      "pattern",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Some call of the tool had this argument matching the pattern"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_call_count"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      },
                                      "min": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Fewest calls that pass"
                                      },
                                      "max": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Most calls that pass"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool",
                                      "min",
                                      "max"
                                    ],
                                    "additionalProperties": false
                                  }
                                ],
                                "description": "One rule: what it reads and the single check it makes. Grades Pass or Fail, never a score"
                              }
                            },
                            "required": [
                              "kind",
                              "criterionId",
                              "name",
                              "description",
                              "updatedAt",
                              "monitorCount",
                              "rule"
                            ],
                            "additionalProperties": false,
                            "description": "A saved shared rule as the picker and editor show it"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "code"
                                ]
                              },
                              "criterionId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "name": {
                                "type": "string",
                                "description": "Current shared criterion display text"
                              },
                              "description": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "The line a monitor's verifier list shows under the name; null when its author wrote none"
                              },
                              "updatedAt": {
                                "type": "string",
                                "format": "date-time",
                                "description": "When the shared criterion last changed"
                              },
                              "monitorCount": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Monitors in this organization using this shared criterion"
                              },
                              "code": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Python source as it was saved; checked against the save-time bounds when saved, not when read"
                              },
                              "passMark": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1,
                                "description": "The 0..1 score at or above which a Verdict.float passes; a Verdict.boolean ignores it. Shown as a percentage"
                              }
                            },
                            "required": [
                              "kind",
                              "criterionId",
                              "name",
                              "description",
                              "updatedAt",
                              "monitorCount",
                              "code",
                              "passMark"
                            ],
                            "additionalProperties": false,
                            "description": "A saved shared Python criterion as the picker and editor show it"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "agent"
                                ]
                              },
                              "criterionId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "name": {
                                "type": "string",
                                "description": "Current shared criterion display text"
                              },
                              "description": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "The line a monitor's verifier list shows under the name; null when its author wrote none"
                              },
                              "updatedAt": {
                                "type": "string",
                                "format": "date-time",
                                "description": "When the shared criterion last changed"
                              },
                              "monitorCount": {
                                "type": "integer",
                                "minimum": 0,
                                "description": "Monitors in this organization using this shared criterion"
                              },
                              "instructions": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Instructions as they were saved; checked against the save-time bounds when saved, not when read"
                              },
                              "model": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The model the judge sub-agent runs on, as the judge catalog names it"
                              },
                              "outputType": {
                                "type": "string",
                                "enum": [
                                  "BOOLEAN",
                                  "FLOAT"
                                ],
                                "description": "BOOLEAN: the judge answers Pass or Fail; FLOAT: a 0..1 score that passes at the criterion's pass mark"
                              },
                              "python": {
                                "type": "boolean",
                                "description": "Whether the judge may run Python on a scratch copy of the turn's files (never the originals, no network)"
                              },
                              "passMark": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1,
                                "description": "The 0..1 score at or above which a FLOAT verdict passes; a BOOLEAN verdict ignores it. Shown as a percentage"
                              }
                            },
                            "required": [
                              "kind",
                              "criterionId",
                              "name",
                              "description",
                              "updatedAt",
                              "monitorCount",
                              "instructions",
                              "model",
                              "outputType",
                              "python",
                              "passMark"
                            ],
                            "additionalProperties": false,
                            "description": "A saved shared agent criterion as the picker and editor show it"
                          }
                        ],
                        "description": "A shared criterion the picker offers, without a monitor's weight"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or the key is limited to specific agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:read",
        "x-runs-procedure": "monitor.listCriteria",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/criteria\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode 'limit=50'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/criteria\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"limit\": 50},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/criteria`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"limit\", \"50\")\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/monitors": {
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Create a monitor",
        "description": "A live evaluation: grades a percent of each target's real requests (agents, skills, applets, workflows, or every trace), on at once. It needs a pass mark and at least one criterion (`verifiers` it saves, or library `criteria` it binds). A body that names `alerts` is refused.",
        "operationId": "createMonitor",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "description": "A key you choose for this request (a UUID works; at most 255 characters; a blank one is refused 400, code `idempotency_key_empty`). A retry with the same key and the same body answers the first success again instead of acting twice; kept 24 hours. Send one on every create and run start you might retry.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "workspaceId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "description": "The workspace to create this in; null = organization-wide (organization admins only); omitted = the caller's only workspace, or every workspace for an organization admin"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "verifiers": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128,
                                  "description": "Stable identifier within the owning dataset or dataset task"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200,
                                  "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                                },
                                "weight": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                                },
                                "instructions": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                                },
                                "outputType": {
                                  "type": "string",
                                  "enum": [
                                    "boolean",
                                    "float",
                                    "text"
                                  ],
                                  "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                                },
                                "modelOverride": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "description": "Null means use the judge model of the Evaluation that runs it"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "llm_judge"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "weight",
                                "instructions",
                                "outputType",
                                "modelOverride",
                                "kind"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128,
                                  "description": "Stable identifier within the owning dataset or dataset task"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200,
                                  "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                                },
                                "weight": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                                },
                                "instructions": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                                },
                                "outputType": {
                                  "type": "string",
                                  "enum": [
                                    "boolean",
                                    "float",
                                    "text"
                                  ],
                                  "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                                },
                                "modelOverride": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "description": "Null means use the judge model of the Evaluation that runs it"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "agent_judge"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "weight",
                                "instructions",
                                "outputType",
                                "modelOverride",
                                "kind"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128,
                                  "description": "Stable identifier within the owning dataset or dataset task"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200,
                                  "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                                },
                                "weight": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "exact_match"
                                  ]
                                },
                                "comparison": {
                                  "type": "string",
                                  "enum": [
                                    "text_identical",
                                    "contains",
                                    "not_contains",
                                    "tool_called"
                                  ],
                                  "description": "text_identical: the output equals the expected text exactly, including case, whitespace and Unicode code points. contains / not_contains: the output holds `value` anywhere, or nowhere. tool_called: the agent called the tool named `value`"
                                },
                                "value": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000,
                                  "description": "The text contains / not_contains look for, or the tool name tool_called looks for; text_identical takes none"
                                },
                                "ignoreCase": {
                                  "type": "boolean",
                                  "description": "contains / not_contains only: compare without regard to upper and lower case"
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "weight",
                                "kind",
                                "comparison"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128,
                                  "description": "Stable identifier within the owning dataset or dataset task"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200,
                                  "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                                },
                                "weight": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "code_verifier"
                                  ]
                                },
                                "contractVersion": {
                                  "type": "number",
                                  "enum": [
                                    1
                                  ]
                                },
                                "code": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "Python defining verify(task, output) and returning a Verdict; the SDK and a working example: `context-cli evals describe verifier-sdk`. It imports the standard library, the context_verifiers SDK and the curated packages (`context-cli evals describe verifier-packages`); a save naming anything else is refused, as the runner refuses it. A criterion holds at most 512 KiB of code, and one dataset's or one task's Python criteria 4 MiB together."
                                },
                                "passMark": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1,
                                  "description": "Present: a float verdict passes at or above this 0..1 mark (Monitoring's Python criteria). Absent: a float verdict counts as its raw score"
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "weight",
                                "kind",
                                "contractVersion",
                                "code"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128,
                                  "description": "Stable identifier within the owning dataset or dataset task"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200,
                                  "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                                },
                                "weight": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "rule"
                                  ]
                                },
                                "rule": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "contains",
                                            "not_contains",
                                            "starts_with",
                                            "ends_with",
                                            "equals"
                                          ],
                                          "description": "contains / does not contain anywhere; starts with, ends with and is exactly ignore spaces and line breaks around the text"
                                        },
                                        "target": {
                                          "type": "string",
                                          "enum": [
                                            "answer",
                                            "user_message"
                                          ],
                                          "description": "The text the rule reads: the request's final answer, or the person's message"
                                        },
                                        "value": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 2000
                                        },
                                        "ignoreCase": {
                                          "type": "boolean",
                                          "description": "Compare without regard to upper and lower case"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "target",
                                        "value",
                                        "ignoreCase"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "matches",
                                            "not_matches"
                                          ]
                                        },
                                        "target": {
                                          "type": "string",
                                          "enum": [
                                            "answer",
                                            "user_message"
                                          ],
                                          "description": "The text the rule reads: the request's final answer, or the person's message"
                                        },
                                        "pattern": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 500,
                                          "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                        },
                                        "ignoreCase": {
                                          "type": "boolean",
                                          "description": "Compare without regard to upper and lower case"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "target",
                                        "pattern",
                                        "ignoreCase"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "length_between"
                                          ]
                                        },
                                        "target": {
                                          "type": "string",
                                          "enum": [
                                            "answer",
                                            "user_message"
                                          ],
                                          "description": "The text the rule reads: the request's final answer, or the person's message"
                                        },
                                        "min": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000000,
                                          "description": "Fewest characters that pass"
                                        },
                                        "max": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000000,
                                          "description": "Most characters that pass"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "target",
                                        "min",
                                        "max"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "valid_json"
                                          ]
                                        },
                                        "target": {
                                          "type": "string",
                                          "enum": [
                                            "answer",
                                            "user_message"
                                          ],
                                          "description": "The text the rule reads: the request's final answer, or the person's message"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "target"
                                      ],
                                      "additionalProperties": false,
                                      "description": "The whole text parses as JSON"
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "matches_json_schema"
                                          ]
                                        },
                                        "target": {
                                          "type": "string",
                                          "enum": [
                                            "answer",
                                            "user_message"
                                          ],
                                          "description": "The text the rule reads: the request's final answer, or the person's message"
                                        },
                                        "schema": {
                                          "type": "object",
                                          "additionalProperties": {},
                                          "description": "A JSON Schema (draft 7 keywords) the text, parsed as JSON, must satisfy; unknown keywords, formats and references ($ref) are refused at save"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "target",
                                        "schema"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "tool_called",
                                            "tool_not_called"
                                          ]
                                        },
                                        "tool": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "The tool's name as the agent calls it, for example web_search"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "tool"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "tool_argument_matches"
                                          ]
                                        },
                                        "tool": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "The tool's name as the agent calls it, for example web_search"
                                        },
                                        "argument": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "The argument's name, for example query"
                                        },
                                        "pattern": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 500,
                                          "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                        },
                                        "ignoreCase": {
                                          "type": "boolean",
                                          "description": "Compare without regard to upper and lower case"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "tool",
                                        "argument",
                                        "pattern",
                                        "ignoreCase"
                                      ],
                                      "additionalProperties": false,
                                      "description": "Some call of the tool had this argument matching the pattern"
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "tool_call_count"
                                          ]
                                        },
                                        "tool": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "The tool's name as the agent calls it, for example web_search"
                                        },
                                        "min": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000,
                                          "description": "Fewest calls that pass"
                                        },
                                        "max": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000,
                                          "description": "Most calls that pass"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "tool",
                                        "min",
                                        "max"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ],
                                  "description": "A Monitoring rule, verbatim: every operator and target it has, decided by the rule grader (../monitor/rule-grade)"
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "weight",
                                "kind",
                                "rule"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "description": "A bespoke verifier owned by a dataset or one dataset task; not a shared library reference"
                        },
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200000,
                          "description": "One .md verifier: front matter (name, weight, needs_files, judge_model), the prose, an optional ```python block"
                        }
                      ]
                    },
                    "maxItems": 50,
                    "default": [],
                    "description": "The evaluation's own verifiers, as JSON definitions or .md files. A test set may have none (its dataset's criteria grade it); a live evaluation needs at least one. A rule is refused: write the check in Python"
                  },
                  "passMark": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 1,
                    "description": "A row passes at or above this 0..1 score. A live evaluation needs one; a test set may state none (null)"
                  },
                  "source": {
                    "type": "object",
                    "properties": {
                      "live": {
                        "type": "object",
                        "properties": {
                          "targets": {
                            "type": "array",
                            "items": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "traces"
                                      ]
                                    },
                                    "targetId": {
                                      "type": "null"
                                    },
                                    "samplePct": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 100,
                                      "description": "Percent of this target's eligible turns an Online evaluation grades"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "targetId",
                                    "samplePct"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "skill",
                                        "agent",
                                        "applet",
                                        "workflow"
                                      ],
                                      "description": "traces: every trace in the organization; skill, agent, applet: turns that used it; workflow: turns its classification files there"
                                    },
                                    "targetId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    },
                                    "samplePct": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 100,
                                      "description": "Percent of this target's eligible turns an Online evaluation grades"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "targetId",
                                    "samplePct"
                                  ],
                                  "additionalProperties": false
                                }
                              ],
                              "description": "A target of an Online evaluation with its sampling percent"
                            },
                            "minItems": 1,
                            "maxItems": 50,
                            "description": "What it grades, each with its percent of requests"
                          },
                          "criteria": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "llm_judge",
                                    "code",
                                    "agent"
                                  ],
                                  "description": "A shared LLM judge, Python criterion or agent criterion already in the organization's library (monitor.listCriteria)"
                                },
                                "criterionId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "weight": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "maximum": 1000,
                                  "description": "Relative weight beside the verifiers' own: the score divides by the weight sum"
                                }
                              },
                              "required": [
                                "kind",
                                "criterionId",
                                "weight"
                              ],
                              "additionalProperties": false
                            },
                            "maxItems": 50,
                            "default": [],
                            "description": "Existing criteria bound by reference, never copied; with `verifiers`, at least one in all"
                          }
                        },
                        "required": [
                          "targets"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "live"
                    ],
                    "additionalProperties": false,
                    "description": "live: the targets it grades (agents, skills, applets, workflows or every trace), each at a percent of its requests, and the library criteria it binds"
                  }
                },
                "required": [
                  "name",
                  "passMark",
                  "source"
                ],
                "additionalProperties": false
              },
              "example": {
                "name": "rest-writes refunds workflow",
                "passMark": 0.7,
                "source": {
                  "live": {
                    "targets": [
                      {
                        "kind": "workflow",
                        "targetId": "<workflow id>",
                        "samplePct": 20
                      }
                    ],
                    "criteria": [
                      {
                        "kind": "llm_judge",
                        "criterionId": "<judge id>",
                        "weight": 1
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success. A retry with the same `Idempotency-Key` and the same request answers this again, with `Idempotent-Replayed: true`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ref": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "monitor",
                            "benchmark"
                          ],
                          "description": "monitor: a live evaluation grading real requests; benchmark: a test-set evaluation checked against known answers"
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      },
                      "required": [
                        "kind",
                        "id"
                      ],
                      "additionalProperties": false
                    },
                    "orgId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "live"
                              ]
                            }
                          },
                          "required": [
                            "kind"
                          ],
                          "additionalProperties": false,
                          "description": "Grades a sample of real requests as they finish; each target's percent is on the target"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "test_set"
                              ]
                            },
                            "datasetIds": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "description": "The test sets each run answers, in link order"
                            }
                          },
                          "required": [
                            "kind",
                            "datasetIds"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "passMark": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "minimum": 0,
                      "maximum": 1,
                      "description": "A row passes at or above this 0..1 score; null when the evaluation states none"
                    },
                    "enabled": {
                      "type": [
                        "boolean",
                        "null"
                      ],
                      "description": "Whether a live evaluation admits new requests; null for a test set, which runs when asked"
                    },
                    "pausedReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "payer_left",
                        "payer_over_budget",
                        "org_out_of_credits",
                        null
                      ],
                      "description": "Why the platform paused a live evaluation (its payer left, is over budget, or the organization is out of credits); null when a person paused it, it is live, or it is a test set"
                    },
                    "payerUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "The person a live evaluation's checks bill: whoever last turned it on or saved a change; null for a test set (a run bills whoever starts it)"
                    },
                    "revision": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "exclusiveMinimum": 0,
                      "description": "A live evaluation's save counter: a change names the revision it read and is refused CONFLICT when another save came first; null for a test set"
                    },
                    "targets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "traces",
                              "skill",
                              "agent",
                              "applet",
                              "workflow"
                            ],
                            "description": "traces: every trace in the organization; skill, agent, applet: turns that used it; workflow: turns its classification files there"
                          },
                          "targetId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "minLength": 1,
                            "maxLength": 200,
                            "description": "Null for traces (every trace in the organization)"
                          },
                          "samplePct": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 1,
                            "maximum": 100,
                            "description": "Percent of this target's requests a live evaluation grades; null on a test set"
                          }
                        },
                        "required": [
                          "kind",
                          "targetId",
                          "samplePct"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "verifierCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "verifiers": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "instructions": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                              },
                              "outputType": {
                                "type": "string",
                                "enum": [
                                  "boolean",
                                  "float",
                                  "text"
                                ],
                                "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                              },
                              "modelOverride": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1,
                                "description": "Null means use the judge model of the Evaluation that runs it"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "llm_judge"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "instructions",
                              "outputType",
                              "modelOverride",
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "instructions": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                              },
                              "outputType": {
                                "type": "string",
                                "enum": [
                                  "boolean",
                                  "float",
                                  "text"
                                ],
                                "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                              },
                              "modelOverride": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1,
                                "description": "Null means use the judge model of the Evaluation that runs it"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "agent_judge"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "instructions",
                              "outputType",
                              "modelOverride",
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "exact_match"
                                ]
                              },
                              "comparison": {
                                "type": "string",
                                "enum": [
                                  "text_identical",
                                  "contains",
                                  "not_contains",
                                  "tool_called"
                                ],
                                "description": "text_identical: the output equals the expected text exactly, including case, whitespace and Unicode code points. contains / not_contains: the output holds `value` anywhere, or nowhere. tool_called: the agent called the tool named `value`"
                              },
                              "value": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000,
                                "description": "The text contains / not_contains look for, or the tool name tool_called looks for; text_identical takes none"
                              },
                              "ignoreCase": {
                                "type": "boolean",
                                "description": "contains / not_contains only: compare without regard to upper and lower case"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "comparison"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "code_verifier"
                                ]
                              },
                              "contractVersion": {
                                "type": "number",
                                "enum": [
                                  1
                                ]
                              },
                              "code": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Python defining verify(task, output) and returning a Verdict; the SDK and a working example: `context-cli evals describe verifier-sdk`. It imports the standard library, the context_verifiers SDK and the curated packages (`context-cli evals describe verifier-packages`); a save naming anything else is refused, as the runner refuses it. A criterion holds at most 512 KiB of code, and one dataset's or one task's Python criteria 4 MiB together."
                              },
                              "passMark": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1,
                                "description": "Present: a float verdict passes at or above this 0..1 mark (Monitoring's Python criteria). Absent: a float verdict counts as its raw score"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "contractVersion",
                              "code"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "rule"
                                ]
                              },
                              "rule": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "contains",
                                          "not_contains",
                                          "starts_with",
                                          "ends_with",
                                          "equals"
                                        ],
                                        "description": "contains / does not contain anywhere; starts with, ends with and is exactly ignore spaces and line breaks around the text"
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "value": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2000
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "value",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "matches",
                                          "not_matches"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "pattern": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500,
                                        "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "pattern",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "length_between"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "min": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000000,
                                        "description": "Fewest characters that pass"
                                      },
                                      "max": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000000,
                                        "description": "Most characters that pass"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "min",
                                      "max"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "valid_json"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The whole text parses as JSON"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "matches_json_schema"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "schema": {
                                        "type": "object",
                                        "additionalProperties": {},
                                        "description": "A JSON Schema (draft 7 keywords) the text, parsed as JSON, must satisfy; unknown keywords, formats and references ($ref) are refused at save"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "schema"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_called",
                                          "tool_not_called"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_argument_matches"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      },
                                      "argument": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The argument's name, for example query"
                                      },
                                      "pattern": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500,
                                        "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool",
                                      "argument",
                                      "pattern",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Some call of the tool had this argument matching the pattern"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_call_count"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      },
                                      "min": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Fewest calls that pass"
                                      },
                                      "max": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Most calls that pass"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool",
                                      "min",
                                      "max"
                                    ],
                                    "additionalProperties": false
                                  }
                                ],
                                "description": "A Monitoring rule, verbatim: every operator and target it has, decided by the rule grader (../monitor/rule-grade)"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "rule"
                            ],
                            "additionalProperties": false
                          }
                        ],
                        "description": "A bespoke verifier owned by a dataset or one dataset task; not a shared library reference"
                      },
                      "description": "The evaluation's own verifiers in order (a test set's datasets and rows may add checks of their own)"
                    },
                    "test": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "axes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "model"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A model the held agent runs"
                                  },
                                  "minItems": 1,
                                  "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false,
                                            "description": "A skill, at its newest version (no version given) or a pinned version number"
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every model runs on, and the skills it runs with"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Model: one agent and its skills are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "skill"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "skill"
                                            ]
                                          },
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A skill the held agent runs with, at its newest version or a pinned one"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "no_skill"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false,
                                        "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                      }
                                    ]
                                  },
                                  "minItems": 1,
                                  "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "model"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every skill runs on, and the model it runs"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Skill: one agent and its model are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "agent"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent"
                                        ]
                                      },
                                      "agentId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "An agent in the evaluation's organization"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "agentId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "An agent"
                                  },
                                  "minItems": 1,
                                  "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false,
                                            "description": "A skill, at its newest version (no version given) or a pinned version number"
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "model",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The model every agent runs (one they can all run, or each agent's own default), and the skills they run with"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Agent: the model and the skills are held fixed"
                            }
                          ],
                          "description": "The question an Evaluation asks: the ONE axis it tests, the values it compares, and what it holds for the other two axes"
                        },
                        "judgeModel": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "axes",
                        "judgeModel"
                      ],
                      "additionalProperties": false,
                      "description": "A test set's question (what each run varies and holds) and its default judge model; null when live"
                    },
                    "webUrl": {
                      "type": "string",
                      "description": "The evaluation's page, /client/evals/evaluation/<monitor|benchmark>/<id> on the org's public origin (the one share links carry). Absent from a server older than the field"
                    }
                  },
                  "required": [
                    "ref",
                    "orgId",
                    "name",
                    "description",
                    "source",
                    "passMark",
                    "enabled",
                    "pausedReason",
                    "payerUserId",
                    "revision",
                    "targets",
                    "verifierCount",
                    "createdAt",
                    "updatedAt",
                    "verifiers",
                    "test"
                  ],
                  "additionalProperties": false,
                  "description": "One evaluation, live or test set, in one shape"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "This `Idempotency-Key` was already used on a different request (code `idempotency_key_reused`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "evaluation.create",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\n# One Idempotency-Key per request you mean to make once; send the same key again to retry it.\ncurl -sS --fail-with-body -X POST \"$CONTEXT_APP_ORIGIN/api/v1/evals/monitors\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  -H \"Idempotency-Key: $IDEMPOTENCY_KEY\" \\\n  --data-binary @- <<'JSON'\n{\n  \"name\": \"rest-writes refunds workflow\",\n  \"passMark\": 0.7,\n  \"source\": {\n    \"live\": {\n      \"targets\": [\n        {\n          \"kind\": \"workflow\",\n          \"targetId\": \"<workflow id>\",\n          \"samplePct\": 20\n        }\n      ],\n      \"criteria\": [\n        {\n          \"kind\": \"llm_judge\",\n          \"criterionId\": \"<judge id>\",\n          \"weight\": 1\n        }\n      ]\n    }\n  }\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.post(\n    f\"{origin}/api/v1/evals/monitors\",\n    headers={\"Authorization\": f\"Bearer {api_key}\", \"Idempotency-Key\": os.environ[\"IDEMPOTENCY_KEY\"]},\n    json={\n        \"name\": \"rest-writes refunds workflow\",\n        \"passMark\": 0.7,\n        \"source\": {\n            \"live\": {\n                \"targets\": [\n                    {\n                        \"kind\": \"workflow\",\n                        \"targetId\": \"<workflow id>\",\n                        \"samplePct\": 20\n                    }\n                ],\n                \"criteria\": [\n                    {\n                        \"kind\": \"llm_judge\",\n                        \"criterionId\": \"<judge id>\",\n                        \"weight\": 1\n                    }\n                ]\n            }\n        }\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/monitors`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"name\": \"rest-writes refunds workflow\",\n  \"passMark\": 0.7,\n  \"source\": {\n    \"live\": {\n      \"targets\": [\n        {\n          \"kind\": \"workflow\",\n          \"targetId\": \"<workflow id>\",\n          \"samplePct\": 20\n        }\n      ],\n      \"criteria\": [\n        {\n          \"kind\": \"llm_judge\",\n          \"criterionId\": \"<judge id>\",\n          \"weight\": 1\n        }\n      ]\n    }\n  }\n}\nconst res = await fetch(url, {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\", \"Idempotency-Key\": env(\"IDEMPOTENCY_KEY\") },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/monitors/{monitorId}": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get a monitor",
        "description": "The monitor as an update replaces it: name, pass mark, targets at their percents, criteria by reference, and its `revision`.",
        "operationId": "getMonitor",
        "parameters": [
          {
            "in": "path",
            "name": "monitorId",
            "required": true,
            "description": "Monitor identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Monitor (from the path)"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ref": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "monitor",
                            "benchmark"
                          ],
                          "description": "monitor: a live evaluation grading real requests; benchmark: a test-set evaluation checked against known answers"
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      },
                      "required": [
                        "kind",
                        "id"
                      ],
                      "additionalProperties": false
                    },
                    "orgId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "live"
                              ]
                            }
                          },
                          "required": [
                            "kind"
                          ],
                          "additionalProperties": false,
                          "description": "Grades a sample of real requests as they finish; each target's percent is on the target"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "test_set"
                              ]
                            },
                            "datasetIds": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "description": "The test sets each run answers, in link order"
                            }
                          },
                          "required": [
                            "kind",
                            "datasetIds"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "passMark": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "minimum": 0,
                      "maximum": 1,
                      "description": "A row passes at or above this 0..1 score; null when the evaluation states none"
                    },
                    "enabled": {
                      "type": [
                        "boolean",
                        "null"
                      ],
                      "description": "Whether a live evaluation admits new requests; null for a test set, which runs when asked"
                    },
                    "pausedReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "payer_left",
                        "payer_over_budget",
                        "org_out_of_credits",
                        null
                      ],
                      "description": "Why the platform paused a live evaluation (its payer left, is over budget, or the organization is out of credits); null when a person paused it, it is live, or it is a test set"
                    },
                    "payerUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "The person a live evaluation's checks bill: whoever last turned it on or saved a change; null for a test set (a run bills whoever starts it)"
                    },
                    "revision": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "exclusiveMinimum": 0,
                      "description": "A live evaluation's save counter: a change names the revision it read and is refused CONFLICT when another save came first; null for a test set"
                    },
                    "targets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "traces",
                              "skill",
                              "agent",
                              "applet",
                              "workflow"
                            ],
                            "description": "traces: every trace in the organization; skill, agent, applet: turns that used it; workflow: turns its classification files there"
                          },
                          "targetId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "minLength": 1,
                            "maxLength": 200,
                            "description": "Null for traces (every trace in the organization)"
                          },
                          "samplePct": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 1,
                            "maximum": 100,
                            "description": "Percent of this target's requests a live evaluation grades; null on a test set"
                          }
                        },
                        "required": [
                          "kind",
                          "targetId",
                          "samplePct"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "verifierCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "verifiers": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "instructions": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                              },
                              "outputType": {
                                "type": "string",
                                "enum": [
                                  "boolean",
                                  "float",
                                  "text"
                                ],
                                "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                              },
                              "modelOverride": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1,
                                "description": "Null means use the judge model of the Evaluation that runs it"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "llm_judge"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "instructions",
                              "outputType",
                              "modelOverride",
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "instructions": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                              },
                              "outputType": {
                                "type": "string",
                                "enum": [
                                  "boolean",
                                  "float",
                                  "text"
                                ],
                                "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                              },
                              "modelOverride": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1,
                                "description": "Null means use the judge model of the Evaluation that runs it"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "agent_judge"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "instructions",
                              "outputType",
                              "modelOverride",
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "exact_match"
                                ]
                              },
                              "comparison": {
                                "type": "string",
                                "enum": [
                                  "text_identical",
                                  "contains",
                                  "not_contains",
                                  "tool_called"
                                ],
                                "description": "text_identical: the output equals the expected text exactly, including case, whitespace and Unicode code points. contains / not_contains: the output holds `value` anywhere, or nowhere. tool_called: the agent called the tool named `value`"
                              },
                              "value": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000,
                                "description": "The text contains / not_contains look for, or the tool name tool_called looks for; text_identical takes none"
                              },
                              "ignoreCase": {
                                "type": "boolean",
                                "description": "contains / not_contains only: compare without regard to upper and lower case"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "comparison"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "code_verifier"
                                ]
                              },
                              "contractVersion": {
                                "type": "number",
                                "enum": [
                                  1
                                ]
                              },
                              "code": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Python defining verify(task, output) and returning a Verdict; the SDK and a working example: `context-cli evals describe verifier-sdk`. It imports the standard library, the context_verifiers SDK and the curated packages (`context-cli evals describe verifier-packages`); a save naming anything else is refused, as the runner refuses it. A criterion holds at most 512 KiB of code, and one dataset's or one task's Python criteria 4 MiB together."
                              },
                              "passMark": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1,
                                "description": "Present: a float verdict passes at or above this 0..1 mark (Monitoring's Python criteria). Absent: a float verdict counts as its raw score"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "contractVersion",
                              "code"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "rule"
                                ]
                              },
                              "rule": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "contains",
                                          "not_contains",
                                          "starts_with",
                                          "ends_with",
                                          "equals"
                                        ],
                                        "description": "contains / does not contain anywhere; starts with, ends with and is exactly ignore spaces and line breaks around the text"
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "value": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2000
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "value",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "matches",
                                          "not_matches"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "pattern": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500,
                                        "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "pattern",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "length_between"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "min": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000000,
                                        "description": "Fewest characters that pass"
                                      },
                                      "max": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000000,
                                        "description": "Most characters that pass"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "min",
                                      "max"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "valid_json"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The whole text parses as JSON"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "matches_json_schema"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "schema": {
                                        "type": "object",
                                        "additionalProperties": {},
                                        "description": "A JSON Schema (draft 7 keywords) the text, parsed as JSON, must satisfy; unknown keywords, formats and references ($ref) are refused at save"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "schema"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_called",
                                          "tool_not_called"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_argument_matches"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      },
                                      "argument": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The argument's name, for example query"
                                      },
                                      "pattern": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500,
                                        "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool",
                                      "argument",
                                      "pattern",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Some call of the tool had this argument matching the pattern"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_call_count"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      },
                                      "min": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Fewest calls that pass"
                                      },
                                      "max": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Most calls that pass"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool",
                                      "min",
                                      "max"
                                    ],
                                    "additionalProperties": false
                                  }
                                ],
                                "description": "A Monitoring rule, verbatim: every operator and target it has, decided by the rule grader (../monitor/rule-grade)"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "rule"
                            ],
                            "additionalProperties": false
                          }
                        ],
                        "description": "A bespoke verifier owned by a dataset or one dataset task; not a shared library reference"
                      },
                      "description": "The evaluation's own verifiers in order (a test set's datasets and rows may add checks of their own)"
                    },
                    "test": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "axes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "model"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A model the held agent runs"
                                  },
                                  "minItems": 1,
                                  "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false,
                                            "description": "A skill, at its newest version (no version given) or a pinned version number"
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every model runs on, and the skills it runs with"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Model: one agent and its skills are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "skill"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "skill"
                                            ]
                                          },
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A skill the held agent runs with, at its newest version or a pinned one"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "no_skill"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false,
                                        "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                      }
                                    ]
                                  },
                                  "minItems": 1,
                                  "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "model"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every skill runs on, and the model it runs"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Skill: one agent and its model are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "agent"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent"
                                        ]
                                      },
                                      "agentId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "An agent in the evaluation's organization"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "agentId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "An agent"
                                  },
                                  "minItems": 1,
                                  "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false,
                                            "description": "A skill, at its newest version (no version given) or a pinned version number"
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "model",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The model every agent runs (one they can all run, or each agent's own default), and the skills they run with"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Agent: the model and the skills are held fixed"
                            }
                          ],
                          "description": "The question an Evaluation asks: the ONE axis it tests, the values it compares, and what it holds for the other two axes"
                        },
                        "judgeModel": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "axes",
                        "judgeModel"
                      ],
                      "additionalProperties": false,
                      "description": "A test set's question (what each run varies and holds) and its default judge model; null when live"
                    },
                    "webUrl": {
                      "type": "string",
                      "description": "The evaluation's page, /client/evals/evaluation/<monitor|benchmark>/<id> on the org's public origin (the one share links carry). Absent from a server older than the field"
                    }
                  },
                  "required": [
                    "ref",
                    "orgId",
                    "name",
                    "description",
                    "source",
                    "passMark",
                    "enabled",
                    "pausedReason",
                    "payerUserId",
                    "revision",
                    "targets",
                    "verifierCount",
                    "createdAt",
                    "updatedAt",
                    "verifiers",
                    "test"
                  ],
                  "additionalProperties": false,
                  "description": "One evaluation, live or test set, in one shape"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or the key is limited to specific agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:read",
        "x-runs-procedure": "evaluation.get",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/monitors/$MONITOR_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nmonitor_id = os.environ[\"MONITOR_ID\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/monitors/{monitor_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/monitors/${encodeURIComponent(env(\"MONITOR_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      },
      "put": {
        "tags": [
          "Monitors"
        ],
        "summary": "Replace a monitor's settings",
        "description": "Replaces its name, pass mark, targets and criteria together, under the `expectedRevision` you read (`GET /monitors/{monitorId}`); a save in between is refused 409 with the current revision.",
        "operationId": "updateMonitor",
        "parameters": [
          {
            "in": "path",
            "name": "monitorId",
            "required": true,
            "description": "Monitor identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Monitor (from the path)"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 2000
                  },
                  "expectedRevision": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "description": "The revision the caller read (get answers it); refused CONFLICT when another save came after it"
                  },
                  "verifiers": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128,
                                  "description": "Stable identifier within the owning dataset or dataset task"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200,
                                  "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                                },
                                "weight": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                                },
                                "instructions": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                                },
                                "outputType": {
                                  "type": "string",
                                  "enum": [
                                    "boolean",
                                    "float",
                                    "text"
                                  ],
                                  "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                                },
                                "modelOverride": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "description": "Null means use the judge model of the Evaluation that runs it"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "llm_judge"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "weight",
                                "instructions",
                                "outputType",
                                "modelOverride",
                                "kind"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128,
                                  "description": "Stable identifier within the owning dataset or dataset task"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200,
                                  "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                                },
                                "weight": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                                },
                                "instructions": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                                },
                                "outputType": {
                                  "type": "string",
                                  "enum": [
                                    "boolean",
                                    "float",
                                    "text"
                                  ],
                                  "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                                },
                                "modelOverride": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "description": "Null means use the judge model of the Evaluation that runs it"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "agent_judge"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "weight",
                                "instructions",
                                "outputType",
                                "modelOverride",
                                "kind"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128,
                                  "description": "Stable identifier within the owning dataset or dataset task"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200,
                                  "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                                },
                                "weight": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "exact_match"
                                  ]
                                },
                                "comparison": {
                                  "type": "string",
                                  "enum": [
                                    "text_identical",
                                    "contains",
                                    "not_contains",
                                    "tool_called"
                                  ],
                                  "description": "text_identical: the output equals the expected text exactly, including case, whitespace and Unicode code points. contains / not_contains: the output holds `value` anywhere, or nowhere. tool_called: the agent called the tool named `value`"
                                },
                                "value": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000,
                                  "description": "The text contains / not_contains look for, or the tool name tool_called looks for; text_identical takes none"
                                },
                                "ignoreCase": {
                                  "type": "boolean",
                                  "description": "contains / not_contains only: compare without regard to upper and lower case"
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "weight",
                                "kind",
                                "comparison"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128,
                                  "description": "Stable identifier within the owning dataset or dataset task"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200,
                                  "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                                },
                                "weight": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "code_verifier"
                                  ]
                                },
                                "contractVersion": {
                                  "type": "number",
                                  "enum": [
                                    1
                                  ]
                                },
                                "code": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "Python defining verify(task, output) and returning a Verdict; the SDK and a working example: `context-cli evals describe verifier-sdk`. It imports the standard library, the context_verifiers SDK and the curated packages (`context-cli evals describe verifier-packages`); a save naming anything else is refused, as the runner refuses it. A criterion holds at most 512 KiB of code, and one dataset's or one task's Python criteria 4 MiB together."
                                },
                                "passMark": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1,
                                  "description": "Present: a float verdict passes at or above this 0..1 mark (Monitoring's Python criteria). Absent: a float verdict counts as its raw score"
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "weight",
                                "kind",
                                "contractVersion",
                                "code"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128,
                                  "description": "Stable identifier within the owning dataset or dataset task"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200,
                                  "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                                },
                                "weight": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100000,
                                  "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "rule"
                                  ]
                                },
                                "rule": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "contains",
                                            "not_contains",
                                            "starts_with",
                                            "ends_with",
                                            "equals"
                                          ],
                                          "description": "contains / does not contain anywhere; starts with, ends with and is exactly ignore spaces and line breaks around the text"
                                        },
                                        "target": {
                                          "type": "string",
                                          "enum": [
                                            "answer",
                                            "user_message"
                                          ],
                                          "description": "The text the rule reads: the request's final answer, or the person's message"
                                        },
                                        "value": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 2000
                                        },
                                        "ignoreCase": {
                                          "type": "boolean",
                                          "description": "Compare without regard to upper and lower case"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "target",
                                        "value",
                                        "ignoreCase"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "matches",
                                            "not_matches"
                                          ]
                                        },
                                        "target": {
                                          "type": "string",
                                          "enum": [
                                            "answer",
                                            "user_message"
                                          ],
                                          "description": "The text the rule reads: the request's final answer, or the person's message"
                                        },
                                        "pattern": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 500,
                                          "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                        },
                                        "ignoreCase": {
                                          "type": "boolean",
                                          "description": "Compare without regard to upper and lower case"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "target",
                                        "pattern",
                                        "ignoreCase"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "length_between"
                                          ]
                                        },
                                        "target": {
                                          "type": "string",
                                          "enum": [
                                            "answer",
                                            "user_message"
                                          ],
                                          "description": "The text the rule reads: the request's final answer, or the person's message"
                                        },
                                        "min": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000000,
                                          "description": "Fewest characters that pass"
                                        },
                                        "max": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000000,
                                          "description": "Most characters that pass"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "target",
                                        "min",
                                        "max"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "valid_json"
                                          ]
                                        },
                                        "target": {
                                          "type": "string",
                                          "enum": [
                                            "answer",
                                            "user_message"
                                          ],
                                          "description": "The text the rule reads: the request's final answer, or the person's message"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "target"
                                      ],
                                      "additionalProperties": false,
                                      "description": "The whole text parses as JSON"
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "matches_json_schema"
                                          ]
                                        },
                                        "target": {
                                          "type": "string",
                                          "enum": [
                                            "answer",
                                            "user_message"
                                          ],
                                          "description": "The text the rule reads: the request's final answer, or the person's message"
                                        },
                                        "schema": {
                                          "type": "object",
                                          "additionalProperties": {},
                                          "description": "A JSON Schema (draft 7 keywords) the text, parsed as JSON, must satisfy; unknown keywords, formats and references ($ref) are refused at save"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "target",
                                        "schema"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "tool_called",
                                            "tool_not_called"
                                          ]
                                        },
                                        "tool": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "The tool's name as the agent calls it, for example web_search"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "tool"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "tool_argument_matches"
                                          ]
                                        },
                                        "tool": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "The tool's name as the agent calls it, for example web_search"
                                        },
                                        "argument": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "The argument's name, for example query"
                                        },
                                        "pattern": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 500,
                                          "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                        },
                                        "ignoreCase": {
                                          "type": "boolean",
                                          "description": "Compare without regard to upper and lower case"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "tool",
                                        "argument",
                                        "pattern",
                                        "ignoreCase"
                                      ],
                                      "additionalProperties": false,
                                      "description": "Some call of the tool had this argument matching the pattern"
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "operator": {
                                          "type": "string",
                                          "enum": [
                                            "tool_call_count"
                                          ]
                                        },
                                        "tool": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "The tool's name as the agent calls it, for example web_search"
                                        },
                                        "min": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000,
                                          "description": "Fewest calls that pass"
                                        },
                                        "max": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 100000,
                                          "description": "Most calls that pass"
                                        }
                                      },
                                      "required": [
                                        "operator",
                                        "tool",
                                        "min",
                                        "max"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ],
                                  "description": "A Monitoring rule, verbatim: every operator and target it has, decided by the rule grader (../monitor/rule-grade)"
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "weight",
                                "kind",
                                "rule"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "description": "A bespoke verifier owned by a dataset or one dataset task; not a shared library reference"
                        },
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200000,
                          "description": "One .md verifier: front matter (name, weight, needs_files, judge_model), the prose, an optional ```python block"
                        }
                      ]
                    },
                    "maxItems": 50,
                    "default": [],
                    "description": "New verifiers this save adds, saved to the library as create saves them (JSON definitions or .md files). The evaluation's current criteria are bound in source.live.criteria by id (get's verifiers[].id), never repeated here"
                  },
                  "passMark": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "description": "A row passes at or above this 0..1 score"
                  },
                  "source": {
                    "type": "object",
                    "properties": {
                      "live": {
                        "type": "object",
                        "properties": {
                          "targets": {
                            "type": "array",
                            "items": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "traces"
                                      ]
                                    },
                                    "targetId": {
                                      "type": "null"
                                    },
                                    "samplePct": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 100,
                                      "description": "Percent of this target's eligible turns an Online evaluation grades"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "targetId",
                                    "samplePct"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "skill",
                                        "agent",
                                        "applet",
                                        "workflow"
                                      ],
                                      "description": "traces: every trace in the organization; skill, agent, applet: turns that used it; workflow: turns its classification files there"
                                    },
                                    "targetId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    },
                                    "samplePct": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 100,
                                      "description": "Percent of this target's eligible turns an Online evaluation grades"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "targetId",
                                    "samplePct"
                                  ],
                                  "additionalProperties": false
                                }
                              ],
                              "description": "A target of an Online evaluation with its sampling percent"
                            },
                            "minItems": 1,
                            "maxItems": 50,
                            "description": "What it grades, each with its percent of requests"
                          },
                          "criteria": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "llm_judge",
                                    "rule",
                                    "code",
                                    "agent"
                                  ],
                                  "description": "llm_judge, code or agent from the library; rule only for one this evaluation already binds (rules are no longer added)"
                                },
                                "criterionId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "weight": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "maximum": 1000,
                                  "description": "Relative weight beside the verifiers' own: the score divides by the weight sum"
                                }
                              },
                              "required": [
                                "kind",
                                "criterionId",
                                "weight"
                              ],
                              "additionalProperties": false
                            },
                            "maxItems": 50,
                            "default": [],
                            "description": "Every criterion it keeps or binds, by reference at its weight; with `verifiers`, at least one in all"
                          }
                        },
                        "required": [
                          "targets"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "live"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "name",
                  "expectedRevision",
                  "passMark",
                  "source"
                ],
                "additionalProperties": false
              },
              "example": {
                "name": "rest-writes refunds workflow",
                "expectedRevision": 3,
                "passMark": 0.8,
                "source": {
                  "live": {
                    "targets": [
                      {
                        "kind": "workflow",
                        "targetId": "<workflow id>",
                        "samplePct": 50
                      }
                    ],
                    "criteria": [
                      {
                        "kind": "llm_judge",
                        "criterionId": "<judge id>",
                        "weight": 1
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ref": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "monitor",
                            "benchmark"
                          ],
                          "description": "monitor: a live evaluation grading real requests; benchmark: a test-set evaluation checked against known answers"
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      },
                      "required": [
                        "kind",
                        "id"
                      ],
                      "additionalProperties": false
                    },
                    "orgId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "live"
                              ]
                            }
                          },
                          "required": [
                            "kind"
                          ],
                          "additionalProperties": false,
                          "description": "Grades a sample of real requests as they finish; each target's percent is on the target"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "test_set"
                              ]
                            },
                            "datasetIds": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "description": "The test sets each run answers, in link order"
                            }
                          },
                          "required": [
                            "kind",
                            "datasetIds"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "passMark": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "minimum": 0,
                      "maximum": 1,
                      "description": "A row passes at or above this 0..1 score; null when the evaluation states none"
                    },
                    "enabled": {
                      "type": [
                        "boolean",
                        "null"
                      ],
                      "description": "Whether a live evaluation admits new requests; null for a test set, which runs when asked"
                    },
                    "pausedReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "payer_left",
                        "payer_over_budget",
                        "org_out_of_credits",
                        null
                      ],
                      "description": "Why the platform paused a live evaluation (its payer left, is over budget, or the organization is out of credits); null when a person paused it, it is live, or it is a test set"
                    },
                    "payerUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "The person a live evaluation's checks bill: whoever last turned it on or saved a change; null for a test set (a run bills whoever starts it)"
                    },
                    "revision": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "exclusiveMinimum": 0,
                      "description": "A live evaluation's save counter: a change names the revision it read and is refused CONFLICT when another save came first; null for a test set"
                    },
                    "targets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "traces",
                              "skill",
                              "agent",
                              "applet",
                              "workflow"
                            ],
                            "description": "traces: every trace in the organization; skill, agent, applet: turns that used it; workflow: turns its classification files there"
                          },
                          "targetId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "minLength": 1,
                            "maxLength": 200,
                            "description": "Null for traces (every trace in the organization)"
                          },
                          "samplePct": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 1,
                            "maximum": 100,
                            "description": "Percent of this target's requests a live evaluation grades; null on a test set"
                          }
                        },
                        "required": [
                          "kind",
                          "targetId",
                          "samplePct"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "verifierCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "verifiers": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "instructions": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                              },
                              "outputType": {
                                "type": "string",
                                "enum": [
                                  "boolean",
                                  "float",
                                  "text"
                                ],
                                "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                              },
                              "modelOverride": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1,
                                "description": "Null means use the judge model of the Evaluation that runs it"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "llm_judge"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "instructions",
                              "outputType",
                              "modelOverride",
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "instructions": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                              },
                              "outputType": {
                                "type": "string",
                                "enum": [
                                  "boolean",
                                  "float",
                                  "text"
                                ],
                                "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                              },
                              "modelOverride": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1,
                                "description": "Null means use the judge model of the Evaluation that runs it"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "agent_judge"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "instructions",
                              "outputType",
                              "modelOverride",
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "exact_match"
                                ]
                              },
                              "comparison": {
                                "type": "string",
                                "enum": [
                                  "text_identical",
                                  "contains",
                                  "not_contains",
                                  "tool_called"
                                ],
                                "description": "text_identical: the output equals the expected text exactly, including case, whitespace and Unicode code points. contains / not_contains: the output holds `value` anywhere, or nowhere. tool_called: the agent called the tool named `value`"
                              },
                              "value": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000,
                                "description": "The text contains / not_contains look for, or the tool name tool_called looks for; text_identical takes none"
                              },
                              "ignoreCase": {
                                "type": "boolean",
                                "description": "contains / not_contains only: compare without regard to upper and lower case"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "comparison"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "code_verifier"
                                ]
                              },
                              "contractVersion": {
                                "type": "number",
                                "enum": [
                                  1
                                ]
                              },
                              "code": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Python defining verify(task, output) and returning a Verdict; the SDK and a working example: `context-cli evals describe verifier-sdk`. It imports the standard library, the context_verifiers SDK and the curated packages (`context-cli evals describe verifier-packages`); a save naming anything else is refused, as the runner refuses it. A criterion holds at most 512 KiB of code, and one dataset's or one task's Python criteria 4 MiB together."
                              },
                              "passMark": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1,
                                "description": "Present: a float verdict passes at or above this 0..1 mark (Monitoring's Python criteria). Absent: a float verdict counts as its raw score"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "contractVersion",
                              "code"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "rule"
                                ]
                              },
                              "rule": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "contains",
                                          "not_contains",
                                          "starts_with",
                                          "ends_with",
                                          "equals"
                                        ],
                                        "description": "contains / does not contain anywhere; starts with, ends with and is exactly ignore spaces and line breaks around the text"
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "value": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2000
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "value",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "matches",
                                          "not_matches"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "pattern": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500,
                                        "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "pattern",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "length_between"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "min": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000000,
                                        "description": "Fewest characters that pass"
                                      },
                                      "max": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000000,
                                        "description": "Most characters that pass"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "min",
                                      "max"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "valid_json"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The whole text parses as JSON"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "matches_json_schema"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "schema": {
                                        "type": "object",
                                        "additionalProperties": {},
                                        "description": "A JSON Schema (draft 7 keywords) the text, parsed as JSON, must satisfy; unknown keywords, formats and references ($ref) are refused at save"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "schema"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_called",
                                          "tool_not_called"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_argument_matches"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      },
                                      "argument": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The argument's name, for example query"
                                      },
                                      "pattern": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500,
                                        "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool",
                                      "argument",
                                      "pattern",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Some call of the tool had this argument matching the pattern"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_call_count"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      },
                                      "min": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Fewest calls that pass"
                                      },
                                      "max": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Most calls that pass"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool",
                                      "min",
                                      "max"
                                    ],
                                    "additionalProperties": false
                                  }
                                ],
                                "description": "A Monitoring rule, verbatim: every operator and target it has, decided by the rule grader (../monitor/rule-grade)"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "rule"
                            ],
                            "additionalProperties": false
                          }
                        ],
                        "description": "A bespoke verifier owned by a dataset or one dataset task; not a shared library reference"
                      },
                      "description": "The evaluation's own verifiers in order (a test set's datasets and rows may add checks of their own)"
                    },
                    "test": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "axes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "model"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A model the held agent runs"
                                  },
                                  "minItems": 1,
                                  "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false,
                                            "description": "A skill, at its newest version (no version given) or a pinned version number"
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every model runs on, and the skills it runs with"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Model: one agent and its skills are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "skill"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "skill"
                                            ]
                                          },
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A skill the held agent runs with, at its newest version or a pinned one"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "no_skill"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false,
                                        "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                      }
                                    ]
                                  },
                                  "minItems": 1,
                                  "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "model"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every skill runs on, and the model it runs"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Skill: one agent and its model are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "agent"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent"
                                        ]
                                      },
                                      "agentId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "An agent in the evaluation's organization"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "agentId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "An agent"
                                  },
                                  "minItems": 1,
                                  "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false,
                                            "description": "A skill, at its newest version (no version given) or a pinned version number"
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "model",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The model every agent runs (one they can all run, or each agent's own default), and the skills they run with"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Agent: the model and the skills are held fixed"
                            }
                          ],
                          "description": "The question an Evaluation asks: the ONE axis it tests, the values it compares, and what it holds for the other two axes"
                        },
                        "judgeModel": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "axes",
                        "judgeModel"
                      ],
                      "additionalProperties": false,
                      "description": "A test set's question (what each run varies and holds) and its default judge model; null when live"
                    },
                    "webUrl": {
                      "type": "string",
                      "description": "The evaluation's page, /client/evals/evaluation/<monitor|benchmark>/<id> on the org's public origin (the one share links carry). Absent from a server older than the field"
                    }
                  },
                  "required": [
                    "ref",
                    "orgId",
                    "name",
                    "description",
                    "source",
                    "passMark",
                    "enabled",
                    "pausedReason",
                    "payerUserId",
                    "revision",
                    "targets",
                    "verifierCount",
                    "createdAt",
                    "updatedAt",
                    "verifiers",
                    "test"
                  ],
                  "additionalProperties": false,
                  "description": "One evaluation, live or test set, in one shape"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "evaluation.update",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body -X PUT \"$CONTEXT_APP_ORIGIN/api/v1/evals/monitors/$MONITOR_ID\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary @- <<'JSON'\n{\n  \"name\": \"rest-writes refunds workflow\",\n  \"expectedRevision\": 3,\n  \"passMark\": 0.8,\n  \"source\": {\n    \"live\": {\n      \"targets\": [\n        {\n          \"kind\": \"workflow\",\n          \"targetId\": \"<workflow id>\",\n          \"samplePct\": 50\n        }\n      ],\n      \"criteria\": [\n        {\n          \"kind\": \"llm_judge\",\n          \"criterionId\": \"<judge id>\",\n          \"weight\": 1\n        }\n      ]\n    }\n  }\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nmonitor_id = os.environ[\"MONITOR_ID\"]\n\nresp = requests.put(\n    f\"{origin}/api/v1/evals/monitors/{monitor_id}\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    json={\n        \"name\": \"rest-writes refunds workflow\",\n        \"expectedRevision\": 3,\n        \"passMark\": 0.8,\n        \"source\": {\n            \"live\": {\n                \"targets\": [\n                    {\n                        \"kind\": \"workflow\",\n                        \"targetId\": \"<workflow id>\",\n                        \"samplePct\": 50\n                    }\n                ],\n                \"criteria\": [\n                    {\n                        \"kind\": \"llm_judge\",\n                        \"criterionId\": \"<judge id>\",\n                        \"weight\": 1\n                    }\n                ]\n            }\n        }\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/monitors/${encodeURIComponent(env(\"MONITOR_ID\"))}`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"name\": \"rest-writes refunds workflow\",\n  \"expectedRevision\": 3,\n  \"passMark\": 0.8,\n  \"source\": {\n    \"live\": {\n      \"targets\": [\n        {\n          \"kind\": \"workflow\",\n          \"targetId\": \"<workflow id>\",\n          \"samplePct\": 50\n        }\n      ],\n      \"criteria\": [\n        {\n          \"kind\": \"llm_judge\",\n          \"criterionId\": \"<judge id>\",\n          \"weight\": 1\n        }\n      ]\n    }\n  }\n}\nconst res = await fetch(url, {\n  method: \"PUT\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/monitors/{monitorId}/enable": {
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Resume a monitor",
        "description": "Resumes grading under the `expectedRevision` you read. Resuming makes you the person it charges.",
        "operationId": "enableMonitor",
        "parameters": [
          {
            "in": "path",
            "name": "monitorId",
            "required": true,
            "description": "Monitor identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Monitor (from the path)"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedRevision": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "description": "Configuration revision for optimistic concurrency"
                  }
                },
                "required": [
                  "expectedRevision"
                ],
                "additionalProperties": false
              },
              "example": {
                "expectedRevision": 3
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ref": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "monitor",
                            "benchmark"
                          ],
                          "description": "monitor: a live evaluation grading real requests; benchmark: a test-set evaluation checked against known answers"
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      },
                      "required": [
                        "kind",
                        "id"
                      ],
                      "additionalProperties": false
                    },
                    "orgId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "live"
                              ]
                            }
                          },
                          "required": [
                            "kind"
                          ],
                          "additionalProperties": false,
                          "description": "Grades a sample of real requests as they finish; each target's percent is on the target"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "test_set"
                              ]
                            },
                            "datasetIds": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "description": "The test sets each run answers, in link order"
                            }
                          },
                          "required": [
                            "kind",
                            "datasetIds"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "passMark": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "minimum": 0,
                      "maximum": 1,
                      "description": "A row passes at or above this 0..1 score; null when the evaluation states none"
                    },
                    "enabled": {
                      "type": [
                        "boolean",
                        "null"
                      ],
                      "description": "Whether a live evaluation admits new requests; null for a test set, which runs when asked"
                    },
                    "pausedReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "payer_left",
                        "payer_over_budget",
                        "org_out_of_credits",
                        null
                      ],
                      "description": "Why the platform paused a live evaluation (its payer left, is over budget, or the organization is out of credits); null when a person paused it, it is live, or it is a test set"
                    },
                    "payerUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "The person a live evaluation's checks bill: whoever last turned it on or saved a change; null for a test set (a run bills whoever starts it)"
                    },
                    "revision": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "exclusiveMinimum": 0,
                      "description": "A live evaluation's save counter: a change names the revision it read and is refused CONFLICT when another save came first; null for a test set"
                    },
                    "targets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "traces",
                              "skill",
                              "agent",
                              "applet",
                              "workflow"
                            ],
                            "description": "traces: every trace in the organization; skill, agent, applet: turns that used it; workflow: turns its classification files there"
                          },
                          "targetId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "minLength": 1,
                            "maxLength": 200,
                            "description": "Null for traces (every trace in the organization)"
                          },
                          "samplePct": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 1,
                            "maximum": 100,
                            "description": "Percent of this target's requests a live evaluation grades; null on a test set"
                          }
                        },
                        "required": [
                          "kind",
                          "targetId",
                          "samplePct"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "verifierCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "verifiers": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "instructions": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                              },
                              "outputType": {
                                "type": "string",
                                "enum": [
                                  "boolean",
                                  "float",
                                  "text"
                                ],
                                "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                              },
                              "modelOverride": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1,
                                "description": "Null means use the judge model of the Evaluation that runs it"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "llm_judge"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "instructions",
                              "outputType",
                              "modelOverride",
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "instructions": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                              },
                              "outputType": {
                                "type": "string",
                                "enum": [
                                  "boolean",
                                  "float",
                                  "text"
                                ],
                                "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                              },
                              "modelOverride": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1,
                                "description": "Null means use the judge model of the Evaluation that runs it"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "agent_judge"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "instructions",
                              "outputType",
                              "modelOverride",
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "exact_match"
                                ]
                              },
                              "comparison": {
                                "type": "string",
                                "enum": [
                                  "text_identical",
                                  "contains",
                                  "not_contains",
                                  "tool_called"
                                ],
                                "description": "text_identical: the output equals the expected text exactly, including case, whitespace and Unicode code points. contains / not_contains: the output holds `value` anywhere, or nowhere. tool_called: the agent called the tool named `value`"
                              },
                              "value": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000,
                                "description": "The text contains / not_contains look for, or the tool name tool_called looks for; text_identical takes none"
                              },
                              "ignoreCase": {
                                "type": "boolean",
                                "description": "contains / not_contains only: compare without regard to upper and lower case"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "comparison"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "code_verifier"
                                ]
                              },
                              "contractVersion": {
                                "type": "number",
                                "enum": [
                                  1
                                ]
                              },
                              "code": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Python defining verify(task, output) and returning a Verdict; the SDK and a working example: `context-cli evals describe verifier-sdk`. It imports the standard library, the context_verifiers SDK and the curated packages (`context-cli evals describe verifier-packages`); a save naming anything else is refused, as the runner refuses it. A criterion holds at most 512 KiB of code, and one dataset's or one task's Python criteria 4 MiB together."
                              },
                              "passMark": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1,
                                "description": "Present: a float verdict passes at or above this 0..1 mark (Monitoring's Python criteria). Absent: a float verdict counts as its raw score"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "contractVersion",
                              "code"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "rule"
                                ]
                              },
                              "rule": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "contains",
                                          "not_contains",
                                          "starts_with",
                                          "ends_with",
                                          "equals"
                                        ],
                                        "description": "contains / does not contain anywhere; starts with, ends with and is exactly ignore spaces and line breaks around the text"
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "value": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2000
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "value",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "matches",
                                          "not_matches"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "pattern": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500,
                                        "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "pattern",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "length_between"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "min": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000000,
                                        "description": "Fewest characters that pass"
                                      },
                                      "max": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000000,
                                        "description": "Most characters that pass"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "min",
                                      "max"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "valid_json"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The whole text parses as JSON"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "matches_json_schema"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "schema": {
                                        "type": "object",
                                        "additionalProperties": {},
                                        "description": "A JSON Schema (draft 7 keywords) the text, parsed as JSON, must satisfy; unknown keywords, formats and references ($ref) are refused at save"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "schema"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_called",
                                          "tool_not_called"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_argument_matches"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      },
                                      "argument": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The argument's name, for example query"
                                      },
                                      "pattern": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500,
                                        "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool",
                                      "argument",
                                      "pattern",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Some call of the tool had this argument matching the pattern"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_call_count"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      },
                                      "min": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Fewest calls that pass"
                                      },
                                      "max": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Most calls that pass"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool",
                                      "min",
                                      "max"
                                    ],
                                    "additionalProperties": false
                                  }
                                ],
                                "description": "A Monitoring rule, verbatim: every operator and target it has, decided by the rule grader (../monitor/rule-grade)"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "rule"
                            ],
                            "additionalProperties": false
                          }
                        ],
                        "description": "A bespoke verifier owned by a dataset or one dataset task; not a shared library reference"
                      },
                      "description": "The evaluation's own verifiers in order (a test set's datasets and rows may add checks of their own)"
                    },
                    "test": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "axes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "model"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A model the held agent runs"
                                  },
                                  "minItems": 1,
                                  "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false,
                                            "description": "A skill, at its newest version (no version given) or a pinned version number"
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every model runs on, and the skills it runs with"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Model: one agent and its skills are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "skill"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "skill"
                                            ]
                                          },
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A skill the held agent runs with, at its newest version or a pinned one"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "no_skill"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false,
                                        "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                      }
                                    ]
                                  },
                                  "minItems": 1,
                                  "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "model"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every skill runs on, and the model it runs"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Skill: one agent and its model are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "agent"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent"
                                        ]
                                      },
                                      "agentId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "An agent in the evaluation's organization"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "agentId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "An agent"
                                  },
                                  "minItems": 1,
                                  "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false,
                                            "description": "A skill, at its newest version (no version given) or a pinned version number"
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "model",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The model every agent runs (one they can all run, or each agent's own default), and the skills they run with"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Agent: the model and the skills are held fixed"
                            }
                          ],
                          "description": "The question an Evaluation asks: the ONE axis it tests, the values it compares, and what it holds for the other two axes"
                        },
                        "judgeModel": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "axes",
                        "judgeModel"
                      ],
                      "additionalProperties": false,
                      "description": "A test set's question (what each run varies and holds) and its default judge model; null when live"
                    },
                    "webUrl": {
                      "type": "string",
                      "description": "The evaluation's page, /client/evals/evaluation/<monitor|benchmark>/<id> on the org's public origin (the one share links carry). Absent from a server older than the field"
                    }
                  },
                  "required": [
                    "ref",
                    "orgId",
                    "name",
                    "description",
                    "source",
                    "passMark",
                    "enabled",
                    "pausedReason",
                    "payerUserId",
                    "revision",
                    "targets",
                    "verifierCount",
                    "createdAt",
                    "updatedAt",
                    "verifiers",
                    "test"
                  ],
                  "additionalProperties": false,
                  "description": "One evaluation, live or test set, in one shape"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "evaluation.setEnabled",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body -X POST \"$CONTEXT_APP_ORIGIN/api/v1/evals/monitors/$MONITOR_ID/enable\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary @- <<'JSON'\n{\n  \"expectedRevision\": 3\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nmonitor_id = os.environ[\"MONITOR_ID\"]\n\nresp = requests.post(\n    f\"{origin}/api/v1/evals/monitors/{monitor_id}/enable\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    json={\n        \"expectedRevision\": 3\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/monitors/${encodeURIComponent(env(\"MONITOR_ID\"))}/enable`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"expectedRevision\": 3\n}\nconst res = await fetch(url, {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/monitors/{monitorId}/disable": {
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Pause a monitor",
        "description": "Stops grading new requests under the `expectedRevision` you read; its results stay.",
        "operationId": "disableMonitor",
        "parameters": [
          {
            "in": "path",
            "name": "monitorId",
            "required": true,
            "description": "Monitor identifier",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Monitor (from the path)"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedRevision": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "description": "Configuration revision for optimistic concurrency"
                  }
                },
                "required": [
                  "expectedRevision"
                ],
                "additionalProperties": false
              },
              "example": {
                "expectedRevision": 3
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ref": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "monitor",
                            "benchmark"
                          ],
                          "description": "monitor: a live evaluation grading real requests; benchmark: a test-set evaluation checked against known answers"
                        },
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      },
                      "required": [
                        "kind",
                        "id"
                      ],
                      "additionalProperties": false
                    },
                    "orgId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "live"
                              ]
                            }
                          },
                          "required": [
                            "kind"
                          ],
                          "additionalProperties": false,
                          "description": "Grades a sample of real requests as they finish; each target's percent is on the target"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "test_set"
                              ]
                            },
                            "datasetIds": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "description": "The test sets each run answers, in link order"
                            }
                          },
                          "required": [
                            "kind",
                            "datasetIds"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "passMark": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "minimum": 0,
                      "maximum": 1,
                      "description": "A row passes at or above this 0..1 score; null when the evaluation states none"
                    },
                    "enabled": {
                      "type": [
                        "boolean",
                        "null"
                      ],
                      "description": "Whether a live evaluation admits new requests; null for a test set, which runs when asked"
                    },
                    "pausedReason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "payer_left",
                        "payer_over_budget",
                        "org_out_of_credits",
                        null
                      ],
                      "description": "Why the platform paused a live evaluation (its payer left, is over budget, or the organization is out of credits); null when a person paused it, it is live, or it is a test set"
                    },
                    "payerUserId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "The person a live evaluation's checks bill: whoever last turned it on or saved a change; null for a test set (a run bills whoever starts it)"
                    },
                    "revision": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "exclusiveMinimum": 0,
                      "description": "A live evaluation's save counter: a change names the revision it read and is refused CONFLICT when another save came first; null for a test set"
                    },
                    "targets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "traces",
                              "skill",
                              "agent",
                              "applet",
                              "workflow"
                            ],
                            "description": "traces: every trace in the organization; skill, agent, applet: turns that used it; workflow: turns its classification files there"
                          },
                          "targetId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "minLength": 1,
                            "maxLength": 200,
                            "description": "Null for traces (every trace in the organization)"
                          },
                          "samplePct": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 1,
                            "maximum": 100,
                            "description": "Percent of this target's requests a live evaluation grades; null on a test set"
                          }
                        },
                        "required": [
                          "kind",
                          "targetId",
                          "samplePct"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "verifierCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "verifiers": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "instructions": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                              },
                              "outputType": {
                                "type": "string",
                                "enum": [
                                  "boolean",
                                  "float",
                                  "text"
                                ],
                                "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                              },
                              "modelOverride": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1,
                                "description": "Null means use the judge model of the Evaluation that runs it"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "llm_judge"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "instructions",
                              "outputType",
                              "modelOverride",
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "instructions": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "The judge prompt; template variables such as {{criterion}}, {{output}} and {{expected_output}} are filled at grading time (prompt-template.ts)"
                              },
                              "outputType": {
                                "type": "string",
                                "enum": [
                                  "boolean",
                                  "float",
                                  "text"
                                ],
                                "description": "boolean: Pass or Fail; float: a 0..1 score; text: notes only, which never yield a verdict and are left out of the score"
                              },
                              "modelOverride": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "minLength": 1,
                                "description": "Null means use the judge model of the Evaluation that runs it"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "agent_judge"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "instructions",
                              "outputType",
                              "modelOverride",
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "exact_match"
                                ]
                              },
                              "comparison": {
                                "type": "string",
                                "enum": [
                                  "text_identical",
                                  "contains",
                                  "not_contains",
                                  "tool_called"
                                ],
                                "description": "text_identical: the output equals the expected text exactly, including case, whitespace and Unicode code points. contains / not_contains: the output holds `value` anywhere, or nowhere. tool_called: the agent called the tool named `value`"
                              },
                              "value": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000,
                                "description": "The text contains / not_contains look for, or the tool name tool_called looks for; text_identical takes none"
                              },
                              "ignoreCase": {
                                "type": "boolean",
                                "description": "contains / not_contains only: compare without regard to upper and lower case"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "comparison"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "code_verifier"
                                ]
                              },
                              "contractVersion": {
                                "type": "number",
                                "enum": [
                                  1
                                ]
                              },
                              "code": {
                                "type": "string",
                                "minLength": 1,
                                "description": "Python defining verify(task, output) and returning a Verdict; the SDK and a working example: `context-cli evals describe verifier-sdk`. It imports the standard library, the context_verifiers SDK and the curated packages (`context-cli evals describe verifier-packages`); a save naming anything else is refused, as the runner refuses it. A criterion holds at most 512 KiB of code, and one dataset's or one task's Python criteria 4 MiB together."
                              },
                              "passMark": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1,
                                "description": "Present: a float verdict passes at or above this 0..1 mark (Monitoring's Python criteria). Absent: a float verdict counts as its raw score"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "contractVersion",
                              "code"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128,
                                "description": "Stable identifier within the owning dataset or dataset task"
                              },
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "The criterion: what should be true of the output. A model judge's prompt reads it as {{criterion}}"
                              },
                              "weight": {
                                "type": "number",
                                "exclusiveMinimum": 0,
                                "description": "Positive relative contribution among the criteria that reached a verdict; one with no verdict is left out of the score (./scoring)"
                              },
                              "description": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100000,
                                "description": "What the check is for, in words: the line a verifier list shows under its name, and the prose a .md verifier keeps beside its Python or match (./md). Never read by grading"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "rule"
                                ]
                              },
                              "rule": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "contains",
                                          "not_contains",
                                          "starts_with",
                                          "ends_with",
                                          "equals"
                                        ],
                                        "description": "contains / does not contain anywhere; starts with, ends with and is exactly ignore spaces and line breaks around the text"
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "value": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2000
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "value",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "matches",
                                          "not_matches"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "pattern": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500,
                                        "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "pattern",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "length_between"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "min": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000000,
                                        "description": "Fewest characters that pass"
                                      },
                                      "max": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000000,
                                        "description": "Most characters that pass"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "min",
                                      "max"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "valid_json"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The whole text parses as JSON"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "matches_json_schema"
                                        ]
                                      },
                                      "target": {
                                        "type": "string",
                                        "enum": [
                                          "answer",
                                          "user_message"
                                        ],
                                        "description": "The text the rule reads: the request's final answer, or the person's message"
                                      },
                                      "schema": {
                                        "type": "object",
                                        "additionalProperties": {},
                                        "description": "A JSON Schema (draft 7 keywords) the text, parsed as JSON, must satisfy; unknown keywords, formats and references ($ref) are refused at save"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "target",
                                      "schema"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_called",
                                          "tool_not_called"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_argument_matches"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      },
                                      "argument": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The argument's name, for example query"
                                      },
                                      "pattern": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500,
                                        "description": "A regular expression in RE2 syntax: no backreferences and no lookaround. A check still running after 10 seconds records an error instead of a result"
                                      },
                                      "ignoreCase": {
                                        "type": "boolean",
                                        "description": "Compare without regard to upper and lower case"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool",
                                      "argument",
                                      "pattern",
                                      "ignoreCase"
                                    ],
                                    "additionalProperties": false,
                                    "description": "Some call of the tool had this argument matching the pattern"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "operator": {
                                        "type": "string",
                                        "enum": [
                                          "tool_call_count"
                                        ]
                                      },
                                      "tool": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "The tool's name as the agent calls it, for example web_search"
                                      },
                                      "min": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Fewest calls that pass"
                                      },
                                      "max": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100000,
                                        "description": "Most calls that pass"
                                      }
                                    },
                                    "required": [
                                      "operator",
                                      "tool",
                                      "min",
                                      "max"
                                    ],
                                    "additionalProperties": false
                                  }
                                ],
                                "description": "A Monitoring rule, verbatim: every operator and target it has, decided by the rule grader (../monitor/rule-grade)"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "weight",
                              "kind",
                              "rule"
                            ],
                            "additionalProperties": false
                          }
                        ],
                        "description": "A bespoke verifier owned by a dataset or one dataset task; not a shared library reference"
                      },
                      "description": "The evaluation's own verifiers in order (a test set's datasets and rows may add checks of their own)"
                    },
                    "test": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "axes": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "model"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "model"
                                        ]
                                      },
                                      "model": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200,
                                        "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "model"
                                    ],
                                    "additionalProperties": false,
                                    "description": "A model the held agent runs"
                                  },
                                  "minItems": 1,
                                  "description": "The models to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false,
                                            "description": "A skill, at its newest version (no version given) or a pinned version number"
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every model runs on, and the skills it runs with"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Model: one agent and its skills are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "skill"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "skill"
                                            ]
                                          },
                                          "skillId": {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "skillId"
                                        ],
                                        "additionalProperties": false,
                                        "description": "A skill the held agent runs with, at its newest version or a pinned one"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "no_skill"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "kind"
                                        ],
                                        "additionalProperties": false,
                                        "description": "The held agent with no skill attached: the baseline a skill is compared against"
                                      }
                                    ]
                                  },
                                  "minItems": 1,
                                  "description": "The skills to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates (two versions of one skill count as two values)"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "agentId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An agent in the evaluation's organization"
                                    },
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    }
                                  },
                                  "required": [
                                    "agentId",
                                    "model"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The agent every skill runs on, and the model it runs"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Skill: one agent and its model are held fixed"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "testing": {
                                  "type": "string",
                                  "enum": [
                                    "agent"
                                  ]
                                },
                                "values": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "agent"
                                        ]
                                      },
                                      "agentId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "description": "An agent in the evaluation's organization"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "agentId"
                                    ],
                                    "additionalProperties": false,
                                    "description": "An agent"
                                  },
                                  "minItems": 1,
                                  "description": "The agents to run, in display order: at least 1 (one measures, two or more compare), no maximum, no duplicates"
                                },
                                "held": {
                                  "type": "object",
                                  "properties": {
                                    "model": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "agent_default"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind"
                                          ],
                                          "additionalProperties": false,
                                          "description": "Each agent runs its own default model. The model that served a task is recorded on its dispatch."
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "model"
                                              ]
                                            },
                                            "model": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200,
                                              "description": "A model as `<provider>/<model>` (with a gateway prefix or direct), at most 200 characters. Checked against the running agent's models when a run starts; a model the agent cannot run is refused then."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "model"
                                          ],
                                          "additionalProperties": false,
                                          "description": "One model that every agent in the evaluation runs"
                                        }
                                      ],
                                      "description": "The model held fixed when Model is not the tested axis"
                                    },
                                    "skills": {
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "skillId": {
                                                "type": "string",
                                                "minLength": 1,
                                                "description": "A skill in the evaluation's organization"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "description": "The skill version to run, by number. When absent, the skill's newest version runs, fixed when a run starts (shown as 'Latest')."
                                              }
                                            },
                                            "required": [
                                              "skillId"
                                            ],
                                            "additionalProperties": false,
                                            "description": "A skill, at its newest version (no version given) or a pinned version number"
                                          },
                                          {
                                            "type": "string",
                                            "minLength": 1,
                                            "description": "A skill in the evaluation's organization"
                                          }
                                        ],
                                        "description": "A skill every cell runs with, and which version. A skill ID on its own means its newest version."
                                      },
                                      "maxItems": 20,
                                      "description": "Skills every cell runs with when Skill is not the tested axis (at most 20, no duplicates, each at one version); empty for none"
                                    }
                                  },
                                  "required": [
                                    "model",
                                    "skills"
                                  ],
                                  "additionalProperties": false,
                                  "description": "The model every agent runs (one they can all run, or each agent's own default), and the skills they run with"
                                }
                              },
                              "required": [
                                "testing",
                                "values",
                                "held"
                              ],
                              "additionalProperties": false,
                              "description": "Testing Agent: the model and the skills are held fixed"
                            }
                          ],
                          "description": "The question an Evaluation asks: the ONE axis it tests, the values it compares, and what it holds for the other two axes"
                        },
                        "judgeModel": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "axes",
                        "judgeModel"
                      ],
                      "additionalProperties": false,
                      "description": "A test set's question (what each run varies and holds) and its default judge model; null when live"
                    },
                    "webUrl": {
                      "type": "string",
                      "description": "The evaluation's page, /client/evals/evaluation/<monitor|benchmark>/<id> on the org's public origin (the one share links carry). Absent from a server older than the field"
                    }
                  },
                  "required": [
                    "ref",
                    "orgId",
                    "name",
                    "description",
                    "source",
                    "passMark",
                    "enabled",
                    "pausedReason",
                    "payerUserId",
                    "revision",
                    "targets",
                    "verifierCount",
                    "createdAt",
                    "updatedAt",
                    "verifiers",
                    "test"
                  ],
                  "additionalProperties": false,
                  "description": "One evaluation, live or test set, in one shape"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner can't make this change in the app (for example a member without Evals access, or a record only its owner or an admin can change). The refusal is the same one the app gives that person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: someone saved since you read it (a monitor's revision, a dataset's version), or a request with this `Idempotency-Key` is still running (one that never finished frees its key after 10 minutes). `code` names which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "A precondition of the change failed (`error` says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 1 MiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "The body is not JSON (`Content-Type: application/json`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "evaluation.setEnabled",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body -X POST \"$CONTEXT_APP_ORIGIN/api/v1/evals/monitors/$MONITOR_ID/disable\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  -H 'Content-Type: application/json' \\\n  --data-binary @- <<'JSON'\n{\n  \"expectedRevision\": 3\n}\nJSON"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\nmonitor_id = os.environ[\"MONITOR_ID\"]\n\nresp = requests.post(\n    f\"{origin}/api/v1/evals/monitors/{monitor_id}/disable\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    json={\n        \"expectedRevision\": 3\n    },\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/monitors/${encodeURIComponent(env(\"MONITOR_ID\"))}/disable`, env(\"CONTEXT_APP_ORIGIN\"))\nconst body = {\n  \"expectedRevision\": 3\n}\nconst res = await fetch(url, {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify(body),\n})\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/targets": {
      "get": {
        "tags": [
          "Targets"
        ],
        "summary": "List targets",
        "description": "The organization's live agents, skills or applets (`kind`), by name: exactly what a monitor or an Evaluation accepts as a target. Workflows are `GET /targets/workflows`.",
        "operationId": "listTargets",
        "parameters": [
          {
            "in": "query",
            "name": "workspaceScope",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "all"
                      ]
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false,
                  "description": "Every workspace in the organization plus the organization-wide rows; organization admins only"
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "one"
                      ]
                    },
                    "workspaceId": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The workspace the request is about"
                    }
                  },
                  "required": [
                    "kind",
                    "workspaceId"
                  ],
                  "additionalProperties": false,
                  "description": "One workspace: its rows plus the organization-wide ones"
                }
              ],
              "description": "Which workspace to read. When omitted: every workspace for an organization admin; your one workspace if your Evals access covers exactly one; otherwise 403 asking you to name a workspace."
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "agent",
                "skill",
                "applet"
              ],
              "description": "Which kind of target to list; workflows are monitor.listWorkflows, and traces has no id"
            }
          },
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200,
              "description": "Case-insensitive substring of the name"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500,
              "description": "The nextCursor of the previous page, for the same kind and search"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "name": {
                            "type": "string"
                          },
                          "personal": {
                            "type": "boolean",
                            "description": "Belongs to one person (their assistant, a personal skill or applet)"
                          },
                          "agent": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "owner": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "person"
                                        ]
                                      },
                                      "id": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      },
                                      "name": {
                                        "type": [
                                          "string",
                                          "null"
                                        ],
                                        "description": "Null when the owner is no longer a user"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "team"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ],
                                    "additionalProperties": false
                                  }
                                ],
                                "description": "person: the agent belongs to this person; team: no person owns it"
                              },
                              "avatarSource": {
                                "type": "string",
                                "enum": [
                                  "generated",
                                  "photo"
                                ]
                              },
                              "avatarStoragePath": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "owner",
                              "avatarSource",
                              "avatarStoragePath"
                            ],
                            "additionalProperties": false,
                            "description": "An agent's owner and face, so two agents with like names can be told apart; null for a skill or applet"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "personal",
                          "agent"
                        ],
                        "additionalProperties": false
                      },
                      "description": "The live agents, skills or applets of the organization, by name: exactly what an evaluation accepts as a target"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Set while more remain: pass it back, or narrow by searching"
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` (code `TASK_CAPABILITY_MISSING`); or the key's owner can't read this in the app; or the key is limited to specific agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:read",
        "x-runs-procedure": "evaluation.listTargets",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/targets\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode 'kind=agent' \\\n  --data-urlencode 'limit=50'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/targets\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"kind\": \"agent\", \"limit\": 50},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/targets`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"kind\", \"agent\")\nurl.searchParams.set(\"limit\", \"50\")\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    },
    "/targets/workflows": {
      "get": {
        "tags": [
          "Targets"
        ],
        "summary": "List workflow targets",
        "description": "The organization's active workflows, by id order: what a monitor or an Evaluation accepts as a `workflow` target. Needs Workflows on for the organization, and, as the app's Workflows pages do, a key with `evals:write` whose owner is an organization owner or admin.",
        "operationId": "listWorkflowTargets",
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200,
              "default": ""
            }
          },
          {
            "in": "query",
            "name": "after",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ],
              "minLength": 1,
              "maxLength": 200,
              "default": null
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "items",
                    "nextCursor"
                  ],
                  "additionalProperties": false,
                  "description": "Bounded workflow picker projection; the topic domain remains its lifecycle owner"
                }
              }
            }
          },
          "400": {
            "description": "A field is missing or invalid, an unknown field (including `orgId`) was sent, or the change is refused as invalid (`error` says why; `code` names it when the app has one)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, unknown, revoked or expired, or the secret is wrong: `{\"error\":\"Unauthorized\"}`. A request signed in some other way (a browser session, a `ctx_` key) gets `{\"error\":\"Task API key required (Authorization: Bearer tsk_...)\"}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Refused: the key lacks `evals:read` or `evals:write` (code `TASK_CAPABILITY_MISSING`); the app asks `evals:write` for every Workflows page read. Or the key is limited to specific agents (code `evals_key_agent_scoped`); or the key's owner is not an organization owner or admin, as the app's Workflows pages require.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The key went over its request rate",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before sending again",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimited"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-capability": "evals:write",
        "x-runs-procedure": "monitor.listWorkflows",
        "x-codeSamples": [
          {
            "lang": "shell",
            "label": "cURL",
            "source": "#!/usr/bin/env bash\nset -euo pipefail\ncurl -sS --fail-with-body --get \"$CONTEXT_APP_ORIGIN/api/v1/evals/targets/workflows\" \\\n  -H \"Authorization: Bearer $CONTEXT_API_KEY\" \\\n  --data-urlencode 'limit=50'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import json\nimport os\n\nimport requests\n\norigin = os.environ[\"CONTEXT_APP_ORIGIN\"]\napi_key = os.environ[\"CONTEXT_API_KEY\"]\n\nresp = requests.get(\n    f\"{origin}/api/v1/evals/targets/workflows\",\n    headers={\"Authorization\": f\"Bearer {api_key}\"},\n    params={\"limit\": 50},\n    timeout=60,\n)\nresp.raise_for_status()\nprint(json.dumps(resp.json(), indent=2))"
          },
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "function env(name: string): string {\n  const value = process.env[name]\n  if (!value) throw new Error(`Set ${name} first`)\n  return value\n}\n\nconst url = new URL(`/api/v1/evals/targets/workflows`, env(\"CONTEXT_APP_ORIGIN\"))\nurl.searchParams.set(\"limit\", \"50\")\nconst res = await fetch(url, { headers: { Authorization: `Bearer ${env(\"CONTEXT_API_KEY\")}` } })\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`)\nconsole.log(JSON.stringify(await res.json(), null, 2))"
          }
        ]
      }
    }
  }
}
