---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/orchestration/runs/functions/foldRun.md
---

# Function: foldRun()

```ts
function foldRun(events: RunEvent[]): RunProjection;
```

Defined in: [src/batteries/orchestration/runs.ts:33](https://github.com/NHTIO/ADK/blob/v1.20260906.0/src/src/batteries/orchestration/runs.ts#L33)

Fold a sequence of run events into a single [RunProjection](../../types/interfaces/RunProjection.md).

The projection is derived entirely from the events themselves — no graph, no store, and no
side channel. It is deterministic and total: the same event list always folds to the same
projection.

## Parameters

| Parameter | Type                                                 | Description                     |
| --------- | ---------------------------------------------------- | ------------------------------- |
| `events`  | [`RunEvent`](../../types/type-aliases/RunEvent.md)\[] | The ordered run events to fold. |

## Returns

[`RunProjection`](../../types/interfaces/RunProjection.md)

The projected state of the run.

## Throws

If the first event is not `run_started` (a malformed event list).
