> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nika.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# max_turns

> Contract, placement, related fields and source examples for this Nika YAML field.

[Language reference](/reference/language/overview) / `max_turns`

## Meaning and placement

### agent

The schema declares this field at the location below.

| Property        | Declaration                         |
| --------------- | ----------------------------------- |
| Requirement     | Optional in this object             |
| Schema location | `/$defs/agent/properties/max_turns` |
| type            | \["integer", "string"]              |

**In the same object:** [max\_tokens\_total](/reference/language/words/max_tokens_total) · [model](/reference/language/words/model) · [prompt](/reference/language/words/prompt) · [schema](/reference/language/words/schema) · [skills](/reference/language/words/skills) · [system](/reference/language/words/system) · [temperature](/reference/language/words/temperature) · [tools](/reference/language/words/tools)

[Schema source (use the pointer above)](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/schemas/workflow.schema.json)

## In a source template

Excerpt from `templates/agent-loop.nika.yaml`, source lines 107–116. This is a fragment, not a runnable workflow.

```yaml illustration theme={"system"}
        # boundary` — measured, mid-loop, after the turns are paid for.
        - "nika:jq"
        - "nika:done"               # the early-exit sentinel · loop-owned
      max_turns: 15                 # SLOT: the loop bound
      max_tokens_total: 80000       # SLOT: the spend bound
      schema:                       # SLOT: the typed final-message contract
        # Closed on purpose (`check` hints `strictness` on an open object):
        # on 0.118.7 an extra key through `nika:done` is a verdict (above),
        # so every field the answer may carry is named HERE, not in the prompt.
        # Measured on a real seat with the goal bound in: it computed the
```

### Templates containing this field

| Template                         | Source                                                                                                                                   |
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `templates/agent-loop.nika.yaml` | [Line 110](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/agent-loop.nika.yaml#L110) |

These are literal key occurrences in the source files, not an execution or conformance claim. [How to instantiate a template](/guides/templates).

## Contract and implementation

This page projects the named specification revision. Check [released engine status](/reference/status) and [the validation workflow](/guides/agent-authoring) before running a file. An optional field is not evidence that every engine supports every value.

Canonical identity: `language:word:max_turns`. Spec revision: [`c5ebbb7b862b`](https://github.com/supernovae-st/nika-spec/tree/c5ebbb7b862b68bc6cf7235efba61173b844afc6).

[How documentation stays connected](/reference/knowledge-system).
