# Fuel

> How fuel metering bounds every Atracode execution, what consumes fuel, what happens when it runs out, and how to set a budget.

> Preview: the commands, tools and API shapes on this page may change before launch.

Source: https://atracode.com/docs/fuel

Every execution on the Atracode runtime gets a fuel budget. Fuel is consumed as the program runs, and when it is gone, execution stops. Nothing runs forever.

Fuel is part of what makes the runtime deterministic. A program with a bug that would loop forever on a native toolchain stops on Atracode at a known point, with a report that says where.

## What consumes fuel

Fuel is consumed by evaluation steps: the work the runtime does as it evaluates the [Semantic Execution Graph](/docs/semantic-execution-graph). Each step through the graph spends fuel, so a loop that runs a million times spends far more than one that runs ten times.

Fuel counts steps, not seconds. The same program with the same inputs uses the same amount of fuel on a fast server and a slow laptop. That makes a fuel budget something you can reason about and reproduce, unlike a wall-clock timeout, which depends on the machine and how busy it is.

The exact cost of each kind of step is defined by the runtime, whose source is published at [github.com/atracode/runtime](https://github.com/atracode/runtime) at launch.

## Bounds you can see before running

The compiler records the bounds of each program in its SEG. `atracode inspect <file>` shows a SEG's inputs, its membrane reads and writes, and its bounds, including fuel:

```shell
atracode inspect interest.rs
```

Agents get the same information from the `atracode_inspect_seg` MCP tool, which returns `bounds: { fuel, widths }`. See [MCP tools](/docs/mcp-tools).

## When fuel runs out

When the budget is spent, the runtime stops the execution and produces a located report: it says where in the program execution was when the fuel ran out. You don't get a partial result presented as a finished one.

Because fuel counts deterministic steps, running out is deterministic too. Run the same program with the same inputs and the same budget, and it stops at the same point every time, on every machine. You can reproduce the stop exactly, which makes it something you can debug.

Two common causes:

- **The budget is too small** for real work on large inputs. Raise it.
- **The program doesn't terminate** for some inputs. The report points you to where it was running, usually inside the loop that doesn't end.

## Set a budget

From the CLI, set a budget when you run a program:

```shell
atracode run ./my-service --fuel 5000000
```

Here `--fuel <n>` sets the number of fuel units the execution may spend.

> **Note:** The `--fuel` flag is a preview. Its name, units and default may change before launch.

When you embed the runtime in your own program, you set the budget through the host API for each execution. See [Embedding](/docs/embedding).

## Choosing a budget

Pick a budget large enough for the biggest input you expect, with room to spare. If a program is meant to finish quickly, a tight budget catches runaway inputs early, and the located report tells you which input and where.

## Next steps

- [Runtime](/docs/runtime): the evaluator that meters fuel
- [Embedding](/docs/embedding): set budgets from a host program
- [CLI](/docs/cli): `atracode run`, `atracode inspect` and the rest
- [Semantic Execution Graph](/docs/semantic-execution-graph): what each step evaluates
