Replace an agent's exemplars
Replaces a worker agent’s exemplars with 2 to 5 entries. Requires permission agents:write.
v2 compatibility notes
POST /api/v2/agents/replaceExemplars replaces the agent’s exemplars: the input and expected output cases that show it how to behave. The body is { id, exemplars }, where each exemplar is { input, expectedOutput, notes? }; the answer is { id, agentId, exemplarCount }. The list is the whole new list: an exemplar left out is retired.
Authority
You needagents:write at the agent’s home org unit, and agents:read there to see the agent. Any credential works: a Personal key acts as its owner, narrowed by its scopes; an External App and a platform key use their own grants. A missing, PERSONAL, unhomed or unreadable agent is the same 404 resource_missing (Agent not found); an unavailable agent store is 500, never 404. Without agents:write at the home the answer is 403 permission_denied, recorded as a refused request.
Limits
The list has 2 to 5 entries, and each needs aninput and an expectedOutput; otherwise the answer is 400 bad_request. The request is at most 256 KiB (413 payload_too_large), with or without an Idempotency-Key. A system agent and an agent that is not a worker are 409 conflict; one that is not draft or active is 409 invalid_state. The Console’s exemplar editor follows the same rules.
Replay
With anIdempotency-Key, a repeat of the same request within 24 hours returns the recorded answer only while the slug still names the same agent definition, you may still read the agent at its home, and you still hold the route’s permission there (the agent_write replay rule). Otherwise the repeat is 409 conflict and the write never runs twice.Authorizations
Headers
1–255 printable ASCII characters (0x21–0x7E, no spaces), scoped to the calling credential. A repeat with the same key and request never runs the write again, a 5xx included: once the operation's permissions pass again it answers the identical status and body of the first response (Idempotent-Replayed: true, also sent as Idempotency-Replayed: true), unless the operation's own replay policy withholds it; a first response that was not stored (over 32 KiB, or carrying a one-time secret) answers its first status with only data.id (Idempotency-Replay-Disclosure: id-only) when it named one; otherwise 409 idempotency_result_unavailable; a repeat while the first is still running is 409 idempotency_key_in_flight, and the same key with a different request is 422 idempotency_key_reuse. Honoured for External App JWTs and platform and Personal keys; an External App's static companion key is not protected.
1 - 255
