Overview
When you callkapso.evolve(), Kapso orchestrates a multi-step process that generates, tests, and refines code until a satisfactory solution is found.
Step-by-Step Execution
1. Initialization
Whenevolve() is called:
- ProblemHandler - Wraps the goal with evaluation logic
- OrchestratorAgent - Coordinates the solve loop
- SearchStrategy - Manages solution exploration
- ExperimentWorkspace - Git repository for experiments
2. The Solve Loop
The orchestrator runs iterations until a stop condition is met:3. Context Gathering
The context manager assembles information for the coding agent:4. Solution Generation
The search strategy generates solution candidates: Linear Search (simple):5. Code Generation
The coding agent receives a prompt and generates code:6. Debugging Loop
If code fails, the debug loop attempts fixes:7. Evaluation
The problem handler runs the code and scores it:8. Stop Condition Check
After each experiment, stop conditions are checked:9. Result Collection
When the loop ends, the best solution is returned:Git Branch Structure
Each experiment runs on its own branch:RepoMemory Updates
RepoMemory tracks understanding across experiments:Parallel Execution
Tree search runs experiments in parallel:Budget Tracking
The orchestrator tracks three budgets:| Budget | Description |
|---|---|
| Time | Wall-clock time since start |
| Iterations | Number of experiment iterations |
| Cost | Cumulative LLM API cost |