aa-storage-redis 0.0.1-beta.2

Redis L2 shared-cache storage driver (SessionStore, RateLimitCounter, PolicyStore) for Agent Assembly
Documentation

Redis L2 shared-cache storage driver for Agent Assembly.

This crate implements three of the high-frequency [aa_storage] traits against a Redis (or Valkey) instance so multiple Assembly processes can coordinate through one shared cache instead of each hitting the L3 store:

Build a [RedisBackend] from a [RedisStorageConfig] and hand out the individual stores, or construct each store directly over a shared [Pool].

Key layout

Every key is namespaced under aa::

Store Key Value
session aa:session:<session_id> hash (agent_id, started_at_ns)
rate limit aa:ratelimit:<key> integer counter
policy aa:policy:<agent_id> JSON PolicyDocument

<session_id> and <agent_id> are the lower-case hex encodings of the 16-byte ids.

TTL and invalidation semantics

  • Sessions expire after [SESSION_TTL_SECS] seconds. The TTL is re-armed on every save so an actively written session never lapses; delete drops it immediately and is idempotent.
  • Rate-limit counters carry the window length supplied to increment as their TTL. The expiry is armed exactly once — on the first increment that creates the key — so the window is fixed: it starts at the first hit and is not pushed forward by later increments within the same window. reset deletes the key.
  • Policies are cached with an explicit per-entry TTL via [RedisPolicyStore::cache_policy] ([DEFAULT_POLICY_CACHE_TTL_SECS] is the suggested default). invalidate deletes the cached key so the next read misses and reloads from the authoritative store; it is idempotent.