Agent with Memory

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:

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

Or Install Package Only#

If you prefer to build from scratch:

bash
npm install @astreus-ai/astreus

Environment Setup#

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

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

Memory Agent#

typescript
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:

bash
npm run dev

Repository#

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