@nestjs-agentic/experience
v0.6.0
Published
Experience learning, trajectory reflection, and self-correction engine for nestjs-agentic.
Maintainers
Readme
@nestjs-agentic/experience
Experience learning, trajectory reflection (Reflexion pattern), and self-correction engine for nestjs-agentic.
Installation
npm install @nestjs-agentic/experience @nestjs-agentic/memory nestjs-agenticFeatures
- Trajectory Reflection Engine: Analyzes agent execution trajectories, critiques tool failures, and extracts actionable lessons learned.
- Experience Learner: Records learned trajectory rules and injects prompt guidance into agent execution contexts.
- Seamless Memory Integration: Integrates directly with
@nestjs-agentic/memoryto persist learned rules across session threads.
Quick Start
import { ExperienceLearner } from '@nestjs-agentic/experience';
import { ShortTermMemory } from '@nestjs-agentic/memory';
const memory = new ShortTermMemory();
const learner = new ExperienceLearner({ memoryStore: memory });
// Reflect on a failed execution trajectory
const reflection = await learner.reflect({
sessionId: 'sess_101',
agentName: 'build-agent',
goal: 'Package Installation',
success: false,
steps: [
{ stepIndex: 1, toolName: 'npmInstall', error: 'npm ERR! Use pnpm add instead' },
],
});
console.log(reflection.lessonsLearned);
// => ["Use \"pnpm\" package manager instead of \"npm\" for this project."]
// Retrieve guidance for future runs
const guidance = await learner.getPromptGuidance('Package Installation');