Configurable Layout (batch_items)

View as MarkdownOpen in Claude

The batch_items field lets you control exactly how content is arranged on the participant task screen. Instead of a fixed, sequential layout, you describe your task as a set of pages, rows, and columns, and place dataset stimuli, display content, and input questions wherever you want them.

This unlocks layouts such as side-by-side evaluations, mixed display and input blocks, and multi-column comparisons — all defined declaratively when you create or update a Batch.

Configurable layout is available for AI Task Builder Batches only (not Collections or Survey Builder), and is set up via the API. dataset_field items require a V4 dataset with a schema — see Defining a Dataset Schema.

When to use batch_items

ApproachBehaviour
Batch without batch_itemsLegacy mode. Instructions are created separately via the POST /instructions endpoint and displayed sequentially alongside each datapoint.
Batch with batch_itemsConfigurable layout. You control the position of every stimulus, content block, and input, and instructions are defined inline within the layout.

When batch_items is set, instructions are defined inline within the layout rather than through the standalone instructions endpoint — giving you full control over where they appear relative to dataset stimuli and display content. See Relationship to the standalone instructions endpoint.

Structure

batch_items is a four-level nested structure:

batch_items = Page[]
Page = { display_position?: "intro" | "outro" | "body", rows: Row[] }
Row = { columns: Column[] } // 1–2 columns
Column = { items: ColumnItem[] }
  • A page repeats once per dataset row by default. Set display_position to "intro" or "outro" to render a page once instead — see Intro and outro pages below. For the current single-task Batch use case, batch_items typically contains a single repeating page, optionally preceded or followed by an intro/outro page.
  • A row stacks vertically down the screen.
  • A column sits horizontally within a row (maximum 2 per row).
  • An item is a single component rendered top-to-bottom within its column.

Intro and outro pages (display_position)

By default, every page in batch_items repeats once per dataset row (datapoint). Set a page’s display_position to render it once instead — before or after the repeating pages:

ValueBehaviour
"intro"Renders once, before the repeating pages.
"outro"Renders once, after the repeating pages.
"body" (default)Repeats once per datapoint. Equivalent to omitting display_position.
1{
2 "display_position": "intro",
3 "rows": [
4 {
5 "columns": [
6 {
7 "items": [
8 { "type": "rich_text", "content": "<p>Welcome! Please review each response carefully before answering.</p>" }
9 ]
10 }
11 ]
12 }
13 ]
14}

Pages with display_position set to "intro" or "outro" may only contain rich_text or image content blocks. They have no per-datapoint data context and no participant response is recorded against them, so dataset_field items and instruction items (free_text, multiple_choice, multiple_choice_with_free_text, free_text_with_unit, file_upload) are rejected on intro/outro pages.

Column item types

Each item in a column is a tagged object discriminated by its type field. There are three categories.

Dataset fields

Pull a value from your dataset schema into the layout.

FieldTypeRequiredDescription
typestringYes"dataset_field"
fieldstringYesThe name of a field declared in the dataset schema. Case-sensitive — must match the schema field name exactly.

Only fields typed text, image_url, audio_url, or video_url can be referenced. Fields typed metadata or task_group_id are not participant-visible and are rejected.

1{ "type": "dataset_field", "field": "response_a" }

dataset_field items support text, image, audio, and video fields. For audio_url and video_url hosting requirements and validation behaviour, see Defining a Dataset Schema.

Content blocks (display-only)

Static content defined inline. These use the same schemas as content blocks elsewhere in AI Task Builder.

rich_text

FieldTypeRequiredDescription
typestringYes"rich_text"
contentstringYesThe text to display. Supports basic HTML or Markdown.
content_formatstringNo"html" (default) or "markdown".
1{
2 "type": "rich_text",
3 "content": "<p>Rate each response for factual accuracy.</p>",
4 "content_format": "html"
5}

image

FieldTypeRequiredDescription
typestringYes"image"
urlstringYesHTTPS URL of the image to display. Must begin with https://.
alt_textstringYesAccessible alt text for the image.
captionstringNoOptional caption shown beneath the image.
1{
2 "type": "image",
3 "url": "https://example.com/reference.png",
4 "alt_text": "Reference diagram",
5 "caption": "Figure 1"
6}

Instructions (inputs)

Input questions defined inline. These use the standard AI Task Builder instruction input schemas — the same ones documented in Instructions. Supported types:

  • free_text
  • free_text_with_unit
  • multiple_choice
  • multiple_choice_with_free_text
  • file_upload
1{
2 "type": "multiple_choice",
3 "description": "Which response is more accurate?",
4 "answer_limit": 1,
5 "options": [
6 { "label": "Response A", "value": "a" },
7 { "label": "Response B", "value": "b" }
8 ]
9}

Instruction items are validated against the same input schemas used for standalone Instructions. Refer to that page for the full set of fields available on each input type.

Example: side-by-side evaluation

A comparison layout with per-column ratings and a shared free-text follow-up. The first row shows shared guidance; the second row places each image and its rating in its own column; the third row collects reasoning across the full width. Here each image is displayed with an image content block.

1{
2 "batch_items": [
3 {
4 "rows": [
5 {
6 "columns": [
7 {
8 "items": [
9 {
10 "type": "rich_text",
11 "content": "<p>Compare the two images and rate how well each one matches the prompt.</p>",
12 "content_format": "html"
13 }
14 ]
15 }
16 ]
17 },
18 {
19 "columns": [
20 {
21 "items": [
22 {
23 "type": "image",
24 "url": "https://example.com/image_a.png",
25 "alt_text": "Response A"
26 },
27 {
28 "type": "multiple_choice",
29 "answer_limit": 1,
30 "options": [
31 { "label": "Matches the prompt", "value": "match" },
32 { "label": "Does not match", "value": "no_match" }
33 ]
34 }
35 ]
36 },
37 {
38 "items": [
39 {
40 "type": "image",
41 "url": "https://example.com/image_b.png",
42 "alt_text": "Response B"
43 },
44 {
45 "type": "multiple_choice",
46 "answer_limit": 1,
47 "options": [
48 { "label": "Matches the prompt", "value": "match" },
49 { "label": "Does not match", "value": "no_match" }
50 ]
51 }
52 ]
53 }
54 ]
55 },
56 {
57 "columns": [
58 {
59 "items": [
60 {
61 "type": "free_text",
62 "helper_text": "Explain your reasoning"
63 }
64 ]
65 }
66 ]
67 }
68 ]
69 }
70 ]
71}

Setting batch_items

Provide batch_items when creating (or updating) a Batch, alongside your dataset and task details.

$POST /api/v1/data-collection/batches
1{
2 "name": "Response evaluation batch",
3 "workspace_id": "6278acb09062db3b35bcbeb0",
4 "dataset_id": "0192a3b5-e8f9-7a0b-1c2d-3e4f5a6b7c8d",
5 "task_details": {
6 "task_name": "Evaluate AI Responses"
7 },
8 "batch_items": [
9 {
10 "rows": [
11 {
12 "columns": [
13 {
14 "items": [
15 { "type": "dataset_field", "field": "prompt" }
16 ]
17 }
18 ]
19 }
20 ]
21 }
22 ]
23}

Validation runs at Batch creation and update time, before any participant-facing tasks are generated. An invalid batch_items value is rejected with a 422 response listing every offending item and its position:

1{
2 "type": "INVALID_BATCH_ITEMS",
3 "message": "batch_items validation failed",
4 "issues": [
5 {
6 "page": 0,
7 "row": 1,
8 "column": 0,
9 "item": 0,
10 "type": "dataset_field",
11 "field": "responze_a",
12 "message": "Field not found in dataset schema"
13 }
14 ]
15}

Each issue pinpoints the item by its zero-based page, row, column, and item index, along with the item type and (for dataset_field items) the offending field.

Constraints and validation

Structural

  • Maximum 2 columns per row.
  • No limit on the number of rows.
  • No limit on the number of items within a column.
  • Each page must contain at least one row; each row at least one column; each column at least one item.
  • Pages with display_position set to "intro" or "outro" may only contain rich_text/image content blocks — see Intro and outro pages above.

Dataset fields

  • field must match a field in the dataset schema with type text, image_url, audio_url, or video_url.
  • metadata and task_group_id fields are rejected — they are not participant-visible.
  • The same field may not appear more than once across a page.

Instructions and content blocks

  • Instruction items are validated against the existing instruction input schemas (the same validation applied to standalone instructions).
  • Content block items are validated against the existing content block schemas.

Relationship to the standalone instructions endpoint

There are two ways to define instructions on a Batch, and they are mutually exclusive:

  • Standalone endpoint (legacy): POST /api/v1/data-collection/batches/{batch_id}/instructions — see Working with Batches. Used when batch_items is not set.
  • Inline in batch_items: instruction items defined directly in the layout.

When batch_items is set, the inline instructions are the source of truth. The standalone instructions endpoints are deprecated for such Batches and reject create and update calls with a 422.

ScenarioBehaviour
batch_items not setLegacy mode. Define instructions via the standalone POST /instructions endpoint; they are displayed sequentially.
batch_items setInstructions are defined inline. Calls to the standalone create/update instructions endpoints return 422.
batch_items set to nullReverts to legacy mode.

The standalone instructions endpoint is deprecated for Batches that use batch_items and is scheduled for removal — manage instructions via batch_items instead. batch_items is never added automatically to existing Batches.

If the dataset schema changes after a Batch is created and a dataset_field reference becomes invalid (for example, the field is removed from the schema), this is surfaced as a warning at schema mutation time.

Extensibility

The layout model is designed to grow without breaking existing batch_items values:

  • New component types (for example additional input types or display blocks) are additive — existing layouts remain valid.
  • Multi-page tasks are supported by the array structure from the start.
  • The wider participant task model (Sections → Pages → Components) maps cleanly onto this structure: each page is a Body page, and each column item is a component.

By using AI Task Builder, you agree to our AI Task Builder Terms.