Agent with Memory

Example

Build agents with persistent memory capabilities.

Quick Start

Clone the Complete Example

The easiest way to get started is to clone the complete example repository:

git clone https://github.com/astreus-ai/agent-with-memory
cd agent-with-memory
npm install

Or Install Package Only

If you prefer to build from scratch:

npm install @astreus-ai/astreus

Environment Setup

# .env
OPENAI_API_KEY=sk-your-openai-api-key-here

# Database for memory storage
DB_URL=sqlite://./astreus.db

Memory Agent

import { Agent } from '@astreus-ai/astreus';

const agent = await Agent.create({
  name: 'MemoryBot',
  model: 'gpt-4o',
  memory: true,
  systemPrompt: 'You remember our conversation history.'
});

// First conversation
const response1 = await agent.ask("My name is John and I like TypeScript");
console.log(response1);

// Later conversation - agent remembers
const response2 = await agent.ask("What's my name and what do I like?");
console.log(response2); // Should remember John and TypeScript

Running the Example

If you cloned the repository:

npm run dev

Repository

The complete example is available on GitHub: astreus-ai/agent-with-memory

How is this guide?