Skip to main content
POST
/
api
/
v1
/
online
/
sessions
from synth_ai.sdk.optimization import OfflineJob

job = await OfflineJob.create(
    algorithm="gepa",
    container_url="https://tunnel.example.com",
    policy={"model": "gpt-4o-mini", "provider": "openai"},
    gepa={
        "population": {
            "num_generations": 5,
            "children_per_generation": 4
        },
        "evaluation": {
            "seeds": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
        }
    }
)
{
  "job_id": "po_abc123",
  "status": "running"
}
GEPA (Genetic Evolution of Prompt Architectures) uses evolutionary search to optimize prompts through population-based exploration.
GEPA typically achieves 10-30% improvement over baseline prompts within 5 generations.
Set algorithm: "gepa" in your policy optimization request.

GEPA Configuration

gepa.population
object
required
Population and generation settings.
gepa.rollout
object
Rollout budget configuration.
gepa.evaluation
object
Evaluation configuration.
from synth_ai.sdk.optimization import OfflineJob

job = await OfflineJob.create(
    algorithm="gepa",
    container_url="https://tunnel.example.com",
    policy={"model": "gpt-4o-mini", "provider": "openai"},
    gepa={
        "population": {
            "num_generations": 5,
            "children_per_generation": 4
        },
        "evaluation": {
            "seeds": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
        }
    }
)
{
  "job_id": "po_abc123",
  "status": "running"
}

Full Example

Request
{
  "policy_optimization": {
    "algorithm": "gepa",
    "container_url": "https://tunnel.example.com",
    "container_api_key": "sk_env_...",
    "policy": {
      "model": "gpt-4o-mini",
      "provider": "openai",
      "temperature": 0.0,
      "max_completion_tokens": 256
    },
    "gepa": {
      "population": {
        "num_generations": 5,
        "children_per_generation": 4
      },
      "rollout": {
        "budget": 200
      },
      "evaluation": {
        "seeds": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
        "validation_seeds": [10, 11, 12, 13, 14]
      }
    }
  }
}

How GEPA Works

  1. Initialize — Start with your baseline prompt
  2. Mutate — Generate candidate variations using an LLM proposer
  3. Evaluate — Run each candidate against the seed dataset
  4. Select — Keep the best-performing candidates
  5. Repeat — Evolve the population over multiple generations
GEPA requires your container to be publicly accessible. Use SynthTunnel for local development.