# `type.batch_context`

Batch operation called outside an action.

Area 12, [Jobs and events](../topics/jobs-and-events.md); not declinable; the next step is usually the agent's.

Only an action starts a run, reads its progress or cancels it, keeping
what it does in the action's transaction:


```jadpo
action sweep_shelf(page: ItemPage) -> BatchRun {
    return batches.each(from: items(page), each: item -> mark_seen(item))
}

/// How far a sweep has got, for a report.
function shelf_report(shelf_run: BatchRun) -> BatchProgress {
    return batches.status(shelf_run)
}
```

```text
error: A function can't call `batches.status`
 --> main.jadpo:7:12
  |
7 |     return batches.status(shelf_run)
  |            ^^^^^^^^^^^^^^ outside an action
  reason: `batches.status` reads a run the runtime keeps in the store an action writes, so only an action calls it.
  next: Call `batches.status` in an action (agent)
  rule: type.batch_context
  help: https://jadpo.dev/docs/errors/type.batch_context

check failed: 1 error, 2 files
```
