Self-learning loops that make your AI agents smarter over time. Track runs, extract patterns, inject learned rules. 5 lines of code.
Every AI agent stack has memory. None of them learn. AgentLoops fills the gap.
Add self-learning to any agent in under a minute.
from agentloops import AgentLoops loops = AgentLoops("sales-outreach") # Track every agent run loops.track(input=task, output=result, outcome="meeting_booked") # Agent reflects on what's working reflection = loops.reflect() # Inject learned rules into your prompt enhanced = loops.enhance_prompt(base_prompt) # Evolve conventions over time loops.conventions.evolve() # Forget stale patterns loops.forget(max_age_days=21)
Inspired by Reflexion, cognitive memory architectures, and months of production use.
Agent evaluates its own output and writes patterns to conventions. Learns from every single run.
Detects performance anomalies and triggers immediate follow-up analysis to understand what changed.
Scores outputs on configurable criteria before they ship. Catches regressions before your users do.
Extracts prescriptive IF/THEN rules from performance data. Not opinions -- evidence-backed patterns.
Compares agent predictions against actual outcomes. Validates which rules actually move the needle.
Detects conflicting learned rules and resolves them automatically. No more contradictory conventions.
Prunes stale patterns that no longer apply. Keeps memory lean and relevant with time-decay + importance weighting.
If your agent runs more than once, it should be learning.
Agents learn which email patterns book meetings
Learn which responses resolve tickets fastest
Discover which formats drive the most engagement
Learn which patterns produce fewer bugs
Learn which sources yield the best insights
Agents learn from market pattern outcomes
Learn which incidents need which runbooks
Adapt teaching style to what works per student
Learn which clauses flag real risks vs noise
Improve triage accuracy from patient interaction data
Learn guest preferences, upsell timing, and escalation patterns
| Feature | AgentLoops | Mem0 | Letta | DIY |
|---|---|---|---|---|
| Self-reflection | Yes | -- | -- | Manual |
| Automatic rule extraction | Yes | -- | -- | Manual |
| Spike detection | Yes | -- | -- | Manual |
| Contradiction resolution | Yes | -- | -- | -- |
| Selective forgetting | Yes | -- | Partial | -- |
| Prompt enhancement | Yes | -- | -- | Manual |
| Convention evolution | Yes | -- | -- | -- |
| Framework-agnostic | Yes | Yes | No | Yes |
| Lines of code to add | ~5 | ~10 | ~50 | ~500 |
| Focus | Learning | Storage | Stateful agents | -- |
Get early access to new features, integrations, and the hosted version.