Here’s a simple example to get you started with evolveRL:
Copy
from evolverl.evolution import Evolution, EvolutionConfigfrom evolverl.llm import LLMConfigfrom evolverl.agent import Agent, AgentConfig# Configure LLM backendllm_config = LLMConfig( model_name="gpt-4o-mini", model_type="openai", # or "anthropic" openai_api_key="your-api-key" # or anthropic_api_key for Claude)# Create agent with system promptagent_config = AgentConfig(llm_config=llm_config)agent = Agent(agent_config)agent.set_default_prompt("""You are an expert AI agent specialized in mathematics.You break down complex problems step by step and show your work clearly.""")# Configure evolution processconfig = EvolutionConfig( population_size=5, generations=10, mutation_rate=0.1, crossover_rate=0.8, output_dir="agents")# Create evolution instanceevolution = Evolution(config, experiment_id="math_solver")# Run evolution processawait evolution.evolve( domain="mathematics", description="Solve complex math problems with detailed explanations")
agents/├── {experiment_id}_gen0.json # Best agent from generation 0├── {experiment_id}_gen0_full.json # All variants from generation 0├── {experiment_id}_gen1.json # Best agent from generation 1├── {experiment_id}_gen1_full.json # All variants from generation 1└── {experiment_id}_best.json # Best agent overall