AgentFactory: A Self-Evolving Framework Through Executable Subagent Accumulation and Reuse

2026-03-18Artificial Intelligence

Artificial Intelligence
AI summary

The authors propose AgentFactory, a system where an AI agent learns to solve tasks by creating small pieces of working code instead of just writing down notes. These code pieces, called subagents, get better over time as they are tested and improved based on feedback. Because the subagents are real Python code with clear instructions, they can be used on many different computers easily. This approach helps the AI get better at similar tasks without needing people to fix or help it along the way.

LLM-based agentsself-evolutionexecutable subagent codetask re-executionPython codeexecution feedbackcode refinementportabilitycontinuous capability accumulationautomated task solving
Authors
Zhang Zhang, Shuqi Lu, Hongjin Qian, Di He, Zheng Liu
Abstract
Building LLM-based agents has become increasingly important. Recent works on LLM-based agent self-evolution primarily record successful experiences as textual prompts or reflections, which cannot reliably guarantee efficient task re-execution in complex scenarios. We propose AgentFactory, a new self-evolution paradigm that preserves successful task solutions as executable subagent code rather than textual experience. Crucially, these subagents are continuously refined based on execution feedback, becoming increasingly robust and efficient as more tasks are encountered. Saved subagents are pure Python code with standardized documentation, enabling portability across any Python-capable system. We demonstrate that AgentFactory enables continuous capability accumulation: its library of executable subagents grows and improves over time, progressively reducing the effort required for similar tasks without manual intervention. Our implementation is open-sourced at https://github.com/zzatpku/AgentFactory, and our demonstration video is available at https://youtu.be/iKSsuAXJHW0.