Learn
Extract learnings after each turn and inject them into the next.
learn extracts durable learnings after each turn and folds them back into the next system prompt.
Quick Start
- Enable agentic learning
typescript import { Agent } from 'praisonai'; const agent = new Agent({ instructions: 'Assist the user', learn: 'agentic' }); await agent.chat('Remember I prefer metric units'); await agent.chat('How tall is Everest?'); // answer respects the learned preferencelearn: trueis the same aslearn: 'agentic'. - Propose instead of applying
typescript const agent = new Agent({ instructions: 'Assist', learn: 'propose' });
Modes
| Mode | Behaviour |
|---|---|
'agentic' | Extracts and applies learnings automatically. |
'propose' | Extracts learnings as proposals rather than applying them. |
'disabled' | Off (same as omitting learn). |
Injection and nudges
After a turn, the manager extracts learnings and injects a Learned Insights block into the next system prompt. Two fields on LearnConfig add periodic reminders:
| Field | Default | Effect |
|---|---|---|
nudgeInterval | 0 | Turns between [System nudge] reminders (0 disables). |
nudgeMinToolIters | 3 | Minimum tool iterations before a nudge fires. |
import { Agent } from 'praisonai';
const agent = new Agent({
instructions: 'Assist',
learn: { mode: 'agentic', nudgeInterval: 5, nudgeMinToolIters: 3 },
});Reading the manager
import { Agent } from 'praisonai';
const agent = new Agent({ instructions: 'x', learn: 'agentic' });
console.log(agent.getLearnManager()); // the lazily-built manager, or undefined