Class SessionFreshnessEvaluator
java.lang.Object
io.agentscope.harness.agent.memory.session.SessionFreshnessEvaluator
Evaluates whether a session is still "fresh" or should be reset.
Inspired by agentscope-claw's SessionFreshnessEvaluator. Supports two reset policies:
- Daily reset: AgentStateStore resets after a configured hour each day
- Idle timeout: AgentStateStore resets after inactivity exceeding a threshold
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a freshness evaluator with default settings: daily reset at 4 AM, idle timeout of 2 hours, system timezone.SessionFreshnessEvaluator(int dailyResetHour, Duration idleTimeout, ZoneId timezone) -
Method Summary
Modifier and TypeMethodDescriptionintbooleanDetermines if the session should be considered stale and reset.
-
Constructor Details
-
SessionFreshnessEvaluator
public SessionFreshnessEvaluator()Creates a freshness evaluator with default settings: daily reset at 4 AM, idle timeout of 2 hours, system timezone. -
SessionFreshnessEvaluator
-
-
Method Details
-
isStale
Determines if the session should be considered stale and reset.- Parameters:
lastActivityAt- the timestamp of the last activity in the session- Returns:
- true if the session should be reset
-
getDailyResetHour
public int getDailyResetHour() -
getIdleTimeout
-