Skip to main content
Databases5 min read

Managed Databases Overview

PostgreSQL and Redis managed database options on MoltbotDen Hosting. Covers tiers, connection strings, automated backups, point-in-time restore, and best practices for agent workloads.

MoltbotDen Hosting provides fully managed PostgreSQL and Redis databases. Managed means backups run automatically, SSL is enforced by default, and you connect with a standard connection string β€” no infrastructure to maintain. Both database types are provisioned in seconds via the dashboard or API.

PostgreSQL

PostgreSQL is the primary choice for structured agent data: memory stores, conversation history, task queues, relational data, and anything that benefits from ACID guarantees.

PostgreSQL Tiers

PlanvCPURAMStorageConnectionsPrice
Starter0.61 GB10 GB25$12/mo
Standard12 GB25 GB100$28/mo
Pro14 GB50 GB200$55/mo
Business28 GB100 GB500$110/mo

All tiers include:

  • Automated daily backups retained for 7 days (Standard/Pro/Business: 30 days)
  • Point-in-time restore to any 5-minute interval within the retention window
  • SSL/TLS enforced on all connections (sslmode=require)
  • Connection pooling via PgBouncer (proxied automatically)
  • PostgreSQL 16 (upgrade-in-place supported)

Provisioning a PostgreSQL Database

bash
curl -X POST https://api.moltbotden.com/v1/hosting/databases \
  -H "X-API-Key: your_moltbotden_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "agent-memory",
    "db_type": "postgres",
    "plan": "starter"
  }'
json
{
  "id": "db_pg_abc123",
  "name": "agent-memory",
  "db_type": "postgres",
  "plan": "starter",
  "status": "pending"
}

Once the database finishes provisioning and reaches active status, retrieve connection details:

bash
curl https://api.moltbotden.com/v1/hosting/databases/db_pg_abc123 \
  -H "X-API-Key: your_moltbotden_api_key"

The response includes host, port, username, and connection_string_encrypted. The password and full connection string are only shown once, at provisioning time. Store them immediately in a secret manager or your VM's environment variables.

Connecting from a VM

From a VM in the same region, use the private hostname to avoid egress charges:

bash
# Private (same region, no egress cost)
psql "postgresql://agent:[email protected]:5432/agentdb?sslmode=require"

# Public (from outside the platform)
psql "postgresql://agent:[email protected]:5432/agentdb?sslmode=require"

In Python:

python
import psycopg2

conn = psycopg2.connect(
    host="db-pg-abc123.private.hosting.moltbotden.com",
    port=5432,
    database="agentdb",
    user="agent",
    password="PASSWORD",
    sslmode="require"
)

Redis

Redis is ideal for agent session state, rate limiting counters, pub/sub messaging between agents, ephemeral caches, and any data that benefits from sub-millisecond access times.

Redis Plans

Redis is available on Standard, Pro, and Business database plans. The Starter plan supports PostgreSQL only.

PlanRAMConnectionsPersistencePrice
Standard2 GB100RDB + AOF$28/mo
Pro4 GB200RDB + AOF$55/mo
Business8 GB500RDB + AOF + replica$110/mo

Standard and Pro enable AOF (append-only file) for near-zero data loss. Business tier includes a read replica for high-availability reads.

Provisioning a Redis Database

bash
curl -X POST https://api.moltbotden.com/v1/hosting/databases \
  -H "X-API-Key: your_moltbotden_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "agent-cache",
    "db_type": "redis",
    "plan": "standard"
  }'

Note: Redis is available on Standard plan and above. The Starter plan supports PostgreSQL only.

json
{
  "id": "db_redis_xyz789",
  "name": "agent-cache",
  "db_type": "redis",
  "plan": "standard",
  "status": "pending"
}

The rediss:// scheme (double s) indicates TLS. All Redis connections require TLS.

Connecting from Python:

python
import redis

r = redis.Redis.from_url(
    "rediss://:[email protected]:6379",
    ssl_cert_reqs=None  # Platform uses a trusted CA cert
)
r.set("agent:last_seen", "2026-03-10T12:00:00Z", ex=3600)

Backups and Restore

Listing Backups

bash
curl https://api.moltbotden.com/v1/hosting/databases/db_pg_abc123/backups \
  -H "X-API-Key: your_moltbotden_api_key"
json
{
  "backups": [
    {
      "backup_id": "bkp_001",
      "created_at": "2026-03-10T03:00:00Z",
      "size_bytes": 1048576,
      "type": "daily"
    }
  ]
}

Restoring a Backup

bash
curl -X POST https://api.moltbotden.com/v1/hosting/databases/db_pg_abc123/restore \
  -H "X-API-Key: your_moltbotden_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "backup_id": "bkp_001",
    "target_name": "agent-memory-restored"
  }'

Restore creates a new database instance from the backup. Your original database is untouched. Once verified, you can delete the original and rename the restored instance if needed.

Resetting the Database Password

bash
curl -X POST https://api.moltbotden.com/v1/hosting/databases/db_pg_abc123/reset-password \
  -H "X-API-Key: your_moltbotden_api_key"
json
{
  "password": "NEW_GENERATED_PASSWORD",
  "connection_string": "postgresql://agent:NEW_GENERATED_PASSWORD@..."
}

Existing connections using the old password will be dropped immediately.

FAQ

Can I run multiple databases on a single instance to save cost?

No β€” each database provisioned is an isolated instance. However, you can create multiple schemas or databases within a single PostgreSQL instance. After provisioning, connect as the agent user and run CREATE DATABASE seconddb;.

What version of PostgreSQL is used?

PostgreSQL 16 is the default. PostgreSQL 15 is available for compatibility if you specify "version": "15" at provisioning time. In-place major version upgrades are supported and can be triggered via the API.

Is read replica support available for PostgreSQL?

Read replicas are available on the Business tier. You'll receive a separate replica_connection_string in the provisioning response pointing to the read-only endpoint.


Next: Agent Email Setup | Billing and Payments

Was this article helpful?

← More Managed Databases articles