Agent Autorater Customization

Agent Autorater Customization

Builds custom autoraters for an AI agent from its real trajectories, turning failures into rubrics and calibrating the judge until it agrees with the user's own labels.

Skill files12 files

references/

scripts/

SKILL.md283 lines
1
---
2
name: agent-platform-autorater-customization
3
metadata:
4
version: "1.0.1"
5
category: AiAndMachineLearning
6
description: >-
7
Customizes an autorater (evaluation metric) for an AI agent so its grades
8
match the user's own judgment, starting from the agent's real trajectories.
9
Use when a user wants a metric tailored to their agent, wants to turn failing
10
trajectories into rubrics, says an existing autorater grades their agent
11
wrong, or wants an autorater to agree with human labels (autorater
12
hillclimbing, judge calibration). Don't use for quick evals with built-in
13
metrics or for improving the agent itself (use agent-platform-eval-flywheel).
14
---
15
16
# Agent Platform Autorater Customization
17
18
This skill helps a user build graders for their agent that judge the way they
19
do. You do the reading, writing and testing; the user makes the judgment calls.
20
The result is a set of metrics registered in the Agent Platform evaluation
21
service, one or more for each criterion the user cares about.
22
23
Carry out the steps below in order. Don't summarize them to the user.
24
25
## Usage Attribution
26
27
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
28
MUST read and follow the instructions in
29
[Usage Attribution](references/attribution.md).
30
31
## Setup
32
33
Check each item before the first evaluation call, and ask the user to fix what
34
is missing. Ask before installing anything, because it changes the user's
35
environment.
36
37
1. **Python SDK.** Install or upgrade the Agent Platform SDK with the
38
evaluation extra:
39
40
```bash
41
pip install --upgrade 'google-cloud-aiplatform[evaluation]>=2.8.0,<3'
42
```
43
44
Keep the quotes; unquoted, the shell reads `>=` as a redirect. The
45
`gcloud` CLI is also needed for authentication; if it is missing, point the
46
user to https://cloud.google.com/sdk/docs/install instead of installing it.
47
2. **Project and billing.** Use the project the user names, or ask for one
48
(`gcloud config set project {project_id}`). The project needs an active
49
billing account: evaluation calls are billed as model usage. See
50
https://cloud.google.com/pricing for current prices; don't quote numbers.
51
3. **API.** Enable the Agent Platform API:
52
`gcloud services enable aiplatform.googleapis.com`.
53
4. **Authentication.** Run `gcloud auth login` for the CLI and
54
`gcloud auth application-default login` for the SDK and scripts, or set
55
`GOOGLE_APPLICATION_CREDENTIALS` to a service account key file.
56
5. **IAM.** The user or service account needs `roles/aiplatform.user` to run
57
evaluations and register metrics. Don't grant broader roles such as
58
`roles/aiplatform.admin`; ask the user to request the narrower role if it
59
is missing.
60
6. **Region.** Use `us-central1` unless the user needs another region (use
61
`global` for `gemini-4-hydrogen` judge models unless
62
`allow_cross_region_model` is enabled; see
63
https://cloud.google.com/about/locations).
64
65
## Working with the user
66
67
- At each **Approval** point, show the proposal and ask: "Would you like to
68
change anything, or go ahead with this version?" Wait for a clear yes;
69
silence is not approval.
70
- For setup choices (project, region, storage), suggest a default.
71
- Everything the user reviews (cases, grades, metric definitions) goes in a
72
review page, not in chat; see [Review pages](#review-pages). Chat updates
73
say what you did, the numbers, and what you need.
74
- When you ask about a trajectory in chat, quote the relevant lines.
75
76
## Inputs
77
78
The user brings a folder of trajectories: the ones they think went wrong, plus
79
some good ones. Optional: a note or rating per trajectory (thumbs, human score,
80
an old autorater's verdict), an existing rubric, or reference answers.
81
82
- Use all of them unless grading them would be slow or costly in the
83
evaluation service. Then agree a sample with the user that covers the
84
failures and a few good cases, and say what was left out.
85
- AgentData JSONL is best; see
86
[Converting trajectories](references/converting_trajectories.md). If you
87
can't map a format to AgentData with confidence, don't guess: say you need
88
to convert it to AgentData, and ask the user for a schema, a converter, or
89
one example mapped by hand. Then check every converted case.
90
- Building a dataset is not this skill's job. If the user has no folder yet,
91
help them pick and convert trajectories, then continue.
92
93
## Terms
94
95
- **Criterion:** one thing the user cares about in the agent's behavior: the
96
answer is correct, the right tool is called, the system instructions are
97
followed throughout. A criterion holds for the whole dataset; every
98
trajectory, or every turn, is graded on it, and it can be N/A for some.
99
- **Rubric:** one yes/no check.
100
- **Metric:** what grades a criterion in the evaluation service: code, one
101
rubric, or several weighted rubrics. A criterion gets as many metrics as it
102
needs, for example a code check for the tool call plus a judge for the
103
answer.
104
105
The predefined multi-turn metrics also turn intents into rubrics with an
106
importance, but they score the unweighted share of rubrics that pass. Custom
107
metrics add rubrics written for the user's agent, weights, must-pass rubrics,
108
and a pass threshold.
109
110
## Steps
111
112
### 1. Confirm the inputs
113
114
Ask where the folder is and whether any trajectories have a note or rating.
115
116
### 2. Propose criteria (Approval)
117
118
Read the trajectories and the user's notes, and propose the criteria the data
119
supports, as few as cover the problems the user cares about. They can cover any
120
part of the trajectory: the final answer, tool calls and arguments, following
121
the system instructions, handling of errors or clarifications. In a multi-agent
122
system, a criterion can be about the whole system (routing, the final answer) or
123
about one sub-agent; say which. For each, give:
124
125
- a one-line statement and why it matters for this agent;
126
- how many cases show a problem, with one quoted example;
127
- the metrics you plan to build for it (see step 4), with one line on why.
128
129
Never propose a criterion you can't point to in the data or the user's notes.
130
Flag any criterion you doubt, with the reason (for example, it can't be graded
131
where tool results were trimmed). Also note problems in any existing grading: a
132
judge that never saw data the agent had, evidence trimmed from the trajectory,
133
golden answers that were never run.
134
135
This step makes no evaluation-service calls. If the user wants help finding
136
patterns in ten or more failing cases, you can grade them with
137
`MULTI_TURN_TASK_SUCCESS` and run `client.evals.generate_loss_clusters` after
138
step 3. Loss clusters only work in the `global` region and for
139
`multi_turn_task_success` and `multi_turn_tool_use_quality`, not for custom
140
metrics.
141
142
Save the approved criteria as `criteria.md`.
143
144
### 3. Agree data rules and spend (Approval)
145
146
Ask whether the trajectories may be sent to the evaluation service, which
147
project to bill, and where outputs may be stored. Show the number of calls
148
(cases × metrics × samples × rounds, with one call per step for step-based
149
metrics) and point to https://cloud.google.com/pricing for the cost. Ask again
150
before any run beyond that.
151
152
### 4. Build the metrics
153
154
Use the simplest form that grades the criterion: simpler forms cost less, give
155
the same answer every time, and are easier to trust.
156
157
Criterion can be graded by | Form | SDK
158
--------------------------------------------------------------------------- | ----------------------- | ---
159
An exact rule on the output or trajectory (a tool name, a format, a number) | Code | `types.CodeExecutionMetric` (runs in the service; can be registered)
160
One judgment that is the same for every case | LLM, one rubric | `types.LLMMetric` with a yes/no check and a reference
161
Several checks, some more important than others | LLM, weighted rubrics | `types.StepBasedLLMMetric`: one judge step; code computes the weighted score
162
Checks that differ per case, with no good reference | Generated checklist | `types.StepBasedLLMMetric`: one step writes checks from the conversation, one grades them
163
Long or multi-turn traces, per-turn verdicts, or several judging stages | Step-based, multi-stage | `types.StepBasedLLMMetric`
164
One sub-agent of a multi-agent system | Step-based, one agent | `types.StepBasedLLMMetric` with a code preprocessor that keeps that agent's events
165
166
Start each metric from its template in
167
[Metric templates](references/metric_templates.md); each template says what it
168
doesn't catch. For weighted rubrics, propose the rubrics, a weight for each, the
169
must-pass rubrics and a pass threshold, and keep the weights in the parser code
170
so the judge grades each rubric on its own. Write checks as described in
171
[Writing LLM checks](references/writing_checks.md). For multi-turn
172
conversations, decide per criterion whether to grade each turn or the whole
173
conversation; see [Multi-turn conversations](references/multi_turn.md).
174
175
### 5. Grade and show the results
176
177
Grade the cases through the evaluation service with `scripts/run_metrics.py`,
178
then build a review page with `scripts/build_review_page.py`. Pass each metric's
179
pass threshold as `--threshold`, so PASS and FAIL on the page match the metric.
180
181
Optional: if the user has an existing autorater, or wants to compare with a
182
built-in metric such as `MULTI_TURN_TASK_SUCCESS`, grade with it too and show it
183
as a baseline. It adds calls, and a built-in metric grades overall task success
184
rather than the user's criteria.
185
186
### 6. Optional: align the metrics with the user's ratings
187
188
Ask whether the user wants to mark the grades and have you improve the metrics,
189
at about a minute per case. Skip to step 7 if not.
190
191
1. Set aside about 20% of the cases as held back. Build the review page without
192
them.
193
2. The user marks each verdict Agree or Disagree on the review page, with a
194
reason when they disagree, and gives you `labels.json`. If the user already
195
has human ratings, use them and ask only about the cases where a metric
196
disagrees.
197
3. Compute agreement per metric and per rubric with `scripts/agreement.py`.
198
Measure judge noise before trusting a change; see
199
[Noise and agreement](references/noise_and_agreement.md).
200
4. Revise the metrics yourself (rubric wording, weights, must-pass rubrics,
201
threshold, reference, code), save each round as a new version, grade again,
202
and show the user what changed and the new agreement. When a label
203
contradicts the trajectory, quote the lines and ask the user.
204
5. Stop when agreement stops improving by more than the noise, or when the user
205
is satisfied. Grade the held-back cases once. Don't revise on them; if a
206
held-back case breaks, report overfitting and suggest more labeled cases.
207
208
### 7. Review and register (Approval)
209
210
Registering the metrics is the goal of this skill. Add to the review page, for
211
each metric: its criterion, the final definition (rubrics, weights, must-pass
212
rubrics, threshold, judge model, sample count), its grades, agreement on labeled
213
and held-back cases if step 6 ran, and open questions. After approval, register
214
each metric with `create_evaluation_metric`; it creates a shared resource.
215
216
Hand over an output folder with:
217
218
- `criteria.md`: the approved criteria, each listing the metrics that grade
219
it;
220
- `metrics/`: the final definition of every metric, as the file the evaluation
221
service ran (the metrics file passed to `scripts/run_metrics.py`), with its
222
registered name;
223
- `metrics.md`: one entry per metric with its criterion, form, rubrics,
224
weights, must-pass rubrics, threshold, judge model and sample count, and a
225
code snippet that runs it by registered name;
226
- `labels.json` and earlier versions, if step 6 ran;
227
- `report.md`: the numbers and open questions.
228
229
To run the metrics on a full dataset, point to `agent-platform-eval-flywheel`.
230
231
## Review pages
232
233
Build one self-contained HTML page per round with
234
`scripts/build_review_page.py`, and give the user its path (or serve it where
235
the user's browser can reach it). For each case it shows the user's note or
236
rating, each metric's PASS/FAIL, score, explanation and rubric verdicts, the
237
baseline if one ran, and the trajectory with tool results collapsed. The user
238
marks Agree or Disagree on each verdict with a reason; marks are saved in the
239
browser, and "Download labels.json" exports them in the format
240
`scripts/agreement.py` reads. Never ask the user to type labels in chat.
241
242
## Rules
243
244
- All grading goes through the evaluation service. Labels come only from the
245
user: don't grade trajectories or draft labels with your own model calls or
246
subagents, because tuning a metric to another model's labels only teaches
247
one model to agree with another.
248
- Grade only the cases in the folder while building; the full dataset is for
249
after registration.
250
- Every number you report comes from a result file. Report a range when runs
251
differ.
252
- Keep proprietary trajectories and outputs, including review pages, where the
253
user said. Never paste them into shared docs, bugs or chats.
254
- Read the installed SDK source before using a name; versions differ.
255
256
## Cleanup
257
258
Registered metrics stay in the project until deleted. When the user wants to
259
remove a metric they no longer use, or one registered by mistake, confirm the
260
name with them, then run
261
`client.evals.delete_evaluation_metric(metric_resource_name={name})`. List them
262
with `client.evals.list_evaluation_metrics()`. Local outputs (results, review
263
pages, labels) stay where the user chose; offer to delete them at the end.
264
265
## Scripts
266
267
All have `--help`.
268
269
- `scripts/render_agent_data.py`: trajectories as readable text.
270
- `scripts/run_metrics.py`: runs SDK metrics with `client.evals.evaluate()`.
271
- `scripts/build_review_page.py`: the review page and labels export.
272
- `scripts/agreement.py`: agreement, Cohen's kappa and disagreements, per
273
metric, per rubric or per turn.
274
275
## References
276
277
- [Converting trajectories](references/converting_trajectories.md)
278
- [Metric templates](references/metric_templates.md)
279
- [Writing LLM checks](references/writing_checks.md)
280
- [Multi-turn conversations](references/multi_turn.md)
281
- [Noise and agreement](references/noise_and_agreement.md)
282
- [SDK gotchas](references/sdk_gotchas.md)
283

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…