AMEM.EPIS.QUERY
AMEM.EPIS.QUERY agent_id [TYPE event_type] [FROM timestamp] [TO timestamp] [LIMIT n]
- Group
- Agent memory
- Complexity
- O(N) where N is the number of events in the log
- Arity
- -2 (at least 2 words, counting the command name)
- Flags
- read-only, slow
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- Performance and Scale
- On-Premise
- requires the agent-memory license feature
Agent memory gives AI agents four kinds of memory. Episodic memory is an append-only log of timestamped events per agent, which you can query by event type and time range. AMEM.EPIS.QUERY returns matching events, oldest first.
Options
Section titled “Options”| Option | Effect |
|---|---|
TYPE event_type |
Only events of this type (exact match). |
FROM timestamp |
Only events at or after this time, in nanoseconds since the Unix epoch. |
TO timestamp |
Only events at or before this time, in nanoseconds since the Unix epoch. |
LIMIT n |
Return at most n events, the oldest matching ones. Default 100. |
Options can be combined in any order.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Always | Array of events. Each event is a flat array: "type", the type, "content", the content, "metadata", the metadata (empty if none), "timestamp", the timestamp as an integer. Empty for an unknown agent. |
Same |
Errors:
ERR invalid FROM,ERR invalid TOorERR invalid LIMITif the value is not a valid number (LIMITcannot be negative). The query is not run without the filter.ERR unknown option 'name'for an option other thanTYPE,FROM,TOandLIMIT, andERR syntax errorif an option has no value.ERR wrong number of arguments for 'amem.epis.query' commandif the argument count is wrong.NOLICENSE agent-memory requires a HotKV license. Contact sales@hotkv.comif your license does not include theagent-memoryfeature.
Examples
Section titled “Examples”127.0.0.1:6379> AMEM.EPIS.QUERY agent-42 TYPE observation LIMIT 101) 1) "type" 2) "observation" 3) "content" 4) "72F and sunny" 5) "metadata" 6) "{\"source\":\"weather-api\"}" 7) "timestamp" 8) (integer) 1790985600123456789Compatibility
Section titled “Compatibility”HotKV-only command. Redis and Valkey have no equivalent.
See also
Section titled “See also”AMEM.EPIS.LOG, AMEM.EPIS.CLEAR, AMEM.EPIS.STATS, AI features guide
Was this page helpful?
Thanks for the feedback.