Skip to main content

Core SDK for LLM-driven evolutionary search over executable or structured solutions.

Project description

EvoToolkit Core

EvoToolkit is the core SDK for LLM-driven evolutionary search over executable or structured solutions.

The stable 1.0.2 package intentionally ships only reusable building blocks:

  • built-in methods: EoH, EvoEngineer, FunSearch
  • runtime lifecycle bases: Method, IterativeMethod, PopulationMethod
  • checkpointing and readable artifacts through RunStore
  • generic PythonTask and StringTask SDK layers
  • generic Python and string interfaces for the built-in methods
  • OpenAI-compatible HTTP client utilities in evotoolkit.tools

Concrete domain tasks, hardware-backed workflows, and application-specific examples should live in your own package or repository on top of this core.

Install

pip install evotoolkit

Quick Start

from 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,
)
best_solution = algo.run()

Documentation

The published documentation mirrors the docs/ directory and keeps the core pages in English and Chinese:

  • index
  • installation
  • quickstart
  • extensions
  • migration

Development

uv sync --group dev
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run mkdocs build
uv build --out-dir dist

The runnable repository example lives in examples/custom_task/my_custom_task.py.

Runtime Artifacts

Each run writes:

  • checkpoint/state.pkl
  • checkpoint/manifest.json
  • readable history/*.json
  • readable summary/*.json

Checkpoint restore is explicit: recreate the algorithm object, call load_checkpoint(), then call run() again.

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

evotoolkit-1.0.2.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

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

evotoolkit-1.0.2-py3-none-any.whl (46.1 kB view details)

Uploaded Python 3

File details

Details for the file evotoolkit-1.0.2.tar.gz.

File metadata

  • Download URL: evotoolkit-1.0.2.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for evotoolkit-1.0.2.tar.gz
Algorithm Hash digest
SHA256 830c7bba951e03989c6acd17ddc7721a0cb81515eb24fe0a24f192089b5a0dc4
MD5 34f407541edb383ac6aca1354c8ea236
BLAKE2b-256 b6c03787e9b39f4bd7d054a756d925d430a9055068e08f40baefe29a05d3d374

See more details on using hashes here.

File details

Details for the file evotoolkit-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: evotoolkit-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 46.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for evotoolkit-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1b372410b3aed5b1049b9983a79bde4d58ecbfe9a45b7b3fd12b17019dfbbd9f
MD5 53b004ac974802a3b0b9ef94ee6668c2
BLAKE2b-256 6808ecc77d0266e36c1f9fce92b9066527d381a66f3d7610420a6a812831555f

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