How the OpenAlpha_Evolve evolutionary cycle works
mainOpenAlpha_Evolve uses a modular, agent-based architecture to iteratively improve code through an evolutionary process. The cycle consists of the following stages:
- Task Definition: The user defines an algorithmic 'quest' with problem descriptions and input/output examples.
- Prompt Engineering (
PromptDesignerAgent): Crafts initial prompts for code generation, mutation prompts (requesting changes in 'diff' format), and bug-fix prompts. - Code Generation (
CodeGeneratorAgent): Uses an LLM (via LiteLLM) to generate Python code or apply 'diff' changes to existing code. - Evaluation (
EvaluatorAgent): Performs syntax checks and executes code in a sandboxed Docker container against user-provided examples. It calculates a Fitness Score based on correctness and efficiency. - Database (
DatabaseAgent): Stores programs, fitness scores, and evolutionary lineage (currently in-memory). - Selection (
SelectionControllerAgent): Applies 'survival of the fittest' by selecting Parents (for offspring) and Survivors (to advance to the next generation). - Iteration: The cycle repeats for a set number of generations.
- Orchestration (
TaskManagerAgent): Coordinates all agents and manages the overall loop.