# Brevi documentation
<!-- description: Brevi documentation: install, use, connect agents, and how the compiler works. -->

Brevi is a compiler built for AI coding agents. The agent writes ordinary Python, and Brevi builds it through Rust into a native program that prints exactly what CPython prints, typically 2 to 40 times faster. When Brevi cannot build something, it says so in one short JSON line the agent can act on.

Brevi is written in Rust and released under the Apache-2.0 license.

```
$ brevi run top.py < text.txt        # build natively, then run
the: 3
and: 2
cat: 1
```

## Who it is for

- **Coding agents** that write Python to solve a task: Brevi takes the place of `python3` in the loop. The agent needs no guide, and gets faster programs and shorter errors. Start with [For AI agents](https://brevi-lang.org/docs/agents).
- **People who run agent-written code**: one native binary to ship, the same output as CPython, and a sandbox the program declares. Start with [Install](https://brevi-lang.org/docs/install) and [Using Brevi](https://brevi-lang.org/docs/usage).
- **Anyone curious how a Python-to-Rust compiler can stay exact**: [Architecture](https://brevi-lang.org/docs/architecture) and [What works, and limits](https://brevi-lang.org/docs/compatibility).

## What makes it different

- **AI-first.** Every design choice is measured by what it costs a model to get a working program: tokens written, errors read, retries. The [release test](https://brevi-lang.org/docs/benchmarks#the-release-test) has Claude models solve 24 tasks in Python, run once by CPython and once by Brevi, and Brevi must cost no more.
- **Fast.** Most Python builds into plain Rust with fixed types. Programs whose types change at run time build over dynamic values, still native.
- **Safe.** Rust's memory safety underneath, integers that never silently overflow, and a declared sandbox for file access and native code.
- **Exact.** A program Brevi builds gives CPython's output, or Brevi refuses at build time. It does not guess. On 591 saved agent programs, every build matched CPython byte for byte.

## Where to go next

<div class="cards">
<a class="card" href="/docs/install"><h3>Install</h3><p>Release binaries, the install script, Docker, or from source.</p></a>
<a class="card" href="/docs/usage"><h3>Using Brevi</h3><p>Commands, flags, errors, the CPython fallback, sandbox and GUI tests.</p></a>
<a class="card" href="/docs/agents"><h3>For AI agents</h3><p>MCP server, Agent Skill, Claude Code plugin, llms.txt and prompting advice.</p></a>
<a class="card" href="/docs/architecture"><h3>Architecture</h3><p>The pipeline from source to native binary, with diagrams.</p></a>
<a class="card" href="/docs/compatibility"><h3>What works, and limits</h3><p>Python coverage, libraries, big integers and known gaps.</p></a>
<a class="card" href="/docs/benchmarks"><h3>Benchmarks</h3><p>Release test, model cost, and Brevi against Codon and Nuitka.</p></a>
</div>

## Status

Brevi is a preview, at version 0.24. It builds most real-world agent-written Python natively today, and the [roadmap](https://brevi-lang.org/docs/roadmap) lists what is still missing. Package-manager installs (pip, npm, Homebrew) and the hosted service at [brevi.run](https://brevi.run) are coming; for now, install from the GitHub release.
