Intro
The agent cache holds what an agent produced during a run, so the work happens once for the run instead of once for every row. A login session and a handle that cost money to obtain are the usual entries. Names areUPPER_SNAKE_CASE and up to 64 characters. A value is up to 32 KB. A
lifetime is between 5 seconds and 24 hours, and is 15 minutes when the request
names none.
There is no listing route: names come from the agent code that wrote them.
A write replaces whatever the name held. To write only when the name is free,
claim it instead: the claim route answers whether this caller is the one that
took the name, which is how one row does work the rows beside it then reuse.
Every route needs an API key that can manage the agent cache. A read returns the
value, so a caller that can overwrite an entry can already choose what the next
read answers.
Inside a code agent, use the Python SDK’s
langwatch.cache
rather than these routes directly. The platform gives each run its own
credential, so agent code needs no key of its own.