Skip to main content

Interface: PromptCacheOptions

Defined in: packages/core/src/prompt-cache.ts:44

Explicit prompt-cache plan. Object form defaults to prefix-only so a stable tools+system prefix can be stamped without writing unique turns.

Examples​

Prefix-only — stable tools + system, unique suffix uncached

await bot.process(input, { cache: { scope: 'prefix', ttl: '1h' } });

Chat-style, same as `enableCaching: true` / `cacheControl: true`

await bot.process(input, { cache: { scope: 'chat' } });

Properties​

lastMessages?​

optional lastMessages?: number

Defined in: packages/core/src/prompt-cache.ts:60

How many trailing conversation messages to stamp. 0 = none.


scope?​

optional scope?: PromptCacheScope

Defined in: packages/core/src/prompt-cache.ts:51

Convenience: 'prefix' → last-tool + system, no messages; 'chat' → last-tool + system + last 4. Ignored for a field the caller set explicitly (system, tools, lastMessages).


system?​

optional system?: boolean

Defined in: packages/core/src/prompt-cache.ts:58

Stamp the system / instructions block. Default true.


tools?​

optional tools?: boolean

Defined in: packages/core/src/prompt-cache.ts:56

Stamp the last always-loaded tool (skip deferred / provider tools). Skipped when a tool already carries a stamp. Default true.


ttl?​

optional ttl?: AnthropicCacheTtl

Defined in: packages/core/src/prompt-cache.ts:62

Forwarded on every stamp this plan writes, and onto existing stamps that omit it.