skillfed

gepa

A framework for optimizing textual system components (AI prompts, code snippets, etc.) using LLM-based reflection and Pareto-efficient evolutionary search.

gepa v0.1.4 6.6M downloads/30d#1,880 on PyPI6,117
Permissive license MIT Active released

What it is and what it does

GEPA is a framework for automatically improving textual system components by treating optimization as a search problem guided by LLM reflection. Rather than collapsing execution outcomes into a single scalar reward, it reads full execution traces—error messages, profiling data, reasoning logs—to diagnose why a candidate failed and propose targeted improvements. The system uses Pareto-efficient evolutionary search to evolve high-performing variants with minimal evaluations, supporting optimization of prompts, code, agent architectures, scheduling policies, and other text-based artifacts.

The framework integrates with major AI platforms including DSPy, MLflow, Comet ML Opik, and Pydantic, offering both a standalone API and adapters for specialized tasks like RAG optimization, MCP tool descriptions, and LangChain pipelines. It requires Python 3.10+ and access to LLM APIs for reflection; the base package has no runtime dependencies, making installation straightforward.

Use it for:

  • Optimize system prompts for classification or reasoning tasks to improve accuracy without manual prompt engineering.
  • Evolve entire DSPy programs including signatures and control flow to discover better architectures automatically.
  • Improve RAG retrieval and generation by optimizing prompts across vector store backends like ChromaDB or Weaviate.
  • Discover cloud scheduling policies or other configuration parameters that beat expert heuristics on your workload.
  • Tune agent tool descriptions and system prompts for tool-using agents in LangChain or MCP environments.
  • Automatically learn and refine coding agent skills to improve task resolution rates on specialized domains.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

GEPA optimizes textual system components—prompts, code, agent architectures, configurations—using LLM-based reflection and Pareto-efficient evolutionary search to improve performance against any measurable metric.

Yes. GEPA is actively maintained, has no runtime dependencies, and offers a permissive MIT license. It solves a real problem—systematic optimization of textual system components—with a novel LLM-reflection approach that avoids the evaluation overhead of traditional RL methods. Integrations with DSPy, MLflow, and other major frameworks lower adoption friction. Primary constraint is the need for external LLM API access; evaluate whether your use case justifies the API costs.

Install

gepa on PyPI

pip

pip install gepa

uv

uv add gepa

poetry

poetry add gepa

Installing gepa

Before you install

Low friction installation with no runtime dependencies. Active maintenance—last commit 2026-08-14, released 2025-08-11, 6117 GitHub stars. Supports Python 3.10+.

License in practice

MIT license permits commercial and private use with minimal restrictions, making it suitable for production deployment in most contexts.

Quickstart

pip install gepa

import gepa

result = gepa.optimize(
    seed_candidate={"system_prompt": "You are a helpful assistant."},
    trainset=trainset,
    valset=valset,
    task_lm="openai/gpt-4.1-mini",
    max_metric_calls=150,
    reflection_lm="openai/gpt-5",
)
print(result.best_candidate['system_prompt'])

Requires Python 3.10 or later; LLM API access (e.g., OpenAI) needed for reflection and task evaluation.

Verify before relying

  • Whether the package requires external LLM API credentials to be pre-configured or if it handles credential management internally.
  • Performance characteristics and typical optimization time for different problem scales.
  • Whether adapters like ConfidenceAdapter and LangChain require separate installation steps beyond the base package.

Package facts

License MIT (permissive)
Python support supports the current Python release (<3.15,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 30 days since the last release
Last repo commit
First released
Downloads 6,628,234/month — #1,880 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: gepa-0.1.4-py3-none-any.whl

Tags

prompt optimization frameworkLLM-based evolutionary searchtext parameter tuningAI system optimizationPareto frontier searchautomated prompt improvementgenetic algorithm for prompts
prompt-optimizationevolutionary-searchllm-reflection

More Artificial Intelligence packages

Further reading