Skip to main content
On this page we show which algorithm to pick for improving your agent, from the guided loop to the DSPy optimizers, when the metric is a scenario suite. The metric is what sets the cost: every metric call is one simulated conversation, so an optimizer that plans hundreds of calls costs hundreds of conversations. The table counts those calls on the six-scenario example of Optimize with DSPy.

Algorithms side by side

The instruction optimizers above (COPRO, MIPROv2, GEPA, SIMBA) rewrite the instructions of every predictor in the program, and on a dspy.ReAct program the instructions contain the tool descriptions, so those optimizers change the tools as well. BootstrapFewShot and BootstrapFewShotWithRandomSearch leave the instructions alone and only add demonstrations. See Optimize with DSPy.

Which algorithm to pick

  • Start with the guided loop. Most of the turns in a long conversation come from a tool contract or a harness setting, and an algorithm cannot change either, while one hypothesis in the guided loop costs one suite run.
  • GEPA when the metric returns text feedback. The scenario judge writes why a candidate failed, and GEPA’s reflection reads that text and proposes the next candidate from it, without you reviewing each step.
  • MIPROv2 when the metric is a number. Use MIPROv2 with an evaluator that returns a score and no reasoning, or with a dataset of expected outputs; LangWatch tracks every trial.
  • COPRO on a small budget, when you want the instructions rewritten in a few calls and have no examples to add.
  • BootstrapFewShot when the format is the problem, meaning the instructions are right and the model gets the shape of the answer wrong.

Tracking a run

langwatch.dspy.init(experiment=..., optimizer=optimizer) records every trial of a tracked optimizer in Experiments, with the score, the instructions of each predictor and the examples it chose. The tracked optimizers are BootstrapFewShot, BootstrapFewShotWithRandomSearch, COPRO, MIPROv2 and GEPA. For any other optimizer, the custom optimizer page shows how to log a step yourself.
Also check: Improve your agent (the loop the algorithms run inside), DSPy visualization, Prompt optimization with Langy.
Last modified on September 5, 2026