---
title: "POST /projects/{projectId}/agent-runs"
method: POST
path: "/projects/{projectId}/agent-runs"
---

# POST /projects/{projectId}/agent-runs

`POST /projects/{projectId}/agent-runs`

## Request

- Base URL: `https://api.caveman.so/api/v1`
- URL: `https://api.caveman.so/api/v1/projects/{projectId}/agent-runs`
- Auth: one of:
  - OAuth 2
    - Authorization code: `/api/v1/oauth/authorize`
    - Token URL: `/api/v1/oauth/token` scopes: `proposal:draft`
  - HTTP bearer
  - API key in cookie `cave_access`
  - API key in cookie `__Secure-cave_identity.session_token`

POST /api/v1/projects/{projectId}/agent-runs on the Caveman Cloud control plane. Requires the proposal:draft scope. Exposed to autonomous agents as the run_agent action of the caveman_evals_write tool (write access). Author versioned datasets, reusable evaluators and workbenches; create strict suites, ingest evidence, and run baselines. Evidence ingest supports dry_run — always dry-run first. Ask Caveman to draft quality criteria again within the drafting allowance, propose a criterion for a person to turn on, and hold the pull request that adds the Caveman check to CI. Track a criterion on a slice of traces in one step: from an agent it lands proposed, and a person turns it on. Queue units for review and label them (an agent's label is recorded as an agent's, never as human gold), and make a dataset from recorded traffic. Native user endpoint. Scoped agent sessions and workload credentials cannot call this operation. Organization budget edits additionally require billing:write. Interactive grants bind current membership and role; input, audit, run and outbox admission commit atomically. Reuse the same request identity, input and deadline on retries.

## Request body

- object
  - `parent_run_id` string, uuid
  - `request_id` string, uuid, required
  - `deadline` string, date-time
  - `fix` boolean: Ask for a repair case instead of an answer.
  - `model` string: provider/model from GET ask/models. Omitted: the parent turn's model on a follow-up, else the default.
  - `input` object, required
    - `question` string, required
    - `window` object, required
      - `from` string, date-time, required
      - `to` string, date-time, required
    - `context` object: The console page the question was asked from.

## Response `202`

Native operation persisted.

- AgentRun
  - `principal_id` string, required
  - `result_ref` string, uuid, nullable, required
  - `id` string, uuid, required
  - `organization_id` string, uuid, required
  - `project_id` string, uuid, required
  - `case_id` string, uuid, required
  - `generation` integer, required
  - `grant_id` string, uuid, nullable: Null: runs admit without a grant (ADR 0069). Set only on runs of the retired executor.
  - `grant_revision` integer, nullable
  - `definition_id` string, required
  - `definition_version` string, required
  - `definition_digest` string, required
  - `origin` 'chat' | 'pull_request' | 'trace' | 'monitor' | 'deployment' | 'scan' | 'optimization', required
  - `input_ref` string, uuid, required
  - `budget_keys` string[], required
  - `status` 'queued' | 'running' | 'completed' | 'incomplete' | 'cancelled' | 'stale', required
  - `reason` string, required
  - `deadline` string, date-time, required
  - `created_at` string, date-time, required
  - `model_id` string, nullable
  - `model_version` string, nullable
  - `model` string: The model the run was admitted on, the same as model_id; absent when the run stamped none.

## Other responses

- `400`: Invalid or missing explicit configuration/input.
- `401`: Authentication required.
- `403`: Native user lacks authority.
- `404`: Requested resource or current authority unavailable.
- `409`: Revision/input conflict or budget unavailable.
- `503`: Shared agent execution unavailable.
- `4XX`: Structured failure. `error.code` is stable; `error.request_id` is echoed in the x-cave-request-id header.
- `5XX`: Structured failure. `error.code` is stable; `error.request_id` is echoed in the x-cave-request-id header.

---

[API](https://skmtc.dev/caveman/apis/caveman-cloud-api.md) - [All operations](https://skmtc.dev/caveman/apis/caveman-cloud-api/llms.txt) - [OpenAPI document](https://skmtc.dev/caveman/apis/caveman-cloud-api/revisions/508312d01cfc?raw)
