Skip to main content

Evolutionary optimization for Google ADK agents

Project description

CI Coverage PyPI Python License Ruff docs vetted

gepa-adk

Evolutionary optimization for Google ADK agents.

What is this?

gepa-adk evolves AI agent instructions automatically. Give it an agent and training examples, and it finds better prompts through iterative improvement using genetic algorithms and Pareto frontier selection.

Supports single-agent evolution, multi-agent co-evolution, workflow optimization (Sequential, Loop, Parallel agents), output schema evolution, generation config tuning, and multimodal inputs including video.

Requirements

  • Python 3.12+
  • Ollama with a local model (recommended for development), or any model supported by LiteLLM

Installation

pip install gepa-adk
# For local models (recommended)
export OLLAMA_API_BASE=http://localhost:11434

Quick Start

Evolve a greeting agent to produce formal, Dickens-style greetings:

from google.adk.agents import LlmAgent
from google.adk.models.lite_llm import LiteLlm
from gepa_adk import evolve, run_sync, EvolutionConfig, SimpleCriticOutput

model = LiteLlm(model="ollama_chat/llama3.2:latest")

agent = LlmAgent(
    name="greeter",
    model=model,
    instruction="Greet the user appropriately.",
)

critic = LlmAgent(
    name="critic",
    model=model,
    instruction="Score for formal, Dickens-style greetings. 0.0-1.0.",
    output_schema=SimpleCriticOutput,
)

trainset = [
    {"input": "I am His Majesty, the King."},
    {"input": "I am your mother."},
    {"input": "I am a close friend."},
]

config = EvolutionConfig(
    max_iterations=5,
    patience=1,
    reflection_model="ollama_chat/llama3.2:latest",
)
result = run_sync(evolve(agent, trainset, critic=critic, config=config))
print(f"Score: {result.original_score:.2f} -> {result.final_score:.2f}")
print(result.evolved_components["instruction"])

Examples

Getting started:

Multi-agent & workflows:

Advanced:

Documentation

Getting Started · Guides · API Reference

Credits

Based on GEPA (source). Built on Google ADK (source).

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gepa_adk-2.1.0.tar.gz (180.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gepa_adk-2.1.0-py3-none-any.whl (218.0 kB view details)

Uploaded Python 3

File details

Details for the file gepa_adk-2.1.0.tar.gz.

File metadata

  • Download URL: gepa_adk-2.1.0.tar.gz
  • Upload date:
  • Size: 180.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for gepa_adk-2.1.0.tar.gz
Algorithm Hash digest
SHA256 5bdb6f9901342f111474070c4aae033f03aa10a25bb38f3a00f4d78ce327529c
MD5 183802550987a830b32d3bb095e6a084
BLAKE2b-256 3929ee16c0297339c755c3296f3fe6f693244d5f76f530e3ff6e44aa1300f936

See more details on using hashes here.

File details

Details for the file gepa_adk-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: gepa_adk-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 218.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for gepa_adk-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fac8a02191bbc1202d84bf3a646b88fc80bd3f77ea9dc6940ac5abb37140d92
MD5 b5753e37cd290503bc33117181e8182b
BLAKE2b-256 b47b75fe6cd42e5c4db3144faf8e362aa977a7158501e5e0bf771a4c280fe927

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page