Skip to main content
SkyDiscover is built on a clean layered architecture that separates concerns and enables extensibility.

High-Level Architecture

Core Classes

Runner (skydiscover/runner.py:24)

Top-level entry point that manages the complete discovery run:
Responsibilities:
  • 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
Key Methods:

DiscoveryController (skydiscover/search/default_discovery_controller.py)

Executes the core sample → prompt → LLM → evaluate → add loop:
Key Loop:
Single Iteration (_run_iteration):
1

Sample

Call database.sample() to get parent and context programs
2

Build Prompts

Use PromptBuilder to create system/user messages with code and feedback
3

Generate

Call llms.generate() to get new program from LLM
4

Evaluate

Run evaluator.evaluate_program() to score the program
5

Return Result

Package program, metrics, and parent info into SerializableResult
Advanced algorithms can override run_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:
Provided Methods:

Evaluator (skydiscover/evaluation/evaluator.py:21)

Runs user-provided evaluation functions with timeout and retry:
Evaluation Flow:
Cascade Evaluation: For expensive evaluations, use two-stage cascade:
  1. Stage 1: Fast validation (e.g., syntax check, basic tests)
  2. Threshold Check: Only proceed if stage 1 score exceeds threshold
  3. Stage 2: Full evaluation (e.g., comprehensive benchmarks)
Define evaluate_stage1() and evaluate_stage2() in your evaluator file.

Data Flow

Program Object

The Program dataclass (skydiscover/search/base_database.py:23) carries all information about a candidate:

Evaluation Result

The evaluator returns metrics and optional artifacts:
Metrics:
  • combined_score: Primary optimization target (required)
  • Any additional numeric metrics (e.g., accuracy, latency, cost)
Artifacts:
  • Error messages or debugging info
  • Textual feedback injected into next LLM prompt
  • Test results or performance breakdowns

Configuration

SkyDiscover uses a typed configuration system:
See Configuration Guide for all options.

Registry System

Search algorithms are registered at import time in skydiscover/search/route.py:36:
The --search flag maps to these registrations at runtime.

Checkpointing

Checkpoints save full state for resumption:
Resume with:

Monitoring

The optional monitor provides real-time visibility:
Access at http://localhost:8080/ during runs.

Extension Points

Custom Search Algorithm

Subclass ProgramDatabase and implement add() + sample()
See skydiscover/search/README.md:17

Custom Controller

Subclass DiscoveryController and override run_discovery()
See skydiscover/search/README.md:80

Custom Context Builder

Control prompt construction logic
See skydiscover/context_builder/README.md

Custom Evaluator

Define evaluate(program_path) function
See Evaluators

Search Algorithms

Learn about available algorithms

Evaluators

Write effective evaluation functions