---
title: "ClikaRT::runtime::BatchableState"
sidebar_label: "BatchableState"
description: "Mix-in for a ModelState that the continuous batcher can pack. The batcher reads these to decide how many sessions fit in one step; both must be host-cheap (no device round-trip)."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--class">class</span>

**Header:** `ClikaRT/runtime/state.h`

Mix-in for a [`ModelState`](./ModelState.md) that the continuous batcher can pack. The batcher reads these to decide how many sessions fit in one step; both must be host-cheap (no device round-trip). The getters are `noexcept`: an override that raises terminates in your own program rather than unwinding into the runtime, and the compiler refuses an override that is not `noexcept`.

## Member functions

### \~BatchableState() {#BatchableState}

<div class="api-signature">

`virtual` **`~BatchableState`**()

</div>

Virtual; deletable through the interface.

<div class="api-declared">

Declared in `ClikaRT/runtime/state.h`, line 46

</div>

### occupancy() {#occupancy}

<div class="api-signature">

`virtual` `std::int64_t` **`occupancy`**() `const noexcept=0`

</div>

Current per-session load (e.g. cached tokens) and the per-session ceiling (e.g. the KV-cache capacity). The batcher uses the headroom ([`capacity`](./BatchableState.md#capacity)` - `[`occupancy`](./BatchableState.md#occupancy)) to admit work.

<div class="api-declared">

Declared in `ClikaRT/runtime/state.h`, line 51

</div>

### capacity() {#capacity}

<div class="api-signature">

`virtual` `std::int64_t` **`capacity`**() `const noexcept=0`

</div>

Total session capacity of this state ([`occupancy()`](./BatchableState.md#occupancy) is the live count).

<div class="api-declared">

Declared in `ClikaRT/runtime/state.h`, line 53

</div>

### step\_tokens() {#step_tokens}

<div class="api-signature">

`virtual` `std::int64_t` **`step_tokens`**() `const noexcept`

</div>

Units this session wants to RUN in its next step, the per-step cost, where [`occupancy()`](./BatchableState.md#occupancy) is the carried state. A decode step is 1; a session ingesting a prompt in chunks reports its next chunk's length. The batcher sums it against [`BatcherConfig::step_token_budget`](./BatcherConfig.md#step_token_budget) so one step's launched work stays bounded. Host-cheap. Default: one unit.

<div class="api-declared">

Declared in `ClikaRT/runtime/state.h`, line 60

</div>
