Evolutionary optimization for Google ADK agents
Project description
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.
Installation
pip install gepa-adk
export GOOGLE_API_KEY=your-api-key # or other ADK-supported model
Quick Start
Evolve a greeting agent to produce formal, Dickens-style greetings:
import asyncio
from google.adk.agents import LlmAgent
from gepa_adk import evolve, EvolutionConfig, SimpleCriticOutput
agent = LlmAgent(
name="greeter",
model="gemini-2.5-flash",
instruction="Greet the user appropriately.",
)
critic = LlmAgent(
name="critic",
model="gemini-2.5-flash",
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="gemini-2.5-flash", # Model for generating improvements
)
result = asyncio.run(evolve(agent, trainset, critic=critic, config=config))
print(f"Score: {result.original_score:.2f} -> {result.final_score:.2f}")
print(result.evolved_components["instruction"])
Examples
- basic_evolution.py — Single agent with critic
- critic_agent.py — Custom critic for stories
- multi_agent.py — Multi-agent evolution
Documentation
Getting Started · Guides · API Reference
Credits
Based on GEPA (source). Built on Google ADK (source).
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gepa_adk-1.0.1.tar.gz.
File metadata
- Download URL: gepa_adk-1.0.1.tar.gz
- Upload date:
- Size: 165.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cef3683ff45cc7e0607c2bab14b0d4852799bc49fe5eb2ad8867905868c542a6
|
|
| MD5 |
54df4a2eac4c7967a984019371631659
|
|
| BLAKE2b-256 |
e18931d6ebaedb795d53b00369be35bb94aa39a956f3add99c2578ab6ac5ee56
|
File details
Details for the file gepa_adk-1.0.1-py3-none-any.whl.
File metadata
- Download URL: gepa_adk-1.0.1-py3-none-any.whl
- Upload date:
- Size: 202.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
118960aca91d7cf42f7678296afbe41f7241786a62072f6da4bdfdafae4a9b35
|
|
| MD5 |
1391f5b4f687441de808e575783c7755
|
|
| BLAKE2b-256 |
1921e54f09463fd31f80bee8899ad99680458078aeb7e6f43d41326c36450354
|