Skip to content

DeferStrategy

Defined in: src/context-manager/strategies/deferred-tool-loading.ts:85

Experimental

A strategy that keeps tools’ input schemas out of the model’s context until the model loads them with load_tools. The model still sees each deferred tool’s name and description. A call to a deferred tool made before its load doesn’t run: the model gets the tool’s schema and calls it again. It never changes the messages.

readonly name: string;

Defined in: src/context-manager/types.ts:21

Experimental

Stable identifier for logging and observability.

ContextStrategy.name

when(conditions?): DeferStrategy;

Defined in: src/context-manager/strategies/deferred-tool-loading.ts:91

Experimental

Returns a copy of this strategy with these conditions in place of its current ones.

ParameterType
conditions?DeferConditions

DeferStrategy

Error when a condition name is unknown or its value is invalid


init?(agent, archive?): void;

Defined in: src/context-manager/types.ts:30

Experimental

Called once when the ContextManager is attached to an agent. Strategies can use this to register hooks (e.g., eager offloading on message arrival).

archive is @internal — it is not exported, so its shape is not a stable contract for strategies outside the SDK. Pass it to Offload strategies rather than calling it directly.

ParameterType
agentLocalAgent
archive?Archive

void

ContextStrategy.init


apply(context): Promise<boolean>;

Defined in: src/context-manager/types.ts:36

Experimental

Attempt to reduce context. Returns true if it made changes, false if it decided not to act (e.g., conditions not met, nothing to offload).

ParameterType
contextContextState

Promise<boolean>

ContextStrategy.apply