Function Signature
Description
A convenience wrapper aroundrun_discovery designed for the common case where:
- The initial solution is a plain string (not a file path)
- The evaluator is a Python callable function (not a file path)
Parameters
Callable[[str], Dict[str, Any]]
required
A callable function that evaluates a program and returns a metrics dictionary.Function signature:
(solution: str) -> Dict[str, Any]The function receives the program as a string and must return a dictionary containing evaluation metrics. The score is extracted using the combined_score key or by aggregating other numeric metrics.Optional[str]
Starting solution as a plain string. If
None, the LLM generates a solution from scratch.Default: Noneint
Maximum number of iterations to run.Default:
100Optional[str]
Search algorithm name.Options:
"topk"- Top-K sampling"adaevolve"- Adaptive Evolution"evox"- EvoX backend"openevolve_native"- OpenEvolve native
None (uses config file)Optional[str]
Model name(s), comma-separated.Examples:
"gpt-5""gpt-5,gemini/gemini-3-pro"
None (uses config file)Any
Additional keyword arguments passed to
run_discovery.Common options:config: Configuration file path or Config objectoutput_dir: Directory for resultssystem_prompt: Domain-specific context for the LLMagentic: Enable agentic modeapi_base: Custom API endpointcleanup: Remove temporary files after completion
Returns
DiscoveryResult
Result object containing:
Examples
Basic Usage
Starting from Scratch
Multi-Objective Optimization
With Custom Configuration
Different Search Algorithms
Error Handling
Invalid Evaluator Return Type
Evaluator Timeout
Notes
- This function is a thin wrapper around
run_discoveryfor convenience - The evaluator function receives the solution as a string (not a file path)
- The evaluator must return a dictionary; the score is derived from:
combined_scorekey (if present), or- Aggregation of other numeric values
- Use
run_discoverydirectly if you need more control or file-based workflows - The evaluator function is automatically converted to a file-based evaluator internally
See Also
- run_discovery - Main discovery function with more options
- DiscoveryResult - Result object details
- Runner - Lower-level discovery runner class