agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
30 lines (29 loc) • 1.81 kB
TypeScript
/**
* agentfootprint/cache — public surface for the cache layer.
*
* The strategy an agent runs is chosen by CAPABILITY: the provider adapter
* declares how its wire caches (`LLMProvider.promptCaching`) and
* `cacheStrategyFor(provider, model?)` returns the strategy that serves it —
* - `BreakpointCacheStrategy` — `mode: 'breakpoints'` (Anthropic's
* `cache_control`; `anthropic()`, `browserAnthropic()`);
* - `AutomaticCacheStrategy` — `mode: 'automatic'` (OpenAI and Azure
* OpenAI cache on their own);
* - `NoOpCacheStrategy` — nothing declared for the model (Mock, Ollama,
* Gemini, any adapter that has not said).
* Nothing registers at module load and nothing is keyed by provider name, so
* a decorator that renames its provider keeps caching by forwarding the
* declaration.
*
* Public types (re-exported for consumers):
* - PromptCaching (the provider's declaration), CachePolicy, CacheMarker,
* CacheStrategy, CacheMetrics, CachePolicyContext, CacheStrategyContext,
* CacheUsage
*/
export type { CachePolicy, CachePolicyContext, CacheMarker, CacheStrategy, CacheStrategyContext, CacheMetrics, CacheUsage, PromptCaching, } from './types.js';
export { known, unknown, notApplicable, isKnown, valueOr, describeClaim, type Claim, } from '../lib/claim/claim.js';
export { cacheStrategyFor, promptCachingFor } from './cacheStrategyFor.js';
export { NoOpCacheStrategy } from './strategies/NoOpCacheStrategy.js';
export { BreakpointCacheStrategy } from './strategies/BreakpointCacheStrategy.js';
export { AutomaticCacheStrategy } from './strategies/AutomaticCacheStrategy.js';
export { cacheRecorder } from './cacheRecorder.js';
export type { CacheRecorderOptions, CacheRecorderHandle, CacheReportSummary, PerIterEntry, } from './cacheRecorder.js';