Quick Start
What’s Bounded by Default
| Resource | Default limit | When it cleans up |
|---|---|---|
| Per-user lock cache | 10,000 entries, 1 hour TTL | Idle, unlocked entries evict automatically |
| Agent locks | One per agent instance | Removed when the agent is garbage-collected |
| Session histories | Opt-in via session_ttl | See Session Persistence |
Recreating agents per request is safe. Agent locks no longer reuse stale
id(agent) keys, so unrelated users cannot share locks or swap histories.Operational Knobs
Trim conversation state when you need tighter control than the default lock cache:SessionRunControl.cleanup_stale_sessions(max_age_seconds=3600) removes abandoned run-control state.
Multi-Agent Safety
Earlier releases keyed agent locks onid(agent). CPython may reuse that integer after garbage collection, so long-running gateways that recreated agents per request could silently mix up two users’ histories. Agent locks now follow agent lifetime via WeakKeyDictionary; per-user locks stay bounded even if you never call cleanup helpers.
Released in PR #1972 — Upgrade to pick up the fix. See Session Persistence → Bounded lock caches for details.
Related
Session Persistence
Bot session storage and bounded lock behaviour
Messaging Bots
Platform setup, debounce, and chunking
Inbound DLQ
Persist failed messages for replay
Cross-Platform Mirror
One conversation across every channel

