Skip to content

ace_optimizer

diapason.learning.agents.ace_optimizer

ACE agent optimizer — context evolution via the ACE Generator / Reflector / Curator triad.

ACE (ace-agent/ace <https://github.com/ace-agent/ace>_) optimizes agent context — an annotated natural-language playbook of strategies the agent reads at inference time — rather than mutating prompts (DSPy) or evolving prompt populations (GEPA). The output is a textual playbook with entries like::

[str-00001] helpful=5 harmful=0 :: When the user asks for a unit
                                   conversion, prefer the exact
                                   rational form before rounding.

The wrapper adapts Diapason traces into ACE's train_samples / val_samples / test_samples shape, builds a minimal DataProcessor from the trace feedback signal, runs ACE in offline mode, and writes the resulting final_playbook.txt as a sidecar overlay under ~/.diapason/learning/ace/<task>/ for the agent runtime to pick up on next start.

ACE is not on PyPI as of v1.0.1. The learning-ace extra installs from the upstream git repo; if the import fails we surface a status="error" with the install hint.

ACEAgentOptimizer

Optimize an agent's playbook context using ACE.

Parameters

config: :class:ACEOptimizerConfig controlling models, run length, and output location.

optimize(trace_store)

Run ACE offline-mode optimization on traces from the store.

Returns a status dict mirroring DSPy / GEPA shape: {"status": "completed" | "skipped" | "error", ...}.