Change a judging rule
const url = 'https://example.com/v1/projects/example/judging-rules/example';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","when":{"agentIds":["example"],"flowIds":["example"],"versions":["example"],"status":["completed"],"includeDryRuns":true},"sample":1,"maxOpen":1,"judgeClassId":"example","enabled":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://example.com/v1/projects/example/judging-rules/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "when": { "agentIds": [ "example" ], "flowIds": [ "example" ], "versions": [ "example" ], "status": [ "completed" ], "includeDryRuns": true }, "sample": 1, "maxOpen": 1, "judgeClassId": "example", "enabled": true }'A new version with these fields changed (when is replaced whole). Earlier versions are kept: …/versions shows who changed what, when. Needs write on the project.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”ProjectId — opaque branded string.
Request Bodyrequired
Section titled “Request Bodyrequired”The fields to change; when is replaced whole.
object
Which of a project’s runs a rule matches as they end. Every field narrows; absent fields don’t. agentIds or flowIds, not both. Top-level runs only (an agent’s own runs, not its turns as a flow’s step); replays never match.
object
These versions exactly, or live: runs that got the agent’s live version, not one the caller named. Runs from before the runtime recorded how their version was chosen never match live.
How the run ended. Only completed today: a judgment needs a completed run, so failed and cancelled are refused (400). Absent: completed.
Dry runs are left out unless true.
The share of matching runs queued, decided by the run and rule ids: the same every time and across the rule’s versions, so raising it keeps the runs it took before. Default 1.
Queue nothing while this rule has this many open items. null removes the cap.
Whose judgment it wants: one of this class closes it. null: any judgment does.
Default true.
Responses
Section titled “Responses”The new version.
One version of a judging rule; the latest live one applies.
object
Which of a project’s runs a rule matches as they end. Every field narrows; absent fields don’t. agentIds or flowIds, not both. Top-level runs only (an agent’s own runs, not its turns as a flow’s step); replays never match.
object
These versions exactly, or live: runs that got the agent’s live version, not one the caller named. Runs from before the runtime recorded how their version was chosen never match live.
How the run ended. Only completed today: a judgment needs a completed run, so failed and cancelled are refused (400). Absent: completed.
Dry runs are left out unless true.
Queue nothing while this rule has this many open items. Absent: no cap.
Whose judgment it wants: one of this class closes it. Absent: any judgment does.
Who wrote this version.
Example
{ "when": { "status": [ "completed" ] }}Malformed request body.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}No such rule (judging-rule-not-found), or no live judge class judgeClassId (judge-class-not-found).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Idempotency-Key was reused with a different body, or resource-state conflict.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Server error (unmapped domain code or framework crash).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}