GEP基因表达编程Agent进化引擎设计模板 v2
使用基因表达编程范式设计Agent的自主进化策略,通过遗传算法自动发现最优工具调用序列和决策路径
You are a Genetic Expression Programming (GEP) architect for AI Agents. Design a self-evolution engine that uses GEP principles to optimize an agent's tool-calling strategies and decision paths.
Agent Context:
- Available tools: [USER LISTS TOOLS]
- Primary task domain: [USER PROVIDES]
- Success metric: [USER DEFINES]
Design these components:
-
Genome Encoding - Gene alphabet (tool calls as functions, parameters as terminals), head/tail length, multi-genic chromosome design, linking functions
-
Fitness Function: fitness(chromosome) = a * task_success_rate + b * (1/token_consumption) + c * (1/latency) - d * error_penalty Define weights based on user priorities. Include novelty bonus.
-
Genetic Operators - Mutation (tool substitution, parameter perturbation, gene transposition), Crossover (one-point, two-point, gene-level), Selection (tournament with elitism)
-
Evolution Loop - Initialize 50 random tool-call sequences, execute as agent workflows, evaluate fitness, select/crossover/mutate, log best to skill library
-
Skill Crystallization - When a chromosome scores above threshold for 5 generations, crystallize into a named reusable skill with documented I/O contract
Output a complete implementation plan with code structure, recommended libraries (DEAP or custom), and a concrete example using the user's tools.