High-Level Architecture
Core Classes
Runner (skydiscover/runner.py:24)
Top-level entry point that manages the complete discovery run:
- Load configuration and initial program
- Create database and discovery controller
- Run the discovery loop with checkpointing
- Manage monitor server and human feedback
- Save best program and generate reports
DiscoveryController (skydiscover/search/default_discovery_controller.py)
Executes the core sample → prompt → LLM → evaluate → add loop:
_run_iteration):
1
Sample
Call
database.sample() to get parent and context programs2
Build Prompts
Use
PromptBuilder to create system/user messages with code and feedback3
Generate
Call
llms.generate() to get new program from LLM4
Evaluate
Run
evaluator.evaluate_program() to score the program5
Return Result
Package program, metrics, and parent info into
SerializableResultrun_discovery() to implement:
- Acceptance gating (GEPA)
- Island migration (AdaEvolve)
- Strategy co-evolution (EvoX)
ProgramDatabase (skydiscover/search/base_database.py:75)
Abstract base class for program storage and sampling:
Database Helper Methods
Database Helper Methods
Evaluator (skydiscover/evaluation/evaluator.py:21)
Runs user-provided evaluation functions with timeout and retry:
- Stage 1: Fast validation (e.g., syntax check, basic tests)
- Threshold Check: Only proceed if stage 1 score exceeds threshold
- Stage 2: Full evaluation (e.g., comprehensive benchmarks)
evaluate_stage1() and evaluate_stage2() in your evaluator file.
Data Flow
Program Object
TheProgram dataclass (skydiscover/search/base_database.py:23) carries all information about a candidate:
Evaluation Result
The evaluator returns metrics and optional artifacts:combined_score: Primary optimization target (required)- Any additional numeric metrics (e.g.,
accuracy,latency,cost)
- Error messages or debugging info
- Textual feedback injected into next LLM prompt
- Test results or performance breakdowns
Configuration
SkyDiscover uses a typed configuration system:Registry System
Search algorithms are registered at import time inskydiscover/search/route.py:36:
--search flag maps to these registrations at runtime.
Checkpointing
Checkpoints save full state for resumption:Monitoring
The optional monitor provides real-time visibility:http://localhost:8080/ during runs.
Extension Points
Custom Search Algorithm
Subclass
See
ProgramDatabase and implement add() + sample()See
skydiscover/search/README.md:17Custom Controller
Subclass
See
DiscoveryController and override run_discovery()See
skydiscover/search/README.md:80Custom Context Builder
Control prompt construction logic
See
See
skydiscover/context_builder/README.mdCustom Evaluator
Define
See Evaluators
evaluate(program_path) functionSee Evaluators
Related
Search Algorithms
Learn about available algorithms
Evaluators
Write effective evaluation functions