---
title: "Create Run Route"
method: POST
path: "/api/threads/{thread_id}/runs/"
tags: ["run"]
---

# Create Run Route

`POST /api/threads/{thread_id}/runs/`

Creates a new run, starting it in the background.

## Path parameters

- `thread_id` string, uuid, required

## Request body

- RunCreateInput
  - `model` 'gpt-4o'
  - `instructions` string, nullable
  - `additional_instructions` string, nullable
  - `knowledge_base_id` string, uuid, nullable
  - `context_limit` integer, nullable — The maximum number of context chunks to include.
  - `codex_access_key` string, nullable
  - `hard_coded_queries` HardCodedQuery[], nullable
    - `query` string, required
    - `response` string, required
    - `context` string[], nullable
    - `prompt` string, nullable
    - `messages` object[], nullable
  - `codex_as_cache` boolean, nullable
  - `assistant_id` string, uuid, required
  - `additional_messages` MessageCreate[]
    - `thread_id` string, uuid, required
    - `role` 'user' | 'assistant', required
    - `content` string, required
    - `metadata` MessageMetadataInput, required
      - `original_llm_response` string, nullable
      - `trustworthiness_score` number, nullable
      - `trustworthiness_explanation` string, nullable
      - `is_expert_answer` boolean, nullable
      - `is_bad_response` boolean, nullable
      - `guardrailed` boolean, nullable
      - `escalated_to_sme` boolean, nullable
      - `citations` string[], nullable
      - `scores` object, nullable

## Response `201`

Successful Response

- Run
  - `model` 'gpt-4o'
  - `instructions` string, nullable
  - `additional_instructions` string, nullable
  - `knowledge_base_id` string, uuid, nullable
  - `context_limit` integer, nullable — The maximum number of context chunks to include.
  - `codex_access_key` string, nullable
  - `hard_coded_queries` HardCodedQuery[], nullable
    - `query` string, required
    - `response` string, required
    - `context` string[], nullable
    - `prompt` string, nullable
    - `messages` object[], nullable
  - `codex_as_cache` boolean, nullable
  - `thread_id` string, uuid, required
  - `assistant_id` string, uuid, required
  - `id` string, uuid, required
  - `status` 'pending' | 'in_progress' | 'completed' | 'failed' | 'canceled' | 'expired', required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `deleted_at` string, date-time, nullable
  - `usage` RunUsage
    - `completion_tokens` integer, required
    - `prompt_tokens` integer, required
    - `total_tokens` integer, required
  - `last_error` string, nullable

## Other responses

- `422` — Validation Error

## Changes

- **2025-08-05** `9e6009a931b6` — 1 breaking, 4 warning, 9 info
  - removed `#/components/schemas/ResponseScoreMetadata-Input` from the `additional_messages/items/metadata/scores` request property `anyOf` list
  - removed the request property `response_validation_config`
  - removed the request property `tools`
  - removed the optional property `response_validation_config` from the response with the `201` status
  - …10 more
- **2025-04-15** `bb543bebe38d` — 10 info
  - the request property `additional_messages/items/metadata/scores/anyOf[subschema #1: ResponseScoreMetadata]/context_sufficiency/anyOf[subschema #1: EvalResult]/log/anyOf[subschema #1: EvalLog]/explanation` became optional
  - the request property `additional_messages/items/metadata/scores/anyOf[subschema #1: ResponseScoreMetadata]/query_ease/anyOf[subschema #1: EvalResult]/log/anyOf[subschema #1: EvalLog]/explanation` became optional
  - the request property `additional_messages/items/metadata/scores/anyOf[subschema #1: ResponseScoreMetadata]/response_groundedness/anyOf[subschema #1: EvalResult]/log/anyOf[subschema #1: EvalLog]/explanation` became optional
  - the request property `additional_messages/items/metadata/scores/anyOf[subschema #1: ResponseScoreMetadata]/response_helpfulness/anyOf[subschema #1: EvalResult]/log/anyOf[subschema #1: EvalLog]/explanation` became optional
  - …6 more
- …earlier changes not shown

[Full history](https://skmtc.dev/cleanlab/apis/agility/changes/api/threads/:thread_id/runs/post.md)

---

[API](https://skmtc.dev/cleanlab/apis/agility.md) · [All operations](https://skmtc.dev/cleanlab/apis/agility/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/cleanlab/agility/revisions/9e6009a931b6/schema)
