# Darwin: the evolutionary optimizer for AI agents

> Darwin evolves the entire agent that solves your task: its prompt, its self-written tool code, and the model it runs on. Generation over generation, inside sandboxes it can't escape and against a grader it can't game.

Point Darwin at a task. Its first attempt is deliberately mediocre. Then it breeds a population of variants, rewrites their tools, prompt, and even the model they run on, and keeps whatever scores higher. Nobody helps it. It never escapes the sandbox. It just gets better.

## What Darwin does

Darwin is an open-source, MIT-licensed evolutionary optimizer for AI agents. Give it a task and it evolves the whole agent that solves it: the system prompt, the tool code the agent writes for itself, and the model it runs on. Every variant runs in an isolated sandbox, is scored by a grader it cannot modify, and is rolled back if it regresses.

Because the model is just one more gene, self-improvement and model selection are the same act. Point Darwin at one task and watch the score climb. Point it at a domain of related tasks and it hands back a routing card: the winning agent and model for each one.

### How a generation works

- Variation: Fireworks AI mutates each agent's prompt, tool code, parameters, and model.
- Selection: a Braintrust eval is the fitness function, and the score decides who survives.
- Inheritance: the fittest genomes seed the next generation; elitism keeps the best score monotonic.
- Containment: every variant runs in its own Daytona sandbox and is snapshot-rolled-back if it regresses.

## The safety spine

- Sandboxed self-modification: genome code never runs in the host process.
- An immutable grader: the mutator is never handed the eval, and a test enforces it.
- Regression auto-rejection and rollback: a worse child is killed and its sandbox restored.
- Human veto and a hard compute cap: no new champion is promoted without sign-off.

## When to use Darwin

Reach for Darwin when the job is to find the best agent configuration for a specific, measurable task, not to answer a one-off question. Good fits:

- You have a task with a programmatic grader (unit tests, exact-match answers, an LLM judge you trust) and want the highest-scoring agent for it.
- You need to choose which LLM to route each kind of task to, based on scores on your own tasks rather than public leaderboards.
- You want an agent to improve its own prompt and tool code without that code ever running on the host machine.
- You need an auditable record of every variant, score, rollback, and model choice for a review or a demo.

Poor fits: tasks with no way to score an answer, real-time chat, or anything that needs a hosted API (Darwin is self-hosted).

## Explore

- [The Lab](https://trydarwin.pages.dev/app): benchmark models on your company's tasks and export a routing strategy.
- [Developers](https://trydarwin.pages.dev/developers): quickstart, CLI, local API, and sandbox mode.
- [About](https://trydarwin.pages.dev/about), [Contact](https://trydarwin.pages.dev/contact), and [Privacy](https://trydarwin.pages.dev/privacy).
- [Source code on GitHub](https://github.com/KarthikSubramanian07/Darwin) under the MIT license.
- [llms.txt](https://trydarwin.pages.dev/llms.txt): a Markdown index of this site for AI agents.

---

Canonical page: https://trydarwin.pages.dev/ · Site index for agents: https://trydarwin.pages.dev/llms.txt
