Understanding evolveRL Agents
AgentConfig
from evolverl.agent import Agent, AgentConfig from evolverl.llm import LLMConfig # Create agent config config = AgentConfig( llm_config=LLMConfig( model_name="gpt-4o-mini", model_type="openai" ), prompt_template="You are a helpful AI assistant...", score=0 # Initial score ) # Create agent agent = Agent(config)
Show LLMConfig
# Create and configure agent agent = Agent(AgentConfig(LLMConfig())) agent.set_default_prompt("You are a helpful AI assistant.") # Send a message response = await agent.send_message("What is the capital of France?") print(response)
# Save configuration agent.save_config("agent_config.json") # Load configuration new_agent = Agent() new_agent.load_config("agent_config.json")
# Create base variant base_agent = Agent(AgentConfig(llm_config)) base_agent.set_default_prompt("Base prompt template...") # Create mutations variants = await evolution.mutate_agents(base_agent, count=5)
# Create adversary adversary = await evolution.build_adversary( domain="mathematics", description="Generate tricky math problems" )
# Create judge judge = await evolution.build_judge( domain="mathematics", description="Evaluate solution quality" ) # Get score score = await evolution.get_agent_score(chat_history, judge)