loop_optimization
Automates prompt optimization by running test cases, scoring responses, and iteratively applying improvements until performance threshold is reached or max iterations are exhausted.
Instructions
Run the full optimization loop until the threshold is met or max iterations reached.
Like start_optimization_session but auto-applies each suggestion and repeats.
Prerequisites: same as start_optimization_session.
Loop:
Run all test cases, score responses, call post_test_result for each.
Call get_regression_status.
If ALL scores >= threshold AND iteration >= 1 → SUCCESS.
If iteration >= maxIterations → EXHAUSTED. Report best result.
Analyse failures, write improved prompt (targeted — fix pattern, keep what works).
Call post_prompt_suggestion then apply_suggestion (auto authorised in loop mode).
Go to 1.
Do NOT stop after the first pass because it is passing — first pass is a baseline. Always run at least one improvement cycle.
After the loop: call pull_ui_history, save optimization results locally, call save_system_prompt_template with the best prompt found.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspaceId | Yes | ||
| threshold | No | Pass score 0–100 (default 70) | |
| maxIterations | No | Max loop iterations (default 5) |