Instructions and model context
Separate trusted instructions from user data and select bounded completed history explicitly.
Keep policy outside retrieved content
Agent instructions are trusted application policy. User messages, retrieved files and Tool results are data, not permission to change that policy. Select Tools and resource access in host code.
Applications decide which documents and completed conversation turns a model may receive. A persisted transcript does not automatically belong in every prompt. Redact secrets before assembling context.
Prepare bounded history deliberately
import type {
AgentModelContextOptions,
AgentContextHistoryTurn,
} from "@smoothie-framework/runtime/agent";Custom handlers can pass context policy to context.runModelTurn: completed history groups, an estimator identity, input limits, output reserve and safety margin. Oldest complete groups may be removed; active Tool exchanges remain protected. An oversized protected context fails before another provider invocation.
Token estimates are not billing measurements. The application owns deterministic estimation, summary provenance and policy revisions across resume. This is not automatic long-term memory.
For actual usage and spend admission, use inference budgets, not a context-size estimate.