Skip to content

AgenticState

nae.AgenticState

Bases: TypedDict

nae.state.merge_token_usage

merge_token_usage(left, right) -> dict

Reducer for the token channel: merge two {model_name: usage} dicts.

Union by model key; when the same model appears on both sides its usage breakdown is deep-summed (top-level token counts AND nested *_details). Associative/commutative so parallel fan-in merges cleanly. A missing/None left (the first update) is treated as {}.

nae.state.accumulate

accumulate(left, right)

Reducer for a map-reduce collection channel: each parallel writer contributes ONE value, accumulated into a list (arrival order). A missing/None left (the first update) is treated as [].