PostgreSQL Adapter
The PostgreSQL Adapter provides robust database functionality with vector search capabilities, ideal for production deployments.
Installation
-
Install required packages:
Terminal window npm i github:elizaos-plugins/adapter-postgresTerminal window pnpm add github:elizaos-plugins/adapter-postgresTerminal window yarn add github:elizaos-plugins/adapter-postgres -
Setup env variable:
Terminal window POSTGRES_URL=postgresql://user:pass@localhost:5432/db -
Enable vector search extension:
Terminal window CREATE EXTENSION vector;
Basic Setup
import { AgentBuilder } from "@iqai/agent";import PostgresAdapter from "@elizaos/adapter-postgres";
const agent = new AgentBuilder() .withDatabase(PostgresAdapter) // ... other configuration .build();
Key Features
- โ๏ธ Vector search support
- โ๏ธ Comprehensive logging
- โ๏ธ Production scaling
Best Practices
- โ๏ธ Use for production deployments
- โ๏ธ Enable connection pooling
- โ๏ธ Implement proper indexing
- โ๏ธ Monitor vector search performance
Ensure pgvector extension is installed before initializing the adapter.
PostgreSQL is recommended for prodcution deployments requiring vector search capabilities.