Source: https://docs.cumuluslabs.io/reference/test_runs.estimate
Content version: 5b63dac4

# test_runs.estimate

Estimate a test run's trials, cost and duration before starting it

## Request {#request}

`POST /api/v1/test-runs/estimate`

- MCP: `test_runs_estimate`
- SDK: `client.test_runs.estimate` (SDK path arguments use `path`; MCP uses `params`).
- Minimum API key role: **viewer**.
- Idempotency: **none**.

Use the request schema below. Read IDs from earlier operation results.

## Input schema {#input-schema}

```json
{
  "parameters": [],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TestRunCreateRequest"
        }
      }
    }
  }
}
```

## Responses {#responses}

```json
{
  "200": {
    "description": "Estimate a test run's trials, cost and duration before starting it",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TestRunsEstimateResponse200"
        }
      }
    }
  },
  "4XX": {
    "description": "Typed error (ApiError)",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  },
  "5XX": {
    "description": "Typed error (ApiError)",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  }
}
```

## Referenced schemas {#schemas}

```json
{
  "components": {
    "schemas": {
      "TestRunCreateRequest": {
        "type": "object",
        "properties": {
          "agent_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
          },
          "version": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "suite_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 10
          },
          "case_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z0-9][a-z0-9_-]*$"
            },
            "minItems": 1,
            "maxItems": 100
          },
          "trials": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "baseline_test_run_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "agent_id",
          "version",
          "suite_ids"
        ],
        "additionalProperties": false
      },
      "TestRunsEstimateResponse200": {
        "type": "object",
        "properties": {
          "trials": {
            "type": "integer",
            "minimum": 0
          },
          "est_cost_usd": {
            "type": "number",
            "minimum": 0
          },
          "est_minutes": {
            "type": "number",
            "minimum": 0
          }
        },
        "required": [
          "trials",
          "est_cost_usd",
          "est_minutes"
        ],
        "additionalProperties": false
      },
      "ApiError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unauthenticated",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "invalid_request",
                  "idempotency_conflict",
                  "policy_denied",
                  "capability_unavailable",
                  "provider_unavailable",
                  "knowledge_unavailable",
                  "publication_invalid",
                  "run_not_active",
                  "rate_limited",
                  "outcome_unknown",
                  "internal"
                ]
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "none",
                  "unknown"
                ]
              },
              "details": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "required": [
              "code",
              "message",
              "retryable",
              "outcome"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      }
    }
  }
}
```

## Errors and recovery {#errors}

See [API error handling](https://docs.cumuluslabs.io/api#errors) and [Troubleshooting](https://docs.cumuluslabs.io/troubleshooting).

## Related guides {#related-guides}

- [Test an agent](https://docs.cumuluslabs.io/testing)
- [Build and test recipes](https://docs.cumuluslabs.io/recipes)
