optimize() API GEPA optimizer, Pareto, artifact, and evaluation APIs. rust api api/optimize packages/rust/axir-api.json api optimize() API

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.

FieldValue
Kindfunction
Ax conceptoptimize
API sectionOptimizers
Formoptimize(program, examples, options)
ReturnsAxResult

Important Options

  • student/client
  • teacher/reflection client
  • metric budget
  • bootstrap

Examples

Rust
let artifact = optimize(&mut qa, train, json!({"maxMetricCalls": 100}))?;

Full reference

AxBootstrapFewShot

Few-shot demonstration optimizer that selects successful evaluator rollouts before prompt/component evolution.

FieldValue
Kindtype
Ax conceptAxBootstrapFewShot
API sectionOptimizers
FormAxBootstrapFewShot::new(options)
Returnsoptimizer engine

Important Options

  • quality threshold
  • max demos
  • max rounds
  • batch size

Examples

Rust
let bootstrap = AxBootstrapFewShot::new(json!({"qualityThreshold": 0.7}));

Full reference

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.

FieldValue
Kindtype
Ax conceptAxGEPA
API sectionOptimizers
FormAxGEPA::new().with_reflection_client(reflection)
Returnsoptimizer engine

Important Options

  • reflection client
  • budget
  • metric
  • candidate count
  • baselineScore
  • baselineScores

Examples

Rust
let engine = AxGEPA::new(reflection_client, json!({}));

Full reference

OptimizerEngine

Optimizer boundary consumed by AxGen, AxAgent, and AxFlow optimization helpers.

FieldValue
Kindinterface
Ax conceptOptimizerEngine
API sectionOptimizers
FormOptimizerEngine::optimize(request, evaluator)
Returnsoptimized artifact

Important Options

  • request
  • evaluator

Full reference

OptimizerEvaluator

Evaluator callback boundary used by generated optimizers.

FieldValue
Kindinterface
Ax conceptOptimizerEvaluator
API sectionOptimizers
FormOptimizerEvaluator::evaluate(request)
Returnsscore/evidence result

Important Options

  • dataset rows
  • candidate map
  • evidence

Full reference

Advanced / internals / full reference

playbook

Bind an ACE-backed playbook to a program; agents also expose an agent-bound playbook handle.

FieldValue
Kindfunction
Ax conceptplaybook
API sectionOptimizers
Formplaybook(program, student, teacher, options)
ReturnsAxPlaybook

Important Options

  • student/client
  • teacher
  • seed snapshot
  • online updates
  • verification budget

Examples

Rust
let pb = playbook(program, student, None::<Rc<RefCell<OpenAICompatibleClient>>>, json!({}));

Full reference

AxPlaybook

Persistent playbook with render/update/snapshot operations and agent-bound verified evolve over train/validation task sets.

FieldValue
Kindtype
Ax conceptAxPlaybook
API sectionOptimizers
FormAxPlaybook / agent.playbook(...)
Returnsplaybook handle

Important Options

  • verify
  • minHeldInGain
  • epsilon
  • runsPerTask
  • maxMetricCalls
  • maxProposals

Full reference

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.

FieldValue
Kindfunction
Ax conceptoptimize_with_client
API sectionOptimizers
Formoptimize_with_client(&mut program, Rc<RefCell<Client>>, examples, options)
ReturnsAxResult

Important Options

  • Rc<RefCell<Client>>
  • examples
  • validationExamples
  • bootstrap
  • maxMetricCalls

Examples

Rust
let artifact = optimize_with_client(&mut qa, student.clone(), train, json!({"maxMetricCalls": 100}))?;

Full reference

Full Reference

Open the full Rust reference. This page highlights the optimize symbols most relevant to everyday use.

Docs