Intelligence · function

assembleContext

Never send the scene graph.

Explained in Agents and behaviour.

function assembleContext(providers: readonly ContextProvider<unknown>[], subject: string, tick: number, tokenBudget: number): AssembledContext
import { assembleContext } from '@driftengine/ai';

Parameters

ParameterTypeDescription
providersreadonly ContextProvider<unknown>[]
subjectstring
ticknumber
tokenBudgetnumber

In depth

Sections are taken in descending priority until the budget is spent, and what did not fit is named. The estimate is deliberately crude — a provider-specific tokenizer may sharpen it, but requiring one would make the core abstraction depend on whichever provider happened to be configured.