This storage is persistent — values survive a server restart. It is a simple key-value store, not a replacement for a database: for structured, queryable data use Data Operations.
This is unrelated to an agent’s
accessMemory setting, which gives an agent file tools over its workspace. See AI Agents.store_key
Stores a key-value pair in persistent storage.Key
The unique identifier for storing the data. Use template syntax to create dynamic keys.Value
The data to store. Can be any value, including JSON objects.
Use
{{ jsonout .action_result }} to store complex objects from previous actions.
Output
{{ .step_id }} holds the value that was stored.
Example
Store a user object:get_key
Retrieves a value from persistent storage by key.Key
The key to look up.Fail If Empty
Whether to fail the step when the key is not set. Whenfalse, a missing key yields an empty result and the workflow continues.
Output
{{ .step_id }} holds the stored value, or is empty when the key is not set.
Example
Retrieve a cached user:Common Patterns
Cache-Aside Pattern
Check the cache first, fetch from the database if not found, then update the cache:Session Storage
Store and retrieve user session data:Rate Limiting Counter
Track request counts for rate limiting:Temporary Token Storage
Store and validate temporary tokens:Best Practices
Data Size: Keep stored values reasonably sized. For large datasets, consider storing only essential fields or IDs and fetching full data when needed.
Next Steps
Data Operations
Use a database for structured, queryable data.
Transformation
Process and transform cached data with JavaScript.
Flow Control
Combine caching with parallel data fetching.
Actions Overview
Learn the fundamentals of ServFlow actions.