Travel and booking agents
Weather, currency and availability lookups repeat across travellers and planning steps. Each result is fetched once per TTL.
Agents call the same tools with the same arguments over and over. Memoize the results and stop paying for the same API call twice.
Weather changes slowly, so results live for 15 minutes.
An animated walkthrough with real HotKV commands and example replies. Click any step to jump to it.
Agents loop. They look up the same weather, the same exchange rate, the same SQL result and the same web page several times in one run and again in the next. Each call costs latency, rate limit and often money, and slow tools make every agent step slow.
The tool cache memoizes deterministic tool calls under a key built from the tool name and its arguments. Before calling a tool, the agent asks the cache. A hit returns the stored result immediately, a miss calls the tool once and stores the result with a TTL that matches how fresh it needs to be.
Weather changes slowly, so results live for 15 minutes.
TOOL.CACHE.CREATE tools MAX_ENTRIES 100000 TTL 900Nothing cached for these arguments yet.
TOOL.CACHE.GET tools "get_weather(city=Lisbon)"The real API is called, and the result is cached for the next 15 minutes.
TOOL.CACHE.SET tools "get_weather(city=Lisbon)" "{\"temp_c\":21,\"sky\":\"clear\"}" TTL 900The agent plans a second day trip and asks again. So do other agents for other travellers.
TOOL.CACHE.GET tools "get_weather(city=Lisbon)"Hits, misses and the usage saved are reported per namespace.
TOOL.CACHE.STATS toolsWeather, currency and availability lookups repeat across travellers and planning steps. Each result is fetched once per TTL.
Read-only SQL queries and dashboard metrics are memoized, so an agent exploring the data does not hammer the warehouse.
Fetched and parsed web pages are cached, so the same page is not downloaded again in every run.
Keys are built from the tool name and its arguments, so each distinct call is cached separately.
TOOL.CACHE.GETTOOL.CACHE.SETA default TTL per namespace and an optional TTL per entry.
TTLAn entry limit per namespace, with eviction when it is full.
MAX_ENTRIESHits, misses, evictions, memory and usage saved.
TOOL.CACHE.STATSDeterministic, read-only calls, such as lookups, searches and queries whose result only depends on the arguments. Never cache tools that change something, such as sending an email.
Yes. TOOL.CACHE.DEL removes one entry and TOOL.CACHE.FLUSH empties a namespace.
The tool cache is part of the Performance and Scale plans.
HotKV speaks the Redis protocol, so you can point an existing client at it and run these same commands.