---
search:
  tags:
    - V1
    - POST
seo:
  description: >-
    Backtest unsaved preprocessing source against… Reference for the POST
    /v1/projects/{projectId}/artifacts/optimistic-eval-tests endpoint in the
    Judgeval API.
sidebar:
  label: Test optimistic eval candidate
  badge: POST
title: Test optimistic eval candidate
type: openapi-operation
---
Backtest unsaved preprocessing source against one historical trace with an exact saved judge version. Runs the candidate (preprocessing + JEV) and an ordinary agent judge in parallel and returns both outcomes and whether they match. Consumes evaluation usage; saves no scores.

`POST /v1/projects/{projectId}/artifacts/optimistic-eval-tests`

**Request body** (`application/json`, required)

- `trace_id` (string, required) — The historical trace to extract evidence from
- `source_code` (string, required) — A complete JavaScript function expression: async ({ traceId, sql }) =\> { ... }. Return JSON evidence; throw when validation fails.
- `judge_id` (string<uuid>, required) — The judge in this project
- `judge_version_id` (string<uuid>, required) — The exact judge version ID returned by get\_judge

Request body example:

```json
{
  "trace_id": "string",
  "source_code": "string",
  "judge_id": "968a8026-4d88-467b-937b-009ebfad94d9",
  "judge_version_id": "85fd0392-86f2-40e7-9e56-5ca06ee20f82"
}
```

**Responses**

- `200` — Response for status 200

Response example, 200:

```json
{
  "judge_id": "968a8026-4d88-467b-937b-009ebfad94d9",
  "judge_version_id": "85fd0392-86f2-40e7-9e56-5ca06ee20f82",
  "judge_major_version": 0,
  "judge_minor_version": 0,
  "score_type": "binary",
  "trace_id": "string",
  "result": {
    "status": "accepted",
    "verdict": true,
    "reason": null,
    "error": null,
    "confidence": 0,
    "duration_ms": 0,
    "artifact_duration_ms": 0,
    "evidence_size_bytes": 0
  },
  "ordinary_agent": {
    "status": "completed",
    "verdict": true,
    "reason": "string",
    "error": null,
    "duration_ms": 0
  },
  "matches": true
}
```
