Skip to main content

PostgreSQL CLI

Docker Setup

docker run -d --name postgres \
  -e POSTGRES_PASSWORD=postgres \
  -p 5432:5432 \
  postgres:15

Quick Start

# Test connection
praisonai persistence doctor \
  --conversation-backend postgres \
  --conversation-url "postgresql://postgres:postgres@localhost:5432/postgres"

# Run agent
praisonai persistence run \
  --conversation-backend postgres \
  --conversation-url "$POSTGRES_URL" \
  "Hello"

Commands

Doctor

praisonai persistence doctor \
  --conversation-backend postgres \
  --conversation-url "postgresql://user:pass@host:5432/db"

Run with Session

praisonai persistence run \
  --conversation-backend postgres \
  --conversation-url "$POSTGRES_URL" \
  --session-id my-session \
  "What is AI?"

Resume

praisonai persistence resume \
  --conversation-backend postgres \
  --conversation-url "$POSTGRES_URL" \
  --session-id my-session

Export/Import

praisonai persistence export \
  --conversation-backend postgres \
  --conversation-url "$POSTGRES_URL" \
  --session-id my-session \
  --output session.json

praisonai persistence import \
  --conversation-backend postgres \
  --conversation-url "$POSTGRES_URL" \
  --input session.json

Python Test

python3 -c "
from praisonai.persistence import create_conversation_store
store = create_conversation_store('postgres', url='postgresql://postgres:postgres@localhost:5432/postgres')
print('PostgreSQL OK')
"