Sakana AI built an agent that rewrites its own code
Sakana AI just introduced the Darwin Gödel Machine, an evolutionary AI agent that improves performance by rewriting its own code. In tests, it boosted its SWE-bench benchmark score from 20.0% to 50.0% without human intervention. Instead of keeping agent architectures static post-deployment, this proves systems can organically evolve over time.

The Darwin Gödel Machine (DGM) is an open-source coding agent that continuously improves by rewriting its own Python codebase. Developed by Sakana AI in collaboration with Jeff Clune's lab at UBC, the system brings Jürgen Schmidhuber's theoretical Gödel Machine into reality using evolutionary principles, and the code is now available on GitHub.
How it evolves its own code
Most modern agentic systems are static: once deployed, their workflows and tooling remain fixed. DGM breaks this mold by pairing foundation models with open-ended evolutionary search, allowing the agent to treat its own code as a scratchpad for continuous improvement.
During self-modification cycles, DGM discovered several effective workflow upgrades without human intervention. It built its own patch validation steps, upgraded its file viewing and editing utilities, implemented pipelines to generate and rank multiple candidate solutions, and created a memory log to track past failures so it avoids repeating mistakes.
These modifications are strictly grounded in performance. DGM evaluates every proposed code variation on downstream programming tasks. Successful versions are saved to an expanding archive of agents, enabling future self-modifications to branch off from any prior successful ancestor and explore multiple design paths in parallel.
Benchmark gains and code availability
The evolutionary approach delivered dramatic empirical improvements. On SWE-bench, which tests an agent's ability to resolve real-world GitHub issues, DGM autonomously boosted its success rate from an initial 20.0% to 50.0%.
On the multilingual Polyglot benchmark, DGM jumped from a baseline of 14.2% to 30.7%, cleanly outperforming popular hand-designed architectures like Aider. Sakana AI also found that performance scales directly with allocated compute, while a control agent without self-improvement capabilities lagged far behind.
The project code is hosted on GitHub under jennyzzt/dgm, accompanied by a preprint on arXiv. The research was led by PhD students Jenny Zhang and Shengran Hu, alongside Cong Lu and Robert Lange.
Why it matters
For agent researchers and developers, DGM offers a compelling look at what comes after manual prompt engineering and rigid workflow design. If you are experimenting with autonomous coding systems, studying how DGM builds and validates its own tools is well worth your time.
At the same time, granting an agent permission to modify its own executable logic introduces obvious security risks. We think DGM effectively proves the power of algorithmic self-improvement, but running systems like this in production will require rock-solid sandboxing and strict boundary checks.
Sources (2)
- x.com(opens in a new tab)Originalx.com
- sakana.ai(opens in a new tab)Reportsakana.ai