Skip to main content

EvoToolkit

LLM-driven program search, reduced to five composable parts.

CI PyPI Python Docs License: MIT

English · 简体中文


EvoToolkit is a small Python harness for evolving executable artifacts with language models: Python modules, CUDA kernels, prompts, or any set of text files. You write one Evaluator; the toolkit supplies the search loop, the strategies, the LLM and coding-agent adapters, and a replayable event log.

Why 2.0

One loop, many strategies EoHStrategy, EvoEngineerStrategy and FunSearchStrategy share the same Runner, budget accounting and log format, so results are comparable.
Chat models or coding agents ChatProposer wraps any chat-completions endpoint. AgentProposer drives Claude Code, Codex and friends through headless-cli.
Artifacts are file sets A solution is dict[path, content] with a content-hash identity. Single-file tasks set main_file and never notice.
Replayable, no pickle Every solution, failed call and RNG snapshot goes to events.jsonl; full prompts and transcripts go to traces/. Runner.resume() rebuilds state from the log.
Honest budgets budget counts evaluated proposals. Parse errors and empty responses are failed calls that do not spend it; max_calls caps the total.
Generational or steady Batch-and-observe, or continuously refill proposer workers and observe each result as it lands.

Install

pip install evotoolkit

Python 3.10+. The only runtime dependency is NumPy.

Quick start

from evotoolkit import EvaluationResult, Runner, TaskSpec
from evotoolkit.proposers import ChatProposer
from evotoolkit.strategies import EoHStrategy
from evotoolkit.tools import HttpsApi


class Evaluator:
    spec = TaskSpec("greeting", "Write exactly hello in answer.txt.", "string", "answer.txt")

    def evaluate(self, files):
        text = files.get("answer.txt", "").strip()
        return EvaluationResult(True, float(text == "hello"), "")


evaluator = Evaluator()
llm = HttpsApi(api_url="https://api.openai.com/v1/chat/completions", key="your-key", model="gpt-4o")
runner = Runner(
    evaluator=evaluator,
    proposer=ChatProposer(llm),
    strategy=EoHStrategy(evaluator.spec),
    output_dir="results/greeting",
    budget=20,
    seed=0,
)
best = runner.run()
print(best.files if best else "No valid result")

Swap EoHStrategy for EvoEngineerStrategy or FunSearchStrategy without touching the rest. To try it without an API key, run the bundled offline example:

git clone https://github.com/pgg3/evotoolkit && cd evotoolkit
uv sync --group dev
uv run python examples/custom_task/my_custom_task.py --offline --output-dir results/demo

How it fits together

Runner ──► Strategy ──► Archive        which parents, which instruction?
  ├──────► Proposer                    new artifacts from parents + instruction
  ├──────► Evaluator                   how good is this artifact?
  └──────► EventLog                    append-only JSONL, replayed on resume

Components are protocols, not base classes: any object with the right methods works. See Extensions and API for the contracts and built-ins.

Resume

runner = Runner.resume("results/greeting", evaluator=evaluator,
                       proposer=ChatProposer(llm), strategy=EoHStrategy(evaluator.spec))
best = runner.run()

Documentation

evotoolkit.readthedocs.io · Quick start · Extensions and API · Design

Upgrading from 1.x

2.0 is a clean break. Method, Task, Interface, the per-method state classes and pickle checkpoints are gone, with no shims. Pin evotoolkit<2 to stay on 1.x.

Notes

Child processes and temporary workspaces are not security sandboxes; isolate untrusted code yourself. AgentProposer needs a separately installed headless CLI and an authenticated backend.


MIT License · © Ping Guo

Metadata

Release files for evotoolkit 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for evotoolkit 2.0.0
File Size Uploaded Provenance Actions
evotoolkit-2.0.0.tar.gz 23.4 kB With provenance Details for evotoolkit-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for evotoolkit 2.0.0
File Interpreter ABI Platform Actions
evotoolkit-2.0.0-py3-none-any.whl Python 3 none any Details for evotoolkit-2.0.0-py3-none-any.whl

Total release size: 52.9 kB

Release files / evotoolkit-2.0.0.tar.gz

Download URL evotoolkit-2.0.0.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9bc2765bb33133b16e6dfa560a047adfb05de490c7cded91a05e1fbf2b0b7877
BLAKE2b-256 checksum
How to use checksums
6c420a08036e6a2119947e370be218e1e430c6e99520caa675041afbfd56eda2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / evotoolkit-2.0.0-py3-none-any.whl

Download URL evotoolkit-2.0.0-py3-none-any.whl
Size 29.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d979f8661ac909de24c429d197853afd62591de3d71237dc9623987e7b13d8e
BLAKE2b-256 checksum
How to use checksums
33a83bb6bf07ee1a6de255c79d4fedfe567a507fbd6892bb8a0c386de001b848
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Security for evotoolkit 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for evotoolkit-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page