Revolutionary Optimization
GEPA logo

GEPA Integration

Graph Enhanced Prompting Algorithm - Revolutionary reflective prompt optimization that leverages Large Language Models' ability to analyze and critique their own behavior, achieving dramatic performance improvements with minimal training data through domain-specific textual feedback.

Universal Workflow · Works for All Frameworks

How SuperOptiX Optimizes Any Framework with GEPA

SuperOptiX uses a single, universal GEPA workflow to optimize agents across frameworks like DSPy, OpenAI SDK, CrewAI, Pydantic AI, Google ADK, Microsoft, and DeepAgents. You keep one SuperSpec, and simply pick the target framework in configuration.

One spec, many runtimes

Define your agent once in SuperSpec, compile to any supported framework and let GEPA optimize.

Config, not re-writes

Switch between DSPy, Pydantic AI, CrewAI, and more just by changing a config field.

Same GEPA knobs

Metrics, budgets, and reflection models stay the same across frameworks.

Framework-agnostic logs

Consistent GEPA traces and metrics no matter which runtime you use.

🤖 DSPy
🔧 OpenAI SDK
🐍 Pydantic AI
👥 CrewAI
🔮 Google ADK
🏢 Microsoft
🌊 DeepAgents

Universal GEPA Configuration (Framework-Agnostic)

Same GEPA block, different framework and runtime targets

spec:
  framework: pydantic-ai # or dspy, crewaI, openai-sdk, google-adk…
  runtime: gepa
  optimization:
    optimizer:
      name: GEPA
      params:
        metric: answer_exact_match # or domain metric (math, legal, security…)
        auto: light # minimal, light, medium, heavy
        reflection_lm: qwen3:8b # shared reflection model across frameworks

One Workflow, Different Framework Targets

Same GEPA commands, just switch --framework

# Optimize a DSPy agent
super agent optimize support_oracle --framework dspy
# Optimize a Pydantic AI agent
super agent optimize developer --framework pydantic-ai
# Optimize a CrewAI research crew
super agent optimize research_crew --framework crewaI
GEPA API Mode

Default `legacy` + Experimental `optimize_anything`

SuperOptiX defaults to the stable legacy GEPA API mode and supports explicit opt-in to the experimental optimize_anything mode.

Mode Behavior

Docs-aligned behavior used by SuperOptiX CLI and playbooks

legacy is the default mode and preserves backward-compatible behavior.
optimize_anything is available as an explicit, experimental opt-in.
optimize_everything is accepted as an alias and mapped internally to optimize_anything.
If optimize_anything is unavailable in the installed GEPA version, SuperOptiX falls back to legacy automatically.

CLI Usage

Set mode explicitly with --gepa-api

# Default behavior (legacy)
super agent optimize my_agent --framework openai --auto light --reflection-lm ollama:llama3.1:8b
# Explicit legacy
super agent optimize my_agent --framework openai --auto light --reflection-lm ollama:llama3.1:8b --gepa-api legacy
# Experimental optimize_anything
super agent optimize my_agent --framework openai --auto light --reflection-lm ollama:llama3.1:8b --gepa-api optimize_anything

Playbook Configuration

Enable experimental mode with gepa_api in optimizer params

spec:
  optimization:
    optimizer:
      name: GEPA
      params:
        auto: light
        reflection_lm: llama3.1:8b
        gepa_api: optimize_anything  # optional; default is legacy

Research Foundation

GEPA is based on cutting-edge research in prompt optimization and reflective learning, demonstrating that reflective prompt evolution can outperform reinforcement learning approaches while requiring significantly less computational resources and training data.

The key innovation is GEPA's ability to utilize domain-specific textual feedback (compiler errors, medical guidelines, security advisories) rather than just numeric scores, enabling more targeted and effective optimization.

GEPA Architecture

Reflective Analysis

A reflection LM analyzes agent trajectories to identify specific failure modes and improvement opportunities

Prompt Evolution

New prompt candidates are generated based on reflective insights and domain-specific feedback

Graph Construction

A tree of evolved prompts is built, with Pareto-aware selection preserving improvements

Iterative Refinement

The process repeats, accumulating improvements over multiple generations

Why GEPA is Revolutionary

GEPA brings breakthrough capabilities that set it apart from traditional optimization approaches

Sample Efficiency

GEPA often achieves significant improvements with far fewer training examples than traditional methods. Where other optimizers might need hundreds of examples, GEPA can improve performance with just 3-10 well-chosen scenarios.

Domain Adaptability

GEPA excels at incorporating domain-specific knowledge through textual feedback, making it particularly effective for specialized applications like mathematics, medicine, law, and security.

Interpretable Improvements

Unlike black-box optimization, GEPA generates human-readable prompt improvements that you can understand and validate.

Multi-Objective Optimization

GEPA can simultaneously optimize for multiple criteria (accuracy, safety, compliance) through its feedback system.

🚀 Interactive GEPA Demo

For the most up-to-date GEPA information and examples, use the official optimization guide and GEPA repository instead of older demo repos.

End-to-end optimization workflow documented in the GEPA Optimization Guide
Official GEPA codebase and adapters in the primary GitHub repository
Up-to-date examples and integrations maintained by the GEPA team
Quick Demo Commands
# Install GEPA
uv pip install gepa
# Open SuperOptiX GEPA Optimization Guide
# https://docs.superoptix.ai/guides/gepa-optimization/
# View official GEPA repository
# https://github.com/gepa-ai/gepa

Complete Configuration Guide

Comprehensive GEPA configuration options with domain-specific setups and best practices

Basic GEPA Configuration

Standard GEPA setup with light budget for development

spec:
  optimization:
    optimizer:
      name: GEPA
      params:
        metric: answer_exact_match # Evaluation metric
        auto: light # Budget: light, medium, heavy
        reflection_lm: qwen3:8b # Model for reflection
        reflection_minibatch_size: 3 # Examples per reflection
        skip_perfect_score: true # Skip if already perfect

Quick Start Commands

Get started with GEPA in minutes

# 1. Pull a GEPA-ready agent
super agent pull advanced_math_gepa
# 2. Compile and establish baseline
super agent compile advanced_math_gepa
super agent evaluate advanced_math_gepa
# 3. Run GEPA optimization
super agent optimize advanced_math_gepa
# 4. Test optimized performance
super agent run advanced_math_gepa --goal "Solve x² + 5x - 6 = 0"

Available GEPA Agents

Pre-configured GEPA agents across multiple domains, each optimized for specific use cases with domain-specific feedback metrics

🧮 Mathematics & Analytics

Advanced Math GEPA Solver

Agent ID: advanced_math_gepa

Advanced

Domain & Specialization

Advanced mathematical problem solving

Specializes in: Quadratic equations, calculus, geometry, algebraic reasoning

Key Features

Step-by-step solution methodology
Multiple solution approaches
Verification and checking
Mathematical notation support
Educational explanations
# Quick start with this agent
super agent pull advanced_math_gepa
super agent compile advanced_math_gepa
super agent optimize advanced_math_gepa

Data Science GEPA

Agent ID: data_science_gepa

Statistical

Domain & Specialization

Statistical analysis and machine learning

Specializes in: Data analysis, statistical inference, ML insights, hypothesis testing

Key Features

Statistical methodology validation
Data visualization recommendations
Hypothesis testing frameworks
ML model selection guidance
Scientific rigor validation
# Quick start with this agent
super agent pull data_science_gepa
super agent compile data_science_gepa
super agent optimize data_science_gepa

🏥 Healthcare & Medical

Medical Assistant GEPA

Agent ID: medical_assistant_gepa

Clinical

Domain & Specialization

Clinical decision support and medical information

Specializes in: Medical knowledge synthesis, patient education, clinical reasoning

Key Features

Safety-focused medical information
Evidence-based recommendations
Patient education materials
Clinical decision support
Medical terminology accuracy
# Quick start with this agent
super agent pull medical_assistant_gepa
super agent compile medical_assistant_gepa
super agent optimize medical_assistant_gepa

⚖️ Legal & Compliance

Contract Analyzer GEPA

Agent ID: contract_analyzer_gepa

Legal

Domain & Specialization

Legal contract analysis and risk assessment

Specializes in: Contract review, risk identification, compliance verification

Key Features

Legal risk assessment
Compliance verification
Contract clause analysis
Regulatory framework alignment
Risk mitigation strategies
# Quick start with this agent
super agent pull contract_analyzer_gepa
super agent compile contract_analyzer_gepa
super agent optimize contract_analyzer_gepa

💼 Enterprise & Finance

Enterprise Extractor GEPA

Agent ID: enterprise_extractor_gepa

Enterprise

Domain & Specialization

Enterprise document processing and information extraction

Specializes in: Multi-component analysis, structured data extraction, business intelligence

Key Features

Multi-aspect document analysis
Structured information extraction
Business intelligence insights
Risk assessment integration
Executive summary generation
# Quick start with this agent
super agent pull enterprise_extractor_gepa
super agent compile enterprise_extractor_gepa
super agent optimize enterprise_extractor_gepa

🔒 Security & Privacy

Security Analyzer GEPA

Agent ID: security_analyzer_gepa

Security

Domain & Specialization

Security vulnerability detection and code analysis

Specializes in: Vulnerability detection, secure coding practices, security assessment

Key Features

Vulnerability detection
Security best practices
Remediation guidance
Compliance framework alignment
Risk severity assessment
# Quick start with this agent
super agent pull security_analyzer_gepa
super agent compile security_analyzer_gepa
super agent optimize security_analyzer_gepa

Privacy Delegate GEPA

Agent ID: privacy_delegate_gepa

Privacy-preserving

Domain & Specialization

Privacy-preserving task delegation and data handling

Specializes in: Data anonymization, privacy compliance, secure information handling

Key Features

Privacy preservation techniques
Data anonymization strategies
Regulatory compliance (GDPR, CCPA)
Secure delegation workflows
Privacy risk assessment
# Quick start with this agent
super agent pull privacy_delegate_gepa
super agent compile privacy_delegate_gepa
super agent optimize privacy_delegate_gepa

Performance Benchmarks

Real-world performance improvements across different domains with GEPA vs traditional optimization

DomainBaselineGEPA ResultSIMBA ResultGEPA AdvantageDescription
Mathematics
60%
95%
90%
+35%
Quadratic equations and geometric problems with step-by-step reasoning
Document Analysis
45%
85%
70%
+40%
Multi-component enterprise document processing and extraction
Security Analysis
70%
95%
80%
+25%
Vulnerability detection with detailed remediation guidance
General Q&A
80%
88%
85%
+8%
General-purpose question answering and reasoning tasks

* Benchmarks based on SuperOptiX testing with llama3.1:8b on M4 Max (128GB). Results may vary based on hardware and configuration.

⚠️ Important: GEPA and Tool-Calling Agents

GEPA is not compatible with ReAct agents that use tool calling (Genies tier and above).This includes any agent with tool integration.

Why GEPA doesn't work with tool-calling agents:

Complex Output Format: ReAct agents produce structured outputs with tool calls, reasoning steps, and observations that don't match GEPA's expected simple text format
Tool Call Parsing: GEPA's evaluation metrics expect simple string outputs, but ReAct produces complex multi-step trajectories
Trajectory Complexity: GEPA analyzes reasoning trajectories, but tool-enhanced ReAct has much more complex multi-step workflows

Agent Tier Compatibility:

Oracles Tier: No tools, simple reasoning
GEPA Compatible
Genies+ Tiers: ReAct + Tools, complex workflows
Use BootstrapFewShot, SIMBA
# Error symptoms you might see:
WARNING: Failed to unpack prediction and trace. This is likely due to the LLM response not following dspy formatting.
INFO: No trajectories captured. Skipping.
Average Metric: 0.0 / 5 (0.0%)

Complete GEPA Documentation

Explore comprehensive guides, API references, and practical examples

GEPA Optimization Guide

Complete guide to GEPA optimization with examples and best practices

DSPy Optimizers Reference

Complete DSPy optimizers documentation including GEPA and alternatives

GEPA optimize_anything (Experimental)

Official GEPA experimental API docs for optimize_anything usage and parameters

GEPA Integration Examples

Practical implementation examples and working demonstrations

GEPA GitHub Repository

Official GEPA implementation, adapters, and examples from the core team

Quick Start Guide

Get started with SuperOptiX and GEPA in minutes

Ready to Transform Your Agents with GEPA?

Experience the power of reflective prompt optimization and see dramatic performance improvements with minimal training data. GEPA represents the future of agent optimization.