---
url: 'https://adk.nht.io/api/@nhtio/adk/type-aliases/TokenizableEvaluator.md'
description: >-
  A DYNAMIC Tokenizable value: a function evaluated at prompt-ASSEMBLY time with
  the live dispatch context, so the wrapped content computes itself coherent
  with the dispatch it ships in (e.g. a citation instruction that adapts to
  whether the answer tool survived the subtractive-pass shed).
---

# Type Alias: TokenizableEvaluator

```ts
type TokenizableEvaluator = (ctx?: DispatchContext) => string;
```

Defined in: [src/lib/classes/tokenizable.ts:28](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/lib/classes/tokenizable.ts#L28)

A DYNAMIC Tokenizable value: a function evaluated at prompt-ASSEMBLY time with the live dispatch
context, so the wrapped content computes itself coherent with the dispatch it ships in (e.g. a
citation instruction that adapts to whether the answer tool survived the subtractive-pass shed).

## Parameters

| Parameter | Type                                                        |
| --------- | ----------------------------------------------------------- |
| `ctx?`    | [`DispatchContext`](../types/interfaces/DispatchContext.md) |

## Returns

`string`

## Remarks

The context is OPTIONAL: the same Tokenizable is also read outside any dispatch (token measurement,
serialization, plain string coercion). The evaluator MUST therefore handle `ctx === undefined` and
return a string for EVERY input — that no-ctx branch IS its fallback. It must never throw and must
never return a non-string; either violation raises [@nhtio/adk!E\_TOKENIZABLE\_EVALUATOR\_INVALID](../exceptions/variables/E_TOKENIZABLE_EVALUATOR_INVALID.md)
(loud — a mis-authored evaluator must not silently coerce garbage into the prompt). Keep evaluators
serializer-friendly (capture only module-level refs or values passed as explicit bindings, NOT live
per-turn state) so a dynamic Tokenizable round-trips its evaluator and stays dynamic across encode/decode.
