Skip to content

Repository files navigation

ai-agent-memory

AI agent web server built with Vercel AI SDK and Bun, featuring persistent memory storage.

Setup

  1. Install dependencies:
bun install
  1. Set your OpenAI API key:
export OPENAI_API_KEY=your_api_key_here
  1. Set database connection string:
export DATABASE_URL_MEMORY_DB=postgresql://user:password@host:port/database

Usage

Start the server:

bun run start

Or for development with watch mode:

bun run dev

The server will run on http://localhost:8080 (or the port specified in PORT env var).

API Endpoints

POST /chat

Send a prompt to the AI agent. Returns a streaming text response.

Request:

{
  "prompt": "What time is it?"
}

Or:

{
  "message": "What time is it?"
}

Response:

Streaming text response (text/event-stream).

GET /health

Health check endpoint.

GET /

API information.

Features

The agent includes four tools:

  • getCurrentTime: Get the current date and time
  • createMemory: Store a new memory or piece of information for future conversations
  • getMemories: Retrieve stored memories (default limit: 100)
  • deleteMemory: Delete a specific memory by its ID

Database

The application uses PostgreSQL for persistent memory storage. Migrations run automatically on startup.

Deployment

This project is configured for deployment on Neptune. See neptune.json for configuration.

To deploy, set up the Neptune MCP server and ask your AI agent to deploy the project. The agent will handle provisioning resources, setting secrets, and deploying the application.

For more information, see the Neptune documentation.

This project was created using bun init in bun v1.3.5. Bun is a fast all-in-one JavaScript runtime.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages