메모리를 갖춘 에이전트

지속적인 메모리 기능을 갖춘 에이전트를 구축합니다.

빠른 시작#

전체 예제 클론하기#

가장 쉬운 시작 방법은 전체 예제 저장소를 클론하는 것입니다:

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

또는 패키지만 설치하기#

처음부터 직접 구축하려면:

bash
npm install @astreus-ai/astreus

환경 설정#

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

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

메모리 에이전트#

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

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

// 첫 번째 대화
const response1 = await agent.ask("My name is John and I like TypeScript");
console.log(response1);

// 이후 대화 - 에이전트가 기억함
const response2 = await agent.ask("What's my name and what do I like?");
console.log(response2); // Should remember John and TypeScript

예제 실행하기#

저장소를 클론했다면:

bash
npm run dev

저장소#

전체 예제는 GitHub에서 확인할 수 있습니다: examples/agent-with-memory