cs.AIMar 18, 2026

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

Authors: Zhang Zhang, Shuqi Lu, Hongjin Qian, Di He, Zheng Liu

Organizations: Peking University · Beijing Academy of Artificial Intelligence · Hong Kong Polytechnic University

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.

Figures & tables

Appendix figures & tables2 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Mem2^2Evolve: Towards Self-Evolving Agents via Co-Evolutionary Capability Expansion and Experience Distillation

    Apr 13, 2026Zihao Cheng, Zeming Liu, Yingyu Shan +7LLM Agent Self-ImprovementSelf-Evolving Agents

  2. EXG: Self-Evolving Agents with Experience Graphs

    May 18, 2026Yuxin Jin, Siyuan Zhang, Hanchen Wang +3Graph-Based Agent MemoryMemory-Augmented Agents