Skip to content
providerkit
GitHub

CompactionPolicy

Defined in: agents/src/types.ts:318

Model-only history trimming. The full journal and session turn are never shortened.

contextWindow: number;

Defined in: agents/src/types.ts:322

Supply the actual window for the configured model. No model-name guessing.


identity: string;

Defined in: agents/src/types.ts:320

Change when the summary prompt or hidden provider configuration changes.


optional keepTokens?: number;

Defined in: agents/src/types.ts:328

Recent tokens to keep. Core’s historyBudgetTokens(contextWindow) is the default.


optional retryOnContextLimit?: boolean;

Defined in: agents/src/types.ts:326

Keep the run’s task through every cut. A length rejection before the first chunk can buy one shorter retry per run, using the same turn. Never retries a hosted-tool request. After a restart, use a trim note rather than resend an interrupted summary.


optional summarize?: object;

Defined in: agents/src/types.ts:331

Omit to trim without a paid call. This provider must do inference only. The SDK sends no tools, allows one attempt, counts usage and refuses interrupted summarization.

instructions: string;
maxTokens: number;
provider: Provider;