Optimization FAQ & fixes

Diagnose dataset runs that won't start, empty generator output, missing evaluator inputs, and early-stop results in Agent Learning Kit for Python.

About

First identify where the problem occurred. A dashboard run needs an eligible dataset column, a model, and an evaluation. In an Agent Learning Kit script, prompt generation and scoring are separate: a working local metric won’t tell you whether a model call succeeded.

Common errors and fixes

Dashboard symptomWhat to check
No columns available for optimizationRun a prompt on your dataset. Only columns created by Run Prompt appear in Choose Column.
Add evaluations before starting your optimization runSelect the prompt column first, then use Add Evaluations. For ticket routing, score the predicted label against the expected label on each row.
A configuration error begins with Missing required keys for optimizer or Unexpected keys provided for optimizerThe algorithm and parameters disagree. Supply the parameter set for the selected optimizer, not the fields for the algorithm you used previously.
Self-hosted dataset optimization returns HTTP 402Check whether your deployment’s entitlement includes optimization. Changing the prompt or reinstalling the Python package doesn’t enable the dashboard feature.
Stop is missingOnly queued or running jobs can be stopped. To try another configuration after a cancellation, restart the stopped run.
The run shows Failed to optimizeRead the reason on the run detail. Check whether the prompt can generate output and its eval can score a row independently. Use the re-run control next to Failed in the run list to create a new run with corrected settings.

Diagnose a Python run

SymptomWhat to check
Python can’t import fi.optInstall agent-learning-kit==0.3.7 in the same environment that runs the script: python -m pip install agent-learning-kit==0.3.7. GEPA, LiteLLM, and Optuna are dependencies of this release.
Constructing Evaluator raises ValueErrorFor a local metric, supply metric= with a metric instance. For platform evaluation, supply both eval_template and eval_model_name, and set FI_API_KEY and FI_SECRET_KEY. A provider key is not a Future AGI credential.
LiteLLMGenerator.generate() raises KeyErrorEvery placeholder in the prompt must be present in the row. If a rewrite changes {ticket} to {question}, it no longer matches the router’s input data.
The generator returns an empty stringA model-call exception can produce "" instead of stopping the script. Check the provider credentials and model identifier; review generation before blaming the eval.
The answers look right but the labels score zeroCheck individual_results in the history entry for the candidate. In the SDK example, Equals compares response and expected_response. Use generated_output as the source for response, and the actual row key queue for expected_response. Unrecognized source keys are omitted by BasicDataMapper. With case sensitivity enabled, Returns and RETURNS differ.
Fewer rounds ran than requestedInspect early_stopped and stop_reason. A row budget counts evaluated examples, not prompts: one round on three tickets can consume three evaluations. Checks occur after scoring, so a batch can take the count past the budget.

Scores improve in the run but not on new tickets

Inspect the trial items in the dashboard or the scored candidates in result.history in Python. If your sample contains mostly returns, a prompt that always emits RETURNS can score highly. Check both labels on examples the optimizer never saw. If the feedback doesn’t distinguish a helpful reply from a usable queue label, change the eval before increasing the number of rounds.

Next steps

Was this page helpful?

Questions & Discussion