@betterdb/agent-cache

4 cookbooks for multi-tier AI agent caching. LLM responses, tool results, and session state behind one connection - on vanilla Valkey 7+, no modules required.

01

Getting Started

Install on vanilla Valkey 7+, create an AgentCache, and use all three tiers: LLM cache, tool cache, and session store.

Beginner~15 minTypeScript
02

LLM & Tool Cache

Exact-match LLM response caching with cost tracking. Per-tool TTL policies. toolEffectiveness() recommendations for self-tuning caches.

Intermediate~20 minTypeScript
03

Agent Session Store

Per-field TTL, sliding-window refresh, and atomic state updates for multi-step agents. Store intent, reasoning chains, and extracted entities.

Intermediate~20 minTypeScript
04

LangGraph Checkpointing

BetterDBSaver persists LangGraph graph state on vanilla Valkey 7+ - no Redis 8, no RedisJSON, no RediSearch. Combine with LLM and tool caching for full-stack agent optimization.

Advanced~25 minTypeScript

Package

Multi-tier agent cache. No modules required. Framework adapters for LangChain, Vercel AI SDK, and LangGraph.

npm install @betterdb/agent-cache
📦 View on npm 📂 valkeyforai Repo