optimize() API
GEPA, Pareto, artifact, and optimizer APIs.
Most Used
optimize
Convenience optimizer helper that composes AxBootstrapFewShot before AxGEPA and returns an artifact without applying final component changes.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | optimize |
| API section | Optimizers |
| Form | optimize(program, examples, options) |
| Returns | AxResult |
Important Options
student/clientteacher/reflection clientmetric budgetbootstrap
Examples
let artifact = optimize(&mut qa, train, json!({"maxMetricCalls": 100}))?;AxBootstrapFewShot
Few-shot demonstration optimizer that selects successful evaluator rollouts before prompt/component evolution.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxBootstrapFewShot |
| API section | Optimizers |
| Form | AxBootstrapFewShot::new(options) |
| Returns | optimizer engine |
Important Options
quality thresholdmax demosmax roundsbatch size
Examples
let bootstrap = AxBootstrapFewShot::new(json!({"qualityThreshold": 0.7}));AxGEPA
GEPA engine with Core-owned reflection, Pareto and bootstrap behavior. Artifacts report original-program baselineScore/baselineScores at the top level and in metadata, independently of the final frontier.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxGEPA |
| API section | Optimizers |
| Form | AxGEPA::new().with_reflection_client(reflection) |
| Returns | optimizer engine |
Important Options
reflection clientbudgetmetriccandidate countbaselineScorebaselineScores
Examples
let engine = AxGEPA::new(reflection_client, json!({}));OptimizerEngine
Optimizer boundary consumed by AxGen, AxAgent, and AxFlow optimization helpers.
| Field | Value |
|---|---|
| Kind | interface |
| Ax concept | OptimizerEngine |
| API section | Optimizers |
| Form | OptimizerEngine::optimize(request, evaluator) |
| Returns | optimized artifact |
Important Options
requestevaluator
OptimizerEvaluator
Evaluator callback boundary used by generated optimizers.
| Field | Value |
|---|---|
| Kind | interface |
| Ax concept | OptimizerEvaluator |
| API section | Optimizers |
| Form | OptimizerEvaluator::evaluate(request) |
| Returns | score/evidence result |
Important Options
dataset rowscandidate mapevidence
Advanced / internals / full reference
playbook
Bind an ACE-backed playbook to a program; agents also expose an agent-bound playbook handle.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | playbook |
| API section | Optimizers |
| Form | playbook(program, student, teacher, options) |
| Returns | AxPlaybook |
Important Options
student/clientteacherseed snapshotonline updatesverification budget
Examples
let pb = playbook(program, student, None::<Rc<RefCell<OpenAICompatibleClient>>>, json!({}));AxPlaybook
Persistent playbook with render/update/snapshot operations and agent-bound verified evolve over train/validation task sets.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxPlaybook |
| API section | Optimizers |
| Form | AxPlaybook / agent.playbook(...) |
| Returns | playbook handle |
Important Options
verifyminHeldInGainepsilonrunsPerTaskmaxMetricCallsmaxProposals
optimize_with_client
Run BootstrapFewShot and GEPA against a live student client. Reports the original baseline before bootstrap. The client-free optimize helper requires pre-scored tasks.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | optimize_with_client |
| API section | Optimizers |
| Form | optimize_with_client(&mut program, Rc<RefCell<Client>>, examples, options) |
| Returns | AxResult |
Important Options
Rc<RefCell<Client>>examplesvalidationExamplesbootstrapmaxMetricCalls
Examples
let artifact = optimize_with_client(&mut qa, student.clone(), train, json!({"maxMetricCalls": 100}))?;Full Reference
Open the full Rust reference. This page highlights the optimize symbols most relevant to everyday use.