AI agents are starting to prove the code they write is correct
Researchers and software builders putting the agents to work still rely on people to spell out what correct code should do.
Proving a Rust cryptography library correct took three people five months, Clark Barrett, a professor of computer science at Stanford University, said in October. His team gave the same 30,000-line library to an AI agent. “We were able to do it in 11 hours fully automatically with our crypto prover agent,” Barrett said.
The paper behind the result puts the machine’s bill at $466.99 in recorded API cost. The same agent also verified a ChaCha20 cipher implementation that no one had verified before, so it broke new ground as well as redoing a proof people had finished.
Everett Hildenbrandt is chief executive of Runtime Verification. The firm specializes in formal verification of software systems. In October he forecast that by 2031 at the latest, delivering any software package will mean delivering its formal specifications and proofs. Software without verification attached will not fit in package repositories, he said, because it will be too risky.
At Lovable, a platform where an AI agent builds apps for its users, the agent’s work is already checked as it goes. Fabian Hedin of Lovable said in November that when a user creates a database, the platform writes row-level security rules for it. These rules decide which rows of data each user can reach.
Lovable’s security scanners then work out whether an app’s data can be reached. “This is not done through tests and so on, but we can formally verify that and feed that back to the agent,” Hedin said. When a scanner finds a way in, the agent patches the rules. The loop repeats until the system can formally say the data is not accessible.
We're embarking on rewrites of millions of lines of code.Guillermo RauchSource ↗
The need for machine checking grows with the volume of code machines now produce. Guillermo Rauch, chief executive of Vercel, said in November that much of the software that companies have been banking on turns out to be riddled with weak points. Much of that code can now be rewritten fairly autonomously as a defense, he said.
Rauch had just learned the scale from an engineer on Vercel’s content delivery network. Vercel is starting rewrites of millions of lines of code, the engineer told him. Rewrites that large raise the question of who checks the new code. Barrett’s result suggests a machine can do that too.
People still have to say what correct means. Barrett’s crypto prover agent worked from given API contracts and a fixed, trusted library of specifications. In Barrett’s own demonstration, a person approves the generated specification before the agent writes and verifies the code.
Hildenbrandt expects writing code itself to be a dead art by October 2028 at the latest, with the work shifting to specification and intent. He thinks the days of the gifted coder who simply turns out world-changing software are over, and artisanal software with them.
Hildenbrandt allows for an in-between period before 2031 in which packages still ship without proofs. The test of his 2031 forecast is whether a major package repository starts refusing code that comes without a proof.
1M+ Projects a Week, $600M ARR: Lovable CTO Fabian Hedin on Empowering Everyone to Shape the World
“And this is not done through tests and so on, but we can formally verify that and feed that back to the agent.”— Fabian HedinSource ↗
How Vercel's Founder Is Building For The Future Of AI Agents
“We're embarking on rewrites of millions of lines of code.”— Guillermo RauchSource ↗
AI Safety Fact vs. Fiction · YC Paper Club
“We were able to do it in 11 hours fully automatically with our crypto prover agent.”— Clark BarrettSource ↗