Find or create a hosted judge version
const url = 'https://app.prefactorai.com/api/v1/agent_version/hosted_judge';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"agent_id":"013xrzp12g3nqk8ns6jadrqmpgrjkeny","criterion":"Decide whether the agent completed every request.","external_identifier":"2026-10-01 15:03","hosted_llm_provider_model_id":"013xrzp12g3nqk8ns6jadrqmpgrjkeny","id":"013xrzp12g3nqk8ns6jadrqmpgrjkeny","system_prompt_template":"You are a judge.\n\n{{ criterion }}\n\nAnswer with a verdict."}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.prefactorai.com/api/v1/agent_version/hosted_judge \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "agent_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "criterion": "Decide whether the agent completed every request.", "external_identifier": "2026-10-01 15:03", "hosted_llm_provider_model_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "system_prompt_template": "You are a judge.\n\n{{ criterion }}\n\nAnswer with a verdict." }'Returns the matching hosted judge version if one already exists for this judge with the same external identifier, system prompt template, criterion, and model. Otherwise creates a new version. The version is hosted and single-turn, uses the canonical judge schema, and records Prefactor’s runtime environment. hosted_configuration.system_prompt stores the template and hosted_configuration.judge_criterion stores the rubric. The runtime renders them when a run starts. The returned version is deployed to the lowest environment.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
A valid agent ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyThe rubric this judge applies. Stored as hosted_configuration.judge_criterion and rendered into the system prompt when a run starts
Example
Decide whether the agent completed every request.A valid LLM provider model ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyA valid agent version ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyNull
Responses
Section titled “Responses”Success
object
object
A valid account ID
A valid agent ID
A valid agent schema version ID
Agent deployments that pin this version as their current version (empty if none).
Whether Prefactor executes this version (hosted) or an external agent reports telemetry (remote)
External identifier for the agent version
Count of rows sharing this external identifier (helps distinguish duplicates).
object
Criterion rendered into the system prompt when a hosted run starts. Omitted when the system prompt is used as written
A valid LLM provider model ID
Hosted run mode: one model turn, or a conversation
System prompt for each hosted run. When judge_criterion is set, this is a Liquid template and criterion is its only variable
Null
A valid agent version ID
When the agent version was created
object
List of package name and version strings (e.g. “package@1.0.0”)
Null
List of package name and version strings (e.g. “package@1.0.0”)
Null
Null
Type of resource (always ‘agent_version’)
When the agent version was last updated
Example
{ "details": { "account_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "agent_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "agent_schema_version_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "current_agent_deployment_refs": [ "013xrzp12g3nqk8ns6jadrqmpgrjkeny" ], "execution_mode": "hosted", "external_identifier": "v1.0.0", "hosted_configuration": null, "id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "inserted_at": "2024-01-01T00:00:00Z", "observed_classification": "unknown", "runtime_environment": null, "type": "agent_version", "updated_at": "2024-01-01T00:00:00Z" }, "status": "success"}default
Section titled “default”Error
object
object
object
object
Milliseconds until the client may retry.
object
A valid knowledgebase document revision ID
Example
{ "code": "bad_request", "status": "error"}