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

# Tasks

> Individual test cases within benchmarks.

Tasks are individual test cases within a [Benchmark](/api-reference/resources/benchmarks). Each task references a set of [Criteria](/api-reference/resources/criteria) that the verification engine runs after the rollout to score the task.

## Endpoints

| Method   | Endpoint                             | Description                                  |
| -------- | ------------------------------------ | -------------------------------------------- |
| `GET`    | `/tasks?benchmark_id={benchmark_id}` | List tasks for a benchmark                   |
| `POST`   | `/tasks`                             | Create a task                                |
| `GET`    | `/tasks/{id}`                        | Get task details (includes `criteria` array) |
| `PATCH`  | `/tasks/{id}`                        | Update a task                                |
| `DELETE` | `/tasks/{id}`                        | Delete a task                                |
| `GET`    | `/tasks/{id}/entities`               | List DatasetEntities bound to the task       |
| `POST`   | `/tasks/{id}/entities`               | Bind a DatasetEntity to the task             |
| `DELETE` | `/tasks/{id}/entities/{entityId}`    | Unbind a DatasetEntity                       |

## Task Object

| Field          | Type           | Description                                                                 |
| -------------- | -------------- | --------------------------------------------------------------------------- |
| `id`           | string         | Unique identifier                                                           |
| `benchmark_id` | string         | Parent [Benchmark](/api-reference/resources/benchmarks)                     |
| `name`         | string         | Task name                                                                   |
| `timeout`      | number \| null | Task-level timeout override in seconds                                      |
| `tags`         | string\[]      | Tags for filtering                                                          |
| `task_item`    | object \| null | Structured task payload (for example instruction, trigger, expected inputs) |
| `scenario`     | object \| null | Optional pre-rollout scenario steps run by the scenario runner              |
| `created_at`   | datetime       | Creation timestamp                                                          |

The `GET /tasks/{id}` response also returns a `criteria` array. Each entry has `id`, `task_id`, `label`, `assertion`, `weight`, and `created_at`. See [Criteria](/api-reference/resources/criteria) for the `assertion` shape.

## SDK Example

```typescript theme={null}
// Create a task
const task = await verial.tasks.create({
  benchmarkId: "bench_abc123",
  name: "Submit Prior Auth for MRI",
  taskItem: {
    instruction: "Submit a prior authorization for an MRI of the lumbar spine",
  },
  tags: ["prior-auth", "imaging"],
});

// Attach criteria (see Criteria resource)
await verial.criteria.create({
  taskId: task.id,
  label: "Prior auth submitted",
  weight: 1.0,
  assertion: {
    assert: "portal-state-match",
    correlate_by: { resource: "prior_auth_requests", key: "request_id" },
    assertions: [{ path: "status", expected: "submitted" }],
  },
});

// List tasks for a benchmark
const tasks = await verial.tasks.list({ benchmarkId: "bench_abc123" });

// Get a specific task with its criteria
const details = await verial.tasks.get({ id: task.id });
```
