---
title: "Run Optimization"
method: POST
path: "/api/v1/optimization/run"
tags: ["optimization"]
---

# Run Optimization

`POST /api/v1/optimization/run`

Trigger a blocking GEPA prompt optimization run.

## Request body

- GEPAOptimizationRequest — Request body for triggering a GEPA prompt optimization run.
  - `target` ManagedOptimizationTargetRef
    - `kind` 'module' | 'skill', required — Managed optimization target kind.
    - `id` string, required — Registered module slug or catalog-resolved Skill id.
    - `version` string — Managed target version.
  - `dataset_version_id` string, nullable — Approved immutable Dataset Version identifier.
  - `metric_profile_id` string, nullable — Qualified Metric Profile id in name@version form.
  - `task_model` OptimizationModelSelection
    - `profile_id` string, required — Saved provider profile identifier.
    - `model_id` string, required — Provider-native model identifier.
  - `reflection_model` OptimizationModelSelection
    - `profile_id` string, required — Saved provider profile identifier.
    - `model_id` string, required — Provider-native model identifier.
  - `budget` union — Canonical discriminated GEPA budget.
    - OptimizationAutoBudget
      - `wall_clock_seconds` integer — Requested wall-clock limit before the server ceiling is applied.
      - `kind` 'auto' — Automatic GEPA budget discriminator.
      - `value` 'light' | 'medium' | 'heavy', required — Automatic GEPA intensity.
    - OptimizationMetricCallsBudget
      - `wall_clock_seconds` integer — Requested wall-clock limit before the server ceiling is applied.
      - `kind` 'max_metric_calls' — Metric-call budget discriminator.
      - `value` integer, required — Maximum metric calls allowed for the run.
    - OptimizationFullEvalsBudget
      - `wall_clock_seconds` integer — Requested wall-clock limit before the server ceiling is applied.
      - `kind` 'max_full_evals' — Full-evaluation budget discriminator.
      - `value` integer, required — Maximum full evaluations allowed for the run.
  - `search` GEPASearchConfig
    - `reflection_minibatch_size` integer — GEPA reflection minibatch size.
    - `candidate_selection_strategy` 'pareto' | 'current_best' — GEPA candidate-selection strategy.
    - `component_selector` 'round_robin' | 'all' — Predictor component-selection strategy.
    - `skip_perfect_score` boolean — Skip reflection for perfectly scored examples.
    - `add_format_failure_as_feedback` boolean — Whether formatting failures become GEPA feedback.
    - `use_merge` boolean — Enable GEPA candidate merging.
    - `max_merge_invocations` integer, nullable — Maximum candidate merge attempts.
    - `seed` integer — Deterministic GEPA search seed.
  - `tracking` OptimizationTrackingRequest
    - `restricted_payloads` boolean — Allow restricted optimization payload logging.
  - `dataset_path` string, nullable — Relative filesystem path to the dataset file.
  - `dataset_id` string, nullable — Registered dataset identifier to optimize against.
  - `program_spec` string — DSPy program specification string to optimize in module:attr form. Required when module_slug is not provided.
  - `module_slug` string, nullable — Registered module slug for server-side dispatch. When provided, program_spec is auto-resolved from the module registry.
  - `skill_name` string, nullable — Bundled or mounted Fleet skill name to optimize as a markdown skill artifact.
  - `skill_path` string, nullable — Relative path to a SKILL.md-compatible markdown file to optimize.
  - `trace_bundle_paths` string[] — Optional offline trace bundle paths available to the RLM-GEPA instruction proposer.
  - `reflection_profile_id` string, nullable — Optional LLM provider profile id for the GEPA proposer/reflection model.
  - `reflection_model_id` string, nullable — Optional provider-native model id for the GEPA proposer/reflection model.
  - `output_path` string, nullable — Optional filesystem path to save the optimized program.
  - `auto` 'light' | 'medium' | 'heavy' — Optimization intensity level.
  - `max_metric_calls` integer, nullable — Optional GEPA metric-call budget override for short offline smoke runs.
  - `train_ratio` number — Fraction of examples to use for training (remainder used for validation).
  - `optimizer` 'gepa' — Optimizer backend to use. GEPA is the only supported optimizer.

## Response `200`

Successful Response

- GEPAOptimizationResponse — Result payload after a GEPA optimization run completes.
  - `ok` boolean — Whether the optimization run completed successfully.
  - `optimizer` string — Optimizer backend that was used.
  - `program_spec` string, required — DSPy program specification that was optimized.
  - `train_examples` integer, required — Number of training examples used.
  - `validation_examples` integer, required — Number of validation examples used.
  - `validation_score` number, nullable — Validation score from the optimized program, when available.
  - `output_path` string, nullable — Filesystem path where the optimized program was saved.
  - `manifest_path` string, nullable — Filesystem path to the optimization manifest, when available.
  - `feedback_summary` string, nullable — Short summary of validation feedback from the GEPA run.
  - `module_slug` string, nullable — Module slug used for this optimization run, when server-side dispatch was used.
  - `reflection_profile_id` string, nullable — LLM provider profile id used for GEPA reflection/proposal, when selected.
  - `reflection_model_id` string, nullable — Model id used for GEPA reflection/proposal, when selected.
  - `distilled_trace_bundle_path` string, nullable — Distilled trace bundle used by the RLM-GEPA proposer.
  - `error` string, nullable — Error message when the optimization run failed.

## Other responses

- `400` — Invalid optimization parameters.
- `401` — Authentication is required or the provided token is invalid.
- `422` — Validation Error
- `503` — GEPA optimization is unavailable in this environment.

## Changes

- **2026-07-11** `210fe09282d1` — 8 info
  - added the new optional request property `budget`
  - added the new optional request property `dataset_version_id`
  - added the new optional request property `metric_profile_id`
  - added the new optional request property `reflection_model`
  - …4 more
- **2026-06-12** `4a415e33915a` — 3 breaking, 10 info
  - the `optimizer` request property const value `gepa` was added
  - removed the enum value `gepa` of the request property `optimizer`
  - removed the enum value `miprov2` of the request property `optimizer`
  - added the new optional request property `max_metric_calls`
  - …9 more
- **2026-06-11** `604ec78205fc` — 1 info
  - added the new optional request property `optimizer`
- **2026-05-23** `6178f925cdec` — 1 breaking, 3 info
  - the `detail` response's property type changed from `array` to no type for status `422`
  - added `subschema #1, subschema #2` to the `detail` response property `anyOf` list for the response status `422`
  - added the required property `code` to the response with the `422` status
  - added the required property `message` to the response with the `422` status
- **2026-04-18** `1f45411d7556` — 2 breaking
  - request property `dataset_id` list-of-types was narrowed by removing types `integer` from media type `application/json`
  - the `dataset_id/anyOf[subschema #1]/` request property type changed from `integer` to `string`

[Full history](https://skmtc.dev/qredence/apis/fleet-rlm/changes/api/v1/optimization/run/post.md)

---

[API](https://skmtc.dev/qredence/apis/fleet-rlm.md) · [All operations](https://skmtc.dev/qredence/apis/fleet-rlm/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/qredence/fleet-rlm/revisions/210fe09282d1/schema)
