Deploy RDS
Lexia provides a built-in PostgreSQL database for AI agent developers. This removes the need to set up, host, or manage your own database infrastructure. Using a single CLI command, Lexia automatically creates a fully configured RDS instance and returns all required connection details.
The database is ready to use immediately and can be connected directly to your agent code for long-term or short-term memory storage.
1. Overview
Lexia's Relational Database provides a managed PostgreSQL environment that eliminates the need for manual database setup, hosting, or configuration. With the Lexia CLI, you can create, manage, and connect to PostgreSQL databases with minimal effort.
What this enables:
Once provisioned, your agent can immediately:
- Store conversation memory
- Save user data
- Manage long-term storage
- Handle custom application logic
- Persist any structured information
This database is fully managed by Lexia, so you don't need to deploy, maintain, or scale it yourself.
2. How it Works
When you run the database creation command, Lexia provisions a PostgreSQL database for your workspace.
The returned information includes:
- Database name
- Schema
- Username
- Password
- Workspace details
- Connection string
No Docker setup, no manual deployment, and no hosting configuration are required.
You can focus entirely on your agent instead of database operations.
3. Install CLI
Install globally via npm:
npm install -g @lexia/cli
Or run without installation:
npx @lexia/cli kickstart python
4. Log in
Authenticate with your workspace:
lexia login
Select Team Mode, enter your workspace name, and provide your authentication token.
The token can be generated under API Keys in the Lexia dashboard.
5. Create Database
List available DB commands:
lexia db
Create a new database:
lexia db create
Lexia will generate a PostgreSQL instance and return the credentials.
These include schema, username, password, and a ready-to-use connection string.
You can insert these details directly into your agent's code or environment variables.
Example Output
After running lexia db create, you'll receive output similar to:
Database created successfully!
Database Name: lexia_db_abc123
Schema: public
Username: lexia_user
Password: secure_password_here
Connection String: postgresql://lexia_user:[email protected]:5432/lexia_db_abc123
6. Change Password
To change the database password:
lexia db password
You'll be prompted to select the database and enter a new password. The connection string will be updated automatically.
Alternatively, you can specify the database and new password directly:
lexia db password --database <database-name> --new-password <new-password>
7. Connect to Database
Once you have the connection details from lexia db create, you can connect to your database in several ways:
Using Environment Variables
Add the connection string to your environment:
export LEXIA_DB_URL="postgresql://lexia_user:[email protected]:5432/lexia_db_abc123"
Using Connection String Directly
Python example:
import psycopg2
conn = psycopg2.connect(
host="db.lexiaplatform.com",
database="lexia_db_abc123",
user="lexia_user",
password="your_password",
port=5432
)
Node.js example:
const { Client } = require('pg');
const client = new Client({
host: 'db.lexiaplatform.com',
database: 'lexia_db_abc123',
user: 'lexia_user',
password: 'your_password',
port: 5432
});
client.connect();
Using SDK Configuration
Python:
from lexia import lexia
lexia.config(database_url="postgresql://lexia_user:[email protected]:5432/lexia_db_abc123")
Node.js:
const lexia = require('@lexia/sdk');
lexia.config({
databaseUrl: "postgresql://lexia_user:[email protected]:5432/lexia_db_abc123"
});
8. Delete Database
To delete a database:
lexia db delete
You'll be prompted to select the database to delete. Confirm the deletion when prompted.
Warning: This action cannot be undone. All data in the database will be permanently lost.
Alternatively, you can specify the database name directly:
lexia db delete --database <database-name>