Sample tags¶
A tag is a named JSON note on one sample, such as reviewed or needs-review.
It has attrs, a small object you can filter, sort and count by, and an
optional body for anything longer. Tags live in the warehouse beside the
sample; they never change the eval log.
Anyone who can read a sample can read and write its tags. There is no owner and
no separate write permission. Two kinds of credential are narrower: a
read-only credential
can read tags but not write them (403), and a
profile's delegated token is refused on all three routes
(401).
There is no CLI command for tags yet. Call the API with your Hawk token:
Writing a tag¶
curl -sX POST "$API/meta/samples/<sample-uuid>/tags/needs-review" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"version": 0, "attrs": {"reason": "timeout", "labels": ["infra"]}, "body": {"note": "Sandbox lost network at turn 12."}}'
A tag name is lower-case letters, digits, _, . and -, starting with a
letter, at most 63 characters. attrs holds at most 4 KiB of JSON and body
at most 64 KiB (413 above that).
Every write stores a new version and keeps the old ones. version is the
version you last read: 0 when the sample has no such tag, otherwise the
version of the tag you are replacing. If someone else wrote in between, the
answer is 409 with the tag as it is now in current, and nothing is stored;
read it, merge, and send again with its version.
To remove a tag, send {"version": <current>, "removed": true}. The sample
then has no such tag, so the next write sends version: 0. Stored versions
keep counting up: a tag removed at version 3 comes back as version 4.
A tag cannot be written on a sample whose run has not finished (400):
importing the finished log can replace the sample's warehouse row, and its tags
would go with it. A sample that does not exist and one you cannot read both
answer 404.
A tag lasts as long as its sample's row in the warehouse. A re-import of the same log keeps the row and its tags. If a later import of the same eval holds that sample under a new UUID, because it was run again, the old row and every version of its tags are deleted.
Listing tags¶
curl -sG "$API/meta/sample-tags" -H "Authorization: Bearer $TOKEN" \
-d tag=needs-review --data-urlencode 'attrs={"reason": "timeout"}' -d limit=20
| Parameter | Meaning |
|---|---|
tag |
The tag name. Required. |
attrs |
A JSON object; only tags whose attrs contain it. {"labels": ["infra"]} matches a tag with that label among others. To match either of two values, send one request per value. |
q |
Words to find in the string values of attrs and body: "a phrase", or, -word. Words are stemmed (complied finds comply) and none is dropped, so "did not comply" does not find text that says "did comply". |
model, task_name, eval_set_id |
Repeat a parameter to match any of its values. |
sample_uuid |
Only this sample. |
sort_by |
created_at (default), started_at (the sample's), model, task_name or attrs.<key>. |
sort_order |
desc (default) or asc. |
limit |
Page size, 1–500 (default 50). |
cursor |
The previous page's next_cursor, with the same other parameters; one from another sort_by is a 422. |
Each item is the tag's current version (sample_uuid, tag, version,
attrs, body, author, created_at) and a sample object with the
sample's id, epoch, started_at, eval_set_id, filename, model and
task_name. created_at is when that version was written, so the default
order is most recently written first: editing a tag moves it to the top. Removed
tags, and tags on samples you cannot read, are not listed. There is no total;
use the counts.
Sorted by created_at, each page continues after the last tag of the page
before, so you can remove the tags you have handled as you page and none is
skipped. A tag written or rewritten meanwhile becomes the newest, which
newest-first paging has already passed. With any other sort_by the cursor is
a position in the list, and pages shift when tags are written or removed
between requests.
Counting tags¶
curl -sG "$API/meta/sample-tags/counts" -H "Authorization: Bearer $TOKEN" \
-d tag=needs-review -d by=attrs.reason -d by=model
Takes the list's filters (tag, attrs, q, model, task_name,
eval_set_id, sample_uuid) and up to 10 by: attrs.<key>, model,
task_name or month (the UTC month the sample started, 2026-01). The
answer is {"total": 12, "counts": {"attrs.reason": [{"value": "timeout",
"count": 7}, ...], "model": [...]}}. Values are text. A tag without the attrs
key counts under null. A tag whose key holds an array counts once under each
distinct element, and nowhere if the array is empty, so a by's counts can add
up to more or less than total.