AI agent web server built with Vercel AI SDK and Bun, featuring persistent memory storage.
- Install dependencies:
bun install- Set your OpenAI API key:
export OPENAI_API_KEY=your_api_key_here- Set database connection string:
export DATABASE_URL_MEMORY_DB=postgresql://user:password@host:port/databaseStart the server:
bun run startOr for development with watch mode:
bun run devThe server will run on http://localhost:8080 (or the port specified in PORT env var).
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).
Health check endpoint.
API information.
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
The application uses PostgreSQL for persistent memory storage. Migrations run automatically on startup.
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.