# AgentConfig
Source: https://docs.maelstrom-ai.co/dev/reference/engine/interfaces/agentconfig/
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-config.ts:65](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/engine/src/lib/agent-session/agent-config.ts#L65)

The `agent` slot of the Engine config. When present, utterances run as Agent Runs that call the configured tools. Read once when the Engine is created.

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

### budgets?

> `readonly` `optional` **budgets?**: `Partial`<[`AgentRunBudgets`](https://docs.maelstrom-ai.co/dev/reference/engine/interfaces/agentrunbudgets/)\> | [`AgentBudgetResolver`](https://docs.maelstrom-ai.co/dev/reference/engine/type-aliases/agentbudgetresolver/)

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

Caps for each run, as static values or a resolver called once per run. Fields left out default to 12 turns, 120,000 ms, 100,000 tokens and 24 tool calls. Every value must be a non-negative integer. `maxTokens` and `maxElapsedMs` also accept `Infinity`, which removes that cap. `maxTurns` and `maxToolCalls` must stay finite, so every run keeps a hard bound on its loop. Any other field is rejected, so a misspelled cap fails instead of falling back to its default. Static values are validated when the Engine is created.

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

* * *

### instructions?

> `readonly` `optional` **instructions?**: `string`

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

System instructions sent with every model turn. Defaults to an empty string. The Engine appends a capability index of the utterance Chart’s Vessels when the Chart has any.

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

* * *

### model

> `readonly` **model**: `AnyTextAdapter` | [`AgentModelFactory`](https://docs.maelstrom-ai.co/dev/reference/engine/type-aliases/agentmodelfactory/)

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

The text adapter serving every run, or a factory that picks one per run. A value of type `function` is treated as a factory. Any other value must be an object with a `chatStream` method, or Engine creation throws.

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

* * *

### retry?

> `readonly` `optional` **retry?**: `object`

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

Rate-limit retry for each model call. Defaults to no retry.

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

#### maxRetries

> **maxRetries**: `number`

Extra model calls after the first, for each model call of the run. `0` means no retry. The provider SDK does its own retries first, from the `maxRetries` of the adapter config.

#### maxWaitMs?

> `optional` **maxWaitMs?**: `number`

Longest wait time to accept, in milliseconds. Default 60 000.

* * *

### tools?

> `readonly` `optional` **tools?**: readonly [`RegistrableServerTool`](https://docs.maelstrom-ai.co/dev/reference/engine/interfaces/registrableservertool/)\[\]

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

The Server Tools the model may call. Defaults to none. Every tool must define `summarize`, and names must be unique, or Engine creation throws.

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