AgentForge

Memory Overview

AgentForge's memory layer — working, session, and long-term memory for agents.

Three Tiers of Memory

TierScopePersistenceImplementation
WorkingCurrent stepEphemeralConversation context
SessionSingle runTask-scopedState store
Long-termCross-sessionDurablePgVector / In-memory

Quick Start

import { defineAgent, InMemoryMemoryStore } from '@ahzan-agentforge/core';

const agent = defineAgent({
  name: 'remembering-agent',
  description: 'Agent with memory',
  tools: [myTool],
  llm,
  systemPrompt: '...',
  memory: {
    store: new InMemoryMemoryStore(),
    config: {
      autoCapture: true,
      retrieveBeforeStep: true,
      maxRetrieved: 5,
    },
  },
});

Manual Memory Operations

// Store a memory
await agent.remember('Customer prefers email communication', {
  type: 'preference',
  customerId: 'cust_123',
});

// Recall memories
const results = await agent.recall('communication preferences', {
  customerId: 'cust_123',
});

Available Stores

StoreBackendBest For
InMemoryMemoryStoreIn-processDevelopment, testing
PgVectorMemoryStorePostgreSQL + pgvectorProduction

Next Steps