Skip to main content
Configure agents to learn from interactions, capturing patterns, preferences, and insights to improve future responses.

Quick Start

1

Simple Enable

Enable learning with default settings:
2

With Configuration

Enable specific learning capabilities:
3

With Bounded Retention

Cap store size and expire stale entries automatically:

Configuration Options

Both max_entries and retention_days default to 0 (unbounded). Existing agents are unaffected unless you explicitly set these values. There is no silent eviction — entries are only pruned when a cap is set.

Bounded Retention

Retention limits keep long-running agents healthy without losing data — evicted entries are saved to a .archive.json sidecar file next to the store, so nothing is permanently lost.

How pruning works

Entries are scored by least used first, then oldest — the most valuable, recently accessed learnings are always kept. The archive sidecar is written to the same directory as the store file, named <store>.archive.json (e.g., persona.archive.json).

Manual pruning

prune() is also called automatically on every write when limits are set. Manual calls are only needed for one-off cleanup of a long-running agent.

Common Patterns

Pattern 1: Full Learning Profile

Pattern 2: Shared Team Learning

Pattern 3: Compliance-Ready Agent


Best Practices

Both max_entries and retention_days default to 0 (unbounded). Unless your agent runs for months or handles compliance requirements, the defaults are fine. Stores only grow with actual interactions.
For agents that run continuously and interact with many users, set max_entries=1000 to keep store files small and search fast. The archive sidecar preserves evicted entries if you need to audit them.
For compliance requirements (e.g., GDPR, data minimization), set retention_days to automatically make old entries eligible for pruning. Pair with max_entries for proactive pruning on every write.
Keep learnings private unless you explicitly need shared team knowledge. This protects user data.
Evicted entries are never hard-deleted. Find the .archive.json sidecar (same directory as the store file) to recover them. The archive is append-only JSON.

Bounded Learning

User-flow guide: retention caps, archival, and the prune API

Agent Learn

Learn about the Agent Learn concept