agentscope-java icon indicating copy to clipboard operation
agentscope-java copied to clipboard

[Question]: RedisAgentStateStore 设计的时候为什么不考虑 TTL 设计

Open Alanyaeer opened this issue 3 months ago • 2 comments

I reviewed the source code of RedisAgentStateStore and found that it does not provide a way to configure TTLs for its keys. What are the best practices for using this state store in a production environment?

Alanyaeer avatar Aug 19 '26 08:08 Alanyaeer

对,长会话怎么控制呢,尤其是baseStore也用redis长期使用不会出问题吗

XingqiLineu avatar Aug 24 '26 03:08 XingqiLineu

Adding a production scenario. We embed HarnessAgent in business services (RedisDistributedStore + RemoteFilesystemSpec, per-user isolation). Product requirements say that inactive conversations are deleted after 90 days, and all data of a user inactive for 365 days (long-term memory included) is deleted too. Because no key has a TTL, Redis grows without bound: session state, transcripts, sessions.json, memory and archive.

Per-key TTLs from the framework would not fully solve this. Retention is by last activity, related keys (data and index) must expire together, and business data outside the framework has to be deleted at the same time. For now we keep our own activity index and run a scheduled job that deletes through the public APIs. The gaps we hit are summarized in #3346: there is no public "delete session" API, and there is no way to remove a sessions.json entry. A retention mechanism or a delete API in the framework would let us remove this code.

xuchaoguo1983 avatar Sep 29 '26 01:09 xuchaoguo1983