EvoToolkit is the stable core SDK for LLM-driven evolutionary search over executable or structured solutions.
1.0.0 is the first stable release of the standalone runtime. The package intentionally ships only reusable building blocks:
- evolutionary algorithms:
EoH,EvoEngineer,FunSearch - runtime lifecycle bases:
Method,IterativeMethod,PopulationMethod - checkpointing and readable artifacts through
RunStore - generic
PythonTaskandStringTaskSDK layers - generic Python and String interfaces for the built-in methods
Concrete domain tasks should live in external packages or in your own repository on top of this core.
pip install evotoolkitfrom evotoolkit import EvoEngineer
from evotoolkit.core import EvaluationResult, TaskSpec
from evotoolkit.task.python_task import EvoEngineerPythonInterface, PythonTask
from evotoolkit.tools import HttpsApi
class SquareTask(PythonTask):
def build_python_spec(self, data) -> TaskSpec:
return TaskSpec(
name="square",
prompt="Write a Python function `f(x)` that returns a numeric value.",
modality="python",
)
def _evaluate_code_impl(self, candidate_code: str) -> EvaluationResult:
namespace = {}
exec(candidate_code, namespace) # noqa: S102
if "f" not in namespace:
return EvaluationResult(valid=False, score=float("-inf"), additional_info={"error": "Function `f` was not defined."})
return EvaluationResult(valid=True, score=float(namespace["f"](3)), additional_info={})
task = SquareTask(data=None)
interface = EvoEngineerPythonInterface(task)
llm_api = HttpsApi(
api_url="https://api.openai.com/v1/chat/completions",
key="your-api-key",
model="gpt-4o",
)
algo = EvoEngineer(
interface=interface,
output_path="./results",
running_llm=llm_api,
max_generations=5,
)
result = algo.run()The intended extension workflow is explicit:
- Define a
PythonTaskorStringTask. - Return a
TaskSpecfrombuild_python_spec()orbuild_string_spec(). - Pair the task with a generic interface such as
EvoEngineerPythonInterface. - Instantiate a method class directly and call
run().
If you need a domain package, keep those concrete tasks outside src/evotoolkit and expose them through your own package imports.
A runnable reference implementation lives in examples/custom_task/my_custom_task.py.
uv sync --group dev
uv run pytest
uv run mkdocs build
uv build --out-dir distEach run writes:
checkpoint/state.pklcheckpoint/manifest.json- readable
history/*.json - readable
summary/*.json
Checkpoint restore is explicit: recreate the algorithm object, call load_checkpoint(), then call run() again.