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.

Diagram

💬 turn

🧠 extract learnings

📌 inject Learned Insights

💬 next turn

Quick Start

  1. 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 preference

    learn: true is the same as learn: 'agentic'.

  2. Propose instead of applying
    typescript
    const agent = new Agent({ instructions: 'Assist', learn: 'propose' });

Modes

ModeBehaviour
'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:

FieldDefaultEffect
nudgeInterval0Turns between [System nudge] reminders (0 disables).
nudgeMinToolIters3Minimum tool iterations before a nudge fires.
typescript
import { Agent } from 'praisonai';

const agent = new Agent({
  instructions: 'Assist',
  learn: { mode: 'agentic', nudgeInterval: 5, nudgeMinToolIters: 3 },
});

Reading the manager

typescript
import { Agent } from 'praisonai';

const agent = new Agent({ instructions: 'x', learn: 'agentic' });
console.log(agent.getLearnManager()); // the lazily-built manager, or undefined

Related