> ## 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.

# agent

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

[Language reference](https://docs.nika.sh/reference/language/overview.md) / `agent`

## Meaning and placement

### task

The schema declares this field at the location below.

| Property | Declaration |
| - | - |
| Requirement | Optional in this object |
| Schema location | `/$defs/task/properties/agent` |
| \$ref | `"#/$defs/agent"` |

**In the same object:** [after](https://docs.nika.sh/reference/language/words/after.md) · [exec](https://docs.nika.sh/reference/language/words/exec.md) · [extract](https://docs.nika.sh/reference/language/words/extract.md) · [for\_each](https://docs.nika.sh/reference/language/words/for_each.md) · [group](https://docs.nika.sh/reference/language/words/group.md) · [infer](https://docs.nika.sh/reference/language/words/infer.md) · [invoke](https://docs.nika.sh/reference/language/words/invoke.md) · [lift](https://docs.nika.sh/reference/language/words/lift.md) · [on\_error](https://docs.nika.sh/reference/language/words/on_error.md) · [retry](https://docs.nika.sh/reference/language/words/retry.md) · [returns](https://docs.nika.sh/reference/language/words/returns.md) · [timeout](https://docs.nika.sh/reference/language/words/timeout.md) · [when](https://docs.nika.sh/reference/language/words/when.md) · [with](https://docs.nika.sh/reference/language/words/with.md)

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

## In a source template

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

```yaml illustration theme={"system"}
      # and the assert below only proves non-emptiness. The goal rides in.
      goal: ${{ inputs.goal }}
      steps: ${{ tasks.plan.output.steps }}
    agent:
      # Describe the job in the prompt; declare its result shape in schema:.
      # The granted nika:done sentinel is required to finish this loop.
      # Text-only plans receive feedback within the turn/token budgets.
      # The engine validates the final result and can request a schema
      # repair within its configured retry allowance and task budgets.
      # A valid result shape does not prove the promised work was performed;
```

### Templates containing this field

| Template | Source |
| - | - |
| `templates/agent-loop.nika` | [Line 77](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/agent-loop.nika#L77) |

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

## Contract and implementation

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

Canonical identity: `language:word:agent`. Spec revision: [`5c40ba456c53`](https://github.com/supernovae-st/nika-spec/tree/5c40ba456c53a4ab663a949d44003078e161305d).

[How documentation stays connected](https://docs.nika.sh/reference/knowledge-system.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.