Post · 3 min read· pp. 166–168

OptimizeAnythingConfig

gepa.optimize_anything.OptimizeAnythingConfig(engine: str | Engine = 'gepa', name: str | None = None, max_evals: int | None = 100, max_token_cost: float | None = None, max_concurrency: int = 8, output_dir: str | Path | None = None, run_dir: str | None = None, stop_at_score: float | None = None, sandbox: bool = True, engine_config: dict[str, Any] = dict()) dataclass

Configuration for :func:gepa.optimize_anything.optimize_anything.

Attributes:

NameTypeDescription
engine`strEngine`
name`strNone`
max_evals`intNone`
max_token_cost`floatNone`
max_concurrencyintEval server thread-pool size.
output_dir`strPath
run_dir`strNone`
stop_at_score`floatNone`
sandboxboolOS-jail the subprocess engines' claude sessions (bwrap on Linux — requires the bubblewrap package — Claude Code's Seatbelt sandbox on macOS). Default True. Linux runs abort at engine start when bwrap is missing; False prints a loud warning and runs the agent unsandboxed with full host access.
engine_configdict[str, Any]Engine-specific options that don't generalize across engines. Each engine reads the keys it understands and warns about leftovers so typos surface. The keys an engine accepts are enumerated in that engine's class docstring: - gepa — a GEPAConfig-shaped dict, passed through 1-to-1. Its accepted keys are the live fields of :class:~gepa.gepa_launcher.GEPAConfig (engine, reflection, merge, refiner, tracking, callbacks, stop_callbacks); the OA layer only overlays the budget/run_dir/cost-cap and merges its own callbacks. Set the reflection LM, wandb/mlflow tracking, reasoning knobs (via reflection.reflection_lm_kwargs, e.g. reasoning_effort / thinking), and (via reflection.custom_candidate_proposer) a Claude Code proposer here — see :class:~gepa.oa.engines.gepa.GepaEngine. - autoresearch — model, ralph, max_no_eval_seconds, handoffs, effort, max_thinking_tokens (see AutoResearchEngine / _AR_CONFIG_KEYS). - best_of_n — model, temperature, max_n, lm_kwargs, effort, max_thinking_tokens (see BestOfNEngine / _BON_CONFIG_KEYS). - meta_harness — model, max_iterations, max_candidates_per_iter, effort, max_thinking_tokens (see MetaHarnessEngine / _MH_CONFIG_KEYS). effort (claude --effort) and max_thinking_tokens are Claude-CLI knobs, so they live in each agent engine's engine_config; the gepa engine takes reasoning knobs through reflection.reflection_lm_kwargs instead.

Attributes

engine: str | Engine = 'gepa' class-attribute instance-attribute

name: str | None = None class-attribute instance-attribute

max_evals: int | None = 100 class-attribute instance-attribute

max_token_cost: float | None = None class-attribute instance-attribute

max_concurrency: int = 8 class-attribute instance-attribute

output_dir: str | Path | None = None class-attribute instance-attribute

run_dir: str | None = None class-attribute instance-attribute

stop_at_score: float | None = None class-attribute instance-attribute

sandbox: bool = True class-attribute instance-attribute

engine_config: dict[str, Any] = field(default_factory=dict) class-attribute instance-attribute

Methods: