← Back to Machine Learning cs.LG
Teaching agents to fix themselves by rewriting their own code
Qianshu Cai, Yonggang Zhang, Xianzhang Jia, Wei Xue, Jun Song, Xinmei Tian, Yike Guo
May 21, 2026
Current self-evolving agents tweak prompts and configuration files but leave their underlying code structure untouched, missing entire classes of failures rooted in routing logic and state management. MOSS fixes this by letting agents rewrite their own source code in response to production failures—more powerful than text-only changes because it's Turing-complete and deterministic. The system bundles failed cases, generates code fixes through an external coding agent, tests changes safely in ephemeral containers, and deploys them with rollback protection. On a four-task benchmark, MOSS improved performance from 0.25 to 0.61 in one self-evolution cycle.
Read the original paper →