# AgentRunBudgets
Source: https://docs.maelstrom-ai.co/dev/reference/engine/interfaces/agentrunbudgets/
Documentation revision: 89a8f5e9d10cedcf0b30376d7846113f06f26120
SDK manifests in this build: @maelstrom-co/react@0.2.1, @maelstrom-co/client@0.2.1, @maelstrom-co/connectors@0.2.1, @maelstrom-co/protocol@0.2.1, @maelstrom-co/engine@0.2.1
These docs follow this source revision. Manifest versions do not prove release compatibility; verify the installed package exports before using an API.

Defined in: [packages/engine/src/lib/agent-session/agent-run.ts:26](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/engine/src/lib/agent-session/agent-run.ts#L26)

Caps on one Agent Run. A run that reaches any cap stops with BUDGET\_CLOSING\_MESSAGE and a `budget` AgentRunFinished. The values are frozen for the run and never reach a prompt or tool arguments. A zero or `NaN` cap refuses the run before any model call.

The agent loop is experimental in 0.3 and may change in any minor release.

> [!WARNING]
> Experimental
> 
> This API should not be used in production and may be trimmed from a public release.

## Properties

### maxElapsedMs

> `readonly` **maxElapsedMs**: `number`

Defined in: [packages/engine/src/lib/agent-session/agent-run.ts:30](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/engine/src/lib/agent-session/agent-run.ts#L30)

Longest wall-clock duration of the run, in milliseconds, measured on AgentRunClock.

> [!WARNING]
> Experimental
> 
> This API should not be used in production and may be trimmed from a public release.

* * *

### maxTokens

> `readonly` **maxTokens**: `number`

Defined in: [packages/engine/src/lib/agent-session/agent-run.ts:36](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/engine/src/lib/agent-session/agent-run.ts#L36)

Most input plus output tokens the run may spend, summed over every provider call. `Infinity` disables the cap, so unknown usage no longer blocks tools.

> [!WARNING]
> Experimental
> 
> This API should not be used in production and may be trimmed from a public release.

* * *

### maxToolCalls

> `readonly` **maxToolCalls**: `number`

Defined in: [packages/engine/src/lib/agent-session/agent-run.ts:38](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/engine/src/lib/agent-session/agent-run.ts#L38)

Most tool calls the run may make across all turns.

> [!WARNING]
> Experimental
> 
> This API should not be used in production and may be trimmed from a public release.

* * *

### maxTurns

> `readonly` **maxTurns**: `number`

Defined in: [packages/engine/src/lib/agent-session/agent-run.ts:28](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/engine/src/lib/agent-session/agent-run.ts#L28)

Most model turns the run may take.

> [!WARNING]
> Experimental
> 
> This API should not be used in production and may be trimmed from a public release.
