Skip to content

PostgreSQL Adapter

The PostgreSQL Adapter provides robust database functionality with vector search capabilities, ideal for production deployments.

Installation

  1. Install required packages:

    Terminal window
    npm i github:elizaos-plugins/adapter-postgres
  2. Setup env variable:

    Terminal window
    POSTGRES_URL=postgresql://user:pass@localhost:5432/db
  3. 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