Skip to main content
Keep continuous-learning stores healthy by capping size and expiring stale entries — automatically, without any LLM judgement.
The user keeps teaching the agent; old or excess learnings archive automatically so search stays fast.

How It Works

Quick Start

1

Enable with a cap

Set max_entries to limit how many learnings each store retains:
2

Run a manual prune

Call prune() on the learn manager for one-off cleanup:

How It Works

Usage telemetry is observed automatically — every search() and list_all() call increments use_count and updates last_used on returned entries. No extra configuration needed. Eviction scoring: entries are ranked by use_count ascending, then created_at ascending. The least-used, oldest entries are evicted first — the most valuable, recently accessed learnings always survive. Archival: evicted entries are appended to a per-store .archive.json sidecar (e.g., persona.archive.json) in the same directory as the active store file. The archive is append-only JSON — nothing is permanently hard-deleted. Writes are atomic and locked per store, so a crash mid-write cannot destroy earlier archived entries and two processes sharing a store cannot race. If the existing archive is unreadable (torn JSON or not a list), it is moved aside to a .corrupt sidecar and eviction carries on — max_entries and retention_days keep being enforced. Added in PraisonAI PR #6172.

Configuration Options

Full reference on max_entries and retention_days is in the LearnConfig reference.
Both fields default to 0 (unbounded). Existing agents are completely unaffected unless you opt in by setting a non-zero value.

Best Practices

If your agent runs for short sessions or handles a limited number of users, the defaults (max_entries=0, retention_days=0) are fine. Stores only grow with real interactions and stay small naturally.
Agents that run 24/7 and talk to many users can accumulate thousands of entries over time. Set max_entries=1000 to keep store files small and keep search fast. Pruning runs automatically on every write — no cron job needed.
For data minimization requirements (GDPR, SOC 2, etc.), set retention_days to make stale entries eligible for pruning. Pair with max_entries so pruning triggers automatically on write rather than requiring a manual call.
Evicted entries are never permanently deleted. The .archive.json sidecar (same directory as the store file) is an append-only JSON array. Open it to audit or restore evicted entries.Archive file location example:
A file like persona.archive.json.<pid>.<timestamp>.corrupt next to the archive is the quarantined copy of an earlier torn write. Its bytes are kept as-is and never auto-deleted — recover what you need and append it back into the active .archive.json. This matches Session Persistence → Corruption-quarantine on load.

LearnConfig reference

Full configuration options for continuous learning

Checkpoints

Save and restore agent state across runs

Bot Session Learning

Retention policies apply the same to bot-injected learn stores