Skip to main content

Interface: PromptCacheOptions

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

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:61

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


scope?

optional scope?: PromptCacheScope

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

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:59

Stamp the system / instructions block. Default true.


tools?

optional tools?: boolean

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

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:63

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