1
---
2
name: arize-annotation
3
description: Creates and manages annotation configs (categorical, continuous, freeform label schemas) and annotation queues (human review workflows) on Arize. Applies human annotations to project spans via the Python SDK. Use when the user mentions annotation config, annotation queue, label schema, human feedback, bulk annotate spans, update_annotations, labeling queue, annotate record, or human review.
4
metadata:
5
author: arize
6
version: "1.0"
7
compatibility: Requires the ax CLI and a configured Arize profile.
8
---
9
10
# Arize Annotation Skill
11
12
> **`SPACE`** — All `--space` flags and the `ARIZE_SPACE` env var accept a space **name** (e.g., `my-workspace`) or a base64 space **ID** (e.g., `U3BhY2U6...`). Find yours with `ax spaces list`.
13
14
This skill covers **annotation configs** (the label schema) and **annotation queues** (human review workflows), as well as programmatically annotating project spans via the Python SDK.
15
16
**Direction:** Human labeling in Arize attaches values defined by configs to **spans**, **dataset examples**, **experiment-related records**, and **queue items** in the product UI. This skill covers: `ax annotation-configs`, `ax annotation-queues`, and bulk span updates with `ArizeClient.spans.update_annotations`.
17
18
---
19
20
## Prerequisites
21
22
Proceed directly with the task — run the `ax` command you need. Do NOT check versions, env vars, or profiles upfront.
23
24
If an `ax` command fails, troubleshoot based on the error:
25
- `command not found` or version error → see references/ax-setup.md
26
- `401 Unauthorized` / missing API key → run `ax profiles show` to inspect the current profile. If the profile is missing or the API key is wrong, follow references/ax-profiles.md to create/update it. If the user doesn't have their key, direct them to https://app.arize.com/admin > API Keys
27
- Space unknown → run `ax spaces list` to pick by name, or ask the user
28
- **Security:** Never read `.env` files or search the filesystem for credentials. Use `ax profiles` for Arize credentials and `ax ai-integrations` for LLM provider keys. If credentials are not available through these channels, ask the user.
29
30
---
31
32
## Concepts
33
34
### What is an Annotation Config?
35
36
An **annotation config** defines the schema for a single type of human feedback label. Before anyone can annotate a span, dataset record, experiment output, or queue item, a config must exist for that label in the space.
37
38
| Field | Description |
39
|-------|-------------|
40
| **Name** | Descriptive identifier (e.g. `Correctness`, `Helpfulness`). Must be unique within the space. |
41
| **Type** | `categorical` (pick from a list), `continuous` (numeric range), or `freeform` (free text). |
42
| **Values** | For categorical: array of `{"label": str, "score": number}` pairs. |
43
| **Min/Max Score** | For continuous: numeric bounds. |
44
| **Optimization Direction** | Whether higher scores are better (`maximize`) or worse (`minimize`). Used to render trends in the UI. |
45
46
### Where labels get applied (surfaces)
47
48
| Surface | Typical path |
49
|---------|----------------|
50
| **Project spans** | Python SDK `spans.update_annotations` (below) and/or the Arize UI |
51
| **Dataset examples** | Arize UI (human labeling flows); configs must exist in the space |
52
| **Experiment outputs** | Often reviewed alongside datasets or traces in the UI — see arize-experiment, arize-dataset |
53
| **Annotation queue items** | `ax annotation-queues` CLI (below) and/or the Arize UI; configs must exist |
54
55
Always ensure the relevant **annotation config** exists in the space before expecting labels to persist.
56
57
---
58
59
## Basic CRUD: Annotation Configs
60
61
### List
62
63
```bash
64
ax annotation-configs list --space SPACE
65
ax annotation-configs list --space SPACE -o json
66
ax annotation-configs list --space SPACE --limit 20
67
```
68
69
### Create — Categorical
70
71
Categorical configs present a fixed set of labels for reviewers to choose from.
72
73
```bash
74
ax annotation-configs create \
75
--name "Correctness" \
76
--space SPACE \
77
--type categorical \
78
--value correct \
79
--value incorrect \
80
--optimization-direction maximize
81
```
82
83
Common binary label pairs:
84
- `correct` / `incorrect`
85
- `helpful` / `unhelpful`
86
- `safe` / `unsafe`
87
- `relevant` / `irrelevant`
88
- `pass` / `fail`
89
90
### Create — Continuous
91
92
Continuous configs let reviewers enter a numeric score within a defined range.
93
94
```bash
95
ax annotation-configs create \
96
--name "Quality Score" \
97
--space SPACE \
98
--type continuous \
99
--min-score 0 \
100
--max-score 10 \
101
--optimization-direction maximize
102
```
103
104
### Create — Freeform
105
106
Freeform configs collect open-ended text feedback. No additional flags needed beyond name, space, and type.
107
108
```bash
109
ax annotation-configs create \
110
--name "Reviewer Notes" \
111
--space SPACE \
112
--type freeform
113
```
114
115
### Get
116
117
```bash
118
ax annotation-configs get NAME_OR_ID
119
ax annotation-configs get NAME_OR_ID -o json
120
ax annotation-configs get NAME_OR_ID --space SPACE # required when using name instead of ID
121
```
122
123
### Delete
124
125
```bash
126
ax annotation-configs delete NAME_OR_ID
127
ax annotation-configs delete NAME_OR_ID --space SPACE # required when using name instead of ID
128
ax annotation-configs delete NAME_OR_ID --force # skip confirmation
129
```
130
131
**Note:** Deletion is irreversible. Any annotation queue associations to this config are also removed in the product (queues may remain; fix associations in the Arize UI if needed).
132
133
---
134
135
## Annotation Queues: `ax annotation-queues`
136
137
Annotation queues route records (spans, dataset examples, experiment runs) to human reviewers. Each queue is linked to one or more annotation configs that define what labels reviewers can apply.
138
139
### List / Get
140
141
```bash
142
ax annotation-queues list --space SPACE
143
ax annotation-queues list --space SPACE -o json
144
145
ax annotation-queues get NAME_OR_ID --space SPACE
146
ax annotation-queues get NAME_OR_ID --space SPACE -o json
147
```
148
149
### Create
150
151
At least one `--annotation-config-id` is required.
152
153
```bash
154
ax annotation-queues create \
155
--name "Correctness Review" \
156
--space SPACE \
157
--annotation-config-id CONFIG_ID \
158
--annotator-email reviewer@example.com \
159
--instructions "Label each response as correct or incorrect." \
160
--assignment-method all # or: random
161
```
162
163
Repeat `--annotation-config-id` and `--annotator-email` to attach multiple configs or reviewers.
164
165
### Update
166
167
List flags (`--annotation-config-id`, `--annotator-email`) **fully replace** existing values when provided — pass all desired values, not just the new ones.
168
169
```bash
170
ax annotation-queues update NAME_OR_ID --space SPACE --name "New Name"
171
ax annotation-queues update NAME_OR_ID --space SPACE --instructions "Updated instructions"
172
ax annotation-queues update NAME_OR_ID --space SPACE \
173
--annotation-config-id CONFIG_ID_A \
174
--annotation-config-id CONFIG_ID_B
175
```
176
177
### Delete
178
179
```bash
180
ax annotation-queues delete NAME_OR_ID --space SPACE
181
ax annotation-queues delete NAME_OR_ID --space SPACE --force # skip confirmation
182
```
183
184
### List Records
185
186
```bash
187
ax annotation-queues list-records NAME_OR_ID --space SPACE
188
ax annotation-queues list-records NAME_OR_ID --space SPACE --limit 50 -o json
189
```
190
191
### Submit an Annotation for a Record
192
193
Annotations are upserted by config name — call once per annotation config. Supply at least one of `--score`, `--label`, or `--text`.
194
195
```bash
196
ax annotation-queues annotate-record NAME_OR_ID RECORD_ID \
197
--annotation-name "Correctness" \
198
--label "correct" \
199
--space SPACE
200
201
ax annotation-queues annotate-record NAME_OR_ID RECORD_ID \
202
--annotation-name "Quality Score" \
203
--score 8.5 \
204
--text "Response was accurate but slightly verbose." \
205
--space SPACE
206
```
207
208
### Assign a Record
209
210
Assign users to review a specific record:
211
212
```bash
213
ax annotation-queues assign-record NAME_OR_ID RECORD_ID --space SPACE
214
```
215
216
### Delete Records
217
218
```bash
219
ax annotation-queues delete-records NAME_OR_ID --space SPACE
220
```
221
222
---
223
224
## Applying Annotations to Spans (Python SDK)
225
226
Use the Python SDK to bulk-apply annotations to **project spans** when you already have labels (e.g., from a review export or an external labeling tool).
227
228
```python
229
import pandas as pd
230
from arize import ArizeClient
231
232
import os
233
234
client = ArizeClient(api_key=os.environ["ARIZE_API_KEY"])
235
236
# Build a DataFrame with annotation columns
237
# Required: context.span_id + at least one annotation.<name>.label or annotation.<name>.score
238
annotations_df = pd.DataFrame([
239
{
240
"context.span_id": "span_001",
241
"annotation.Correctness.label": "correct",
242
"annotation.Correctness.updated_by": "reviewer@example.com",
243
},
244
{
245
"context.span_id": "span_002",
246
"annotation.Correctness.label": "incorrect",
247
"annotation.Correctness.updated_by": "reviewer@example.com",
248
},
249
])
250
251
response = client.spans.update_annotations(
252
space_id=os.environ["ARIZE_SPACE"],
253
project_name="your-project",
254
dataframe=annotations_df,
255
validate=True,
256
)
257
```
258
259
**DataFrame column schema:**
260
261
| Column | Required | Description |
262
|--------|----------|-------------|
263
| `context.span_id` | yes | The span to annotate |
264
| `annotation.<name>.label` | one of | Categorical or freeform label |
265
| `annotation.<name>.score` | one of | Numeric score |
266
| `annotation.<name>.updated_by` | no | Annotator identifier (email or name) |
267
| `annotation.<name>.updated_at` | no | Timestamp in milliseconds since epoch |
268
| `annotation.notes` | no | Freeform notes on the span |
269
270
**Limitation:** Annotations apply only to spans within 31 days prior to submission.
271
272
---
273
274
## Troubleshooting
275
276
| Problem | Solution |
277
|---------|----------|
278
| `ax: command not found` | See references/ax-setup.md |
279
| `401 Unauthorized` | API key may not have access to this space. Verify at https://app.arize.com/admin > API Keys |
280
| `Annotation config not found` | `ax annotation-configs list --space SPACE` (or use `ax annotation-configs get NAME_OR_ID --space SPACE`) |
281
| `409 Conflict on create` | Name already exists in the space. Use a different name or get the existing config ID. |
282
| Queue not found | `ax annotation-queues list --space SPACE`; verify the queue name or ID |
283
| Record not appearing in queue | Ensure the annotation config linked to the queue exists; check `ax annotation-configs list --space SPACE` |
284
| Span SDK errors or missing spans | Confirm `project_name`, `space_id`, and span IDs; use arize-trace to export spans |
285
286
---
287
288
## Related Skills
289
290
- **arize-trace**: Export spans to find span IDs and time ranges
291
- **arize-dataset**: Find dataset IDs and example IDs
292
- **arize-evaluator**: Automated LLM-as-judge alongside human annotation
293
- **arize-experiment**: Experiments tied to datasets and evaluation workflows
294
- **arize-link**: Deep links to annotation configs and queues in the Arize UI
295
296
---
297
298
## Save Credentials for Future Use
299
300
See references/ax-profiles.md § Save Credentials for Future Use.
301