> ## 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](/reference/language/overview) / `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](/reference/language/words/after) · [exec](/reference/language/words/exec) · [extract](/reference/language/words/extract) · [for\_each](/reference/language/words/for_each) · [group](/reference/language/words/group) · [infer](/reference/language/words/infer) · [invoke](/reference/language/words/invoke) · [lift](/reference/language/words/lift) · [on\_error](/reference/language/words/on_error) · [retry](/reference/language/words/retry) · [returns](/reference/language/words/returns) · [timeout](/reference/language/words/timeout) · [when](/reference/language/words/when) · [with](/reference/language/words/with)

[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 78–87. 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:
      # Say what the JOB is. Do NOT describe the output shape.
      #
      # The engine binds `schema:` to the FINAL answer. A free-text answer
      # that misses it is RE-ASKED with the schema wired, bounded by a retry
      # budget (measured on ollama/qwen3.5:4b — this task, with zero shape
      # instruction, returns a clean typed object). A `nika:done` result that
```

### Templates containing this field

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

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:agent`. Spec revision: [`c5ebbb7b862b`](https://github.com/supernovae-st/nika-spec/tree/c5ebbb7b862b68bc6cf7235efba61173b844afc6).

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