GEPA reflective prompt evolution optimizer for superred agent targets
Project description
superred-optimizer-gepa-agentic
An agent-target variant of GEPA reflective prompt evolution for the superred red-teaming framework.
This keeps GEPA's core reflective-mutation loop — one evolving textual
candidate, refined between runs by a reflection LM call on the best-scoring
rollout so far — but adds an agentic delivery policy on top: at
initialize() it inspects the in-scope controllables, classifies which ones
look like agent content surfaces (tool returns, retrieved context, memory
records, web/document content — AgentDojo-style read__..., inspect-agent
tool:<name>, skill aliases, and generic memory/RAG/web hints all count as
weak signals), builds a deterministic per-run injection plan across whichever
surfaces actually fire (capped per run), and falls back to the plain prompt
channel only when no content surface is available. Reflection also gets
richer scoped context than the base optimizer: which surfaces were selected
and observed, preserved tool returns, static observables, and a bounded slice
of the agent trace.
This is a separate package from superred-optimizer-gepa — the chatbot
GEPA implementation there is intentionally left unchanged; see its
ASSUMPTIONS.md for the base algorithm and
this package's ASSUMPTIONS.md for the agentic delivery
layer and what is deliberately deferred (full Pareto-frontier maintenance,
full tool catalog register/replace).
Reference: Agrawal et al., "GEPA: Reflective Prompt Evolution Can Outperform
Reinforcement Learning," arXiv:2507.19457
(ICLR 2026); official reference implementation
gepa-ai/gepa (MIT License).
Install
pip install superred-optimizer-gepa-agentic
Usage
from gepa_agentic_optimizer import GEPAAgenticOptimizer
optimizer = GEPAAgenticOptimizer(
max_attempts=20,
max_content_injections_per_run=3,
)
Wire it into a Controller against an agent target (e.g. agentdojo_target,
inspect_agent_target) — see the framework's
architecture overview for a full
Controller.run() example.
Behaviour notes
- Surface naming is a weak signal, not a contract. Detection also uses PostCall metadata, value type, and runtime content shape, so it degrades gracefully against agent targets that don't follow the AgentDojo/inspect-agent naming conventions.
- GEPA-style strict-improvement acceptance: a reflected candidate only
stays in the pool if it succeeded or scored strictly better than its
parent, closer to the paper's acceptance test than the base
gepapackage's single-instance collapse (still not a full replay-based acceptance test, since superred has no fixed minibatch to replay). tool_catalog_rewrite_docgives a minimal text-rewrite capability when a visible tool catalog identifies a content/read/search-like tool; full register/replace of tool definitions is a documented follow-up, not implemented, because it needs a stricter JSON contract than this optimizer currently assumes.
License
MIT for this port's code. The reflective meta-prompt text is its own copy of
the same template superred-optimizer-gepa reproduces (both packages copy it
independently rather than one importing the other's), verbatim from
gepa-ai/gepa (MIT License, Copyright (c) 2025 Lakshya A Agrawal and the GEPA
contributors) — see the attribution comment in
src/gepa_agentic_optimizer/prompts.py.
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 superred_optimizer_gepa_agentic-0.1.0.tar.gz.
File metadata
- Download URL: superred_optimizer_gepa_agentic-0.1.0.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
407c246c63f7622562f1cac9401d8d8c91b84be4b9900373148317b740595efe
|
|
| MD5 |
10a2d6ac06d92cb92ba02e37750c6e41
|
|
| BLAKE2b-256 |
3e6a0f66f9562d36a17d32e429df5fbd5769e35cd413095e035b3f2f037ca51c
|
Provenance
The following attestation bundles were made for superred_optimizer_gepa_agentic-0.1.0.tar.gz:
Publisher:
release.yml on RoldSI/superred-modules
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superred_optimizer_gepa_agentic-0.1.0.tar.gz -
Subject digest:
407c246c63f7622562f1cac9401d8d8c91b84be4b9900373148317b740595efe - Sigstore transparency entry: 2214961417
- Sigstore integration time:
-
Permalink:
RoldSI/superred-modules@ff92389cd4ecc6690ecd16f410231274785c4afb -
Branch / Tag:
refs/tags/superred-optimizer-gepa-agentic-v0.1.0 - Owner: https://github.com/RoldSI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ff92389cd4ecc6690ecd16f410231274785c4afb -
Trigger Event:
push
-
Statement type:
File details
Details for the file superred_optimizer_gepa_agentic-0.1.0-py3-none-any.whl.
File metadata
- Download URL: superred_optimizer_gepa_agentic-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f6e599b4f3c5410dcf2d6469119d2586f9db9f0e9b2c9f43c861e487517e5c8
|
|
| MD5 |
81a4a3e5723824f64f7609ab69ed668b
|
|
| BLAKE2b-256 |
796e0d05a0570a651ac3da45aaf32a98ebfd04873f1bdf046073b6484d7cbcd0
|
Provenance
The following attestation bundles were made for superred_optimizer_gepa_agentic-0.1.0-py3-none-any.whl:
Publisher:
release.yml on RoldSI/superred-modules
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superred_optimizer_gepa_agentic-0.1.0-py3-none-any.whl -
Subject digest:
9f6e599b4f3c5410dcf2d6469119d2586f9db9f0e9b2c9f43c861e487517e5c8 - Sigstore transparency entry: 2214961438
- Sigstore integration time:
-
Permalink:
RoldSI/superred-modules@ff92389cd4ecc6690ecd16f410231274785c4afb -
Branch / Tag:
refs/tags/superred-optimizer-gepa-agentic-v0.1.0 - Owner: https://github.com/RoldSI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ff92389cd4ecc6690ecd16f410231274785c4afb -
Trigger Event:
push
-
Statement type: