API Reference
Welcome to the GEPA API Reference. This documentation is auto-generated from the source code docstrings.
optimize_anything
The primary public API for GEPA. Define a task, provide an evaluator, and choose an optimization engine.
optimize_anythingTaskOptimizeAnythingConfigEngineResultEvalServerBudgetTrackeroptimize_anything_with_serverlist_enginesregister_engine
GEPA Engine
Configuration for the built-in GEPA engine (engine="gepa"). These classes are passed via OptimizeAnythingConfig(engine_config={...}) to control GEPA-specific behavior.
GEPAConfigEngineConfigReflectionConfigMergeConfigRefinerConfigTrackingConfigEvaluatorOptimizationStateLogContextlogget_log_contextset_log_contextmake_litellm_lm
Core
The core module contains the main optimization function and fundamental classes.
Callbacks
Callback system for observing and instrumenting GEPA optimization runs.
GEPACallbackCompositeCallbackOptimizationStartEventOptimizationEndEventIterationStartEventIterationEndEventCandidateSelectedEventCandidateAcceptedEventCandidateRejectedEventEvaluationStartEventEvaluationEndEventValsetEvaluatedEventParetoFrontUpdatedEventMergeAttemptedEventMergeAcceptedEventMergeRejectedEventBudgetUpdatedEventErrorEventStateSavedEvent
Stop Conditions
Stop conditions control when optimization terminates.
StopperProtocolMaxMetricCallsStopperTimeoutStopConditionNoImprovementStopperScoreThresholdStopperFileStopperSignalStopperCompositeStopper
Adapters
Adapters integrate GEPA with different systems and frameworks.
Proposers
Proposers generate new candidate programs during optimization.
CandidateProposalProposeNewCandidateReflectiveMutationProposerMergeProposerSignatureLanguageModel
Logging
Logging utilities for tracking optimization progress.
Strategies
Strategies for various aspects of the optimization process.