# The seven Agent primitives

> Learn the complete compositional language for Agent judgment, durable history, time, delegation, and volume.

Constal’s Agent language has exactly seven primitives, in this canonical order: `turn`, `ledger`, `commit`, `await`, `spawn`, `map`, and `reduce`. The first five let an Agent exercise judgment across history, time, and delegated work. The final two let the same program operate over data larger than one invocation.

## The language {#language}

| Primitive | Meaning |
| --- | --- |
| `turn` | Exercise judgment through a pinned Model, optionally offering governed Tools |
| `ledger` | Read, page, branch, or truncate durable history |
| `commit` | Establish a durable fact, result, checkpoint, delivery, or compensation point |
| `await` | Suspend until authenticated external input or a declared deadline arrives |
| `spawn` | Delegate bounded work to a registered, independently durable subtask |
| `map` | Apply registered work across partitioned, content-addressed data |
| `reduce` | Deterministically combine partitioned results, globally or by key |

These words are deliberately orthogonal. `turn` decides; `ledger` remembers; `commit` makes truth durable; `await` crosses human or external time; `spawn` introduces bounded independent work; `map` distributes volume; and `reduce` brings that volume back together.

## Contracts {#contracts}

```ts
ctx.turn(spec)
ctx.ledger.view(name, options)
ctx.ledger.page(cursor)
ctx.ledger.branch(fact)
ctx.ledger.truncate(fact)
ctx.commit(value, options)
ctx.await(label, options)
ctx.spawn(task, input, options)
ctx.map(partitionFn, input, options)
ctx.reduce(foldFn, input, options)
```

Several operations return durable Handles. A Handle has one stable identity and one terminal outcome; derived joins such as `all`, `select`, and `race` compose Handles without adding runtime primitives.

## What is not an eighth primitive {#not-an-eighth-primitive}

`ctx.invoke()` and `ctx.invokeAsync()` cross the governed Resource boundary. `ctx.step()` records a replay-safe local memoization boundary. Tools expose selected Resource capabilities to a Model. Policy grants or denies authority. Channels translate communication. Credentials supply secret material only to authorized integrations. These are essential runtime boundaries and supporting mechanisms, but none adds another word to the Agent language.

ReAct, planners, supervisors, retries, approvals, transcripts, memory-backed behavior, and final-answer conventions are compositions. See [From primitives to production](/docs/foundations/composition.md) for the patterns.
