# AutoPilot

A public Python prototype that trains agents the way PyTorch trains models, and rolls back any change that fails a policy gate.

- Web page: https://pranavsastry.com/projects/autopilot
- Kind: Project
- Headline: I gave agent improvement a **training loop**.
- Stack: Python
- Status: Public prototype
- Year: 2026

## The idea

The system being improved is a module, and what it may change (a prompt file, a config, source code) are its parameters. An evaluator scores a batch of runs and writes structured feedback into each parameter, where a model would keep its gradient. An optimizer reads that feedback and edits the parameter. The optimizer can be a deterministic rule or a coding agent such as Claude Code.

**Figure 1. The improvement loop.** A schematic run of AutoPilot: two candidate changes, one kept and one rolled back.

What the animated figure shows: A candidate change runs forward, loss, backward and step; when the evidence holds it is checkpointed, when it does not it is rolled back.

## What I designed in

A change is accepted only when a policy gate passes. Otherwise the experiment rolls back to the last accepted epoch, restored from content-addressed snapshots. Every command that changes state must give a reason, and the reason is written to an append-only journal next to the decision it explains.

## How far it goes

It is a public prototype with tests, a command-line interface and three runnable examples: regex rules tuned with no model calls, a prompt tuned by an agent, and a trainer over several modules. I have not published benchmark or production results from it. The code and examples are in the repository linked below.

## Why a framework

Loops such as Karpathy’s [autoresearch](https://github.com/karpathy/autoresearch) show that keeping improvements and discarding regressions works, but they leave the rules for keeping, logging and reverting in a prompt. AutoPilot puts those rules in typed code, where they can be tested.

## Links

- GitHub: [https://github.com/pranftw/autopilot](https://github.com/pranftw/autopilot)
- My research statement: [https://pranavsastry.com/research.md](https://pranavsastry.com/research.md)

## More projects

- [Aiter](https://pranavsastry.com/projects/aiter.md) is a terminal AI agent I wrote so I could change its **tools**, MCP servers and saved sessions.
- [RecLLM](https://pranavsastry.com/projects/recllm.md) is a prototype for **shopping by conversation**: an index of a store’s catalog, and a memory of what each shopper likes.
- [Neograd](https://pranavsastry.com/projects/neograd.md) is a deep-learning framework I wrote from scratch in Python and NumPy, to see **how autograd works**.
- [OpenReview Scraper](https://pranavsastry.com/projects/openreview-scraper.md) turns conference submissions into a **reading list** by searching their titles, abstracts and keywords.
- [ODDGen](https://pranavsastry.com/projects/oddgen.md) builds object-detection datasets from cut-out objects, with **the bounding boxes written for you**.
- [rapidx](https://pranavsastry.com/projects/rapidx.md) runs experiments from many research codebases through one entry point, each in its **own environment**.
- [All projects](https://pranavsastry.com/projects.md)
- [Home and directory](https://pranavsastry.com/index.md)
