Skip to content

Task

gepa.optimize_anything.Task(name: str, seed_candidate: str | dict[str, str] | None = None, objective: str = '', background: str = '', train_set: list[Any] | None = None, val_set: list[Any] | None = None, test_set: list[Any] | None = None) dataclass

A task definition for the optimize_anything API.

Attributes:

Name Type Description
name str

Unique identifier (e.g. "circle_packing").

seed_candidate str | dict[str, str] | None

Seed to evolve from — a single text string, or a {component: text} dict for multi-component optimization (the gepa engine co-optimizes the components; other engines treat the seed as a single text). None for seedless mode, where the engine bootstraps the first candidate from objective / background.

objective str

Short goal statement (e.g. "Maximize sum of circle radii"). Surfaced verbatim by every engine as the optimization goal.

background str

Long-form context — problem statement, evaluation rules, domain notes. Surfaced verbatim by every engine.

train_set list[Any] | None

Optional training examples (used for optimization). Items are opaque — any object the evaluator understands.

val_set list[Any] | None

Optional validation examples (used for candidate selection).

test_set list[Any] | None

Optional held-out test examples. Held outside the eval server and scored (seed + optimized) outside the budget only when present; skipped entirely when omitted.

Attributes

name: str instance-attribute

seed_candidate: str | dict[str, str] | None = None class-attribute instance-attribute

objective: str = '' class-attribute instance-attribute

background: str = '' class-attribute instance-attribute

train_set: list[Any] | None = None class-attribute instance-attribute

val_set: list[Any] | None = None class-attribute instance-attribute

test_set: list[Any] | None = None class-attribute instance-attribute

has_dataset: bool property

Methods: