← Back to Blog

How to Run an AI SQL Database Agent with OE Runtime

Query your PostgreSQL database in plain English. OE Runtime connects directly to your database, explores the schema, runs safe SELECT queries, and explains the results in plain language — no SQL knowledge required.

🗃
Step 1
Explore Schema
List all tables, fetch column names and data types, and count rows in each table.
Step 2
Analyze Key Data
Fetch recent rows, group by status/category columns, and identify NULL value counts.
Step 3
Report
Produce a plain-English database summary with schema, sample data, quality observations, and suggested queries.

What You Need


Create the Project Folder

Create a folder called sql-databases/ and add these two files:

sql-databases/
├── SKILL.md         # the portable skill (agentskills.io)
├── agent.yaml       # wires SKILL.md to your connector
└── oe-config.json  # LLM key + connector credentials

The Skill Files

Create SKILL.md inside a sql-databases/ directory. This is the portable skill — it follows the agentskills.io format and runs unchanged on Claude, Cursor, Windsurf, or OE Runtime:

---
name: sql-databases
description: Query a SQL database and summarize results in plain English
license: Apache-2.0
metadata:
  author: Open Enthrium
  version: "1.0"
---

You are a database analyst with read access to a SQL database.
Run SELECT queries to explore the schema and answer data questions.
Always explain results clearly in plain English.
Do not run INSERT, UPDATE, DELETE, or DROP statements.
Complete all steps fully before writing your report.

## Step 1: Explore Schema
Run the following queries one at a time:
1. List all tables in the database
2. For each table, fetch the column names and data types
3. Count the rows in each table

## Step 2: Analyze Key Data
From the largest table found:
- Fetch the 5 most recently created rows (use created_at or id DESC if available)
- Calculate row counts grouped by any status or category column if one exists
- Identify any columns with NULL values and count how many rows are affected

## Step 3: Report
Produce a database summary in plain English:
- Tables found and their row counts
- Schema of the largest table (column names and types)
- Sample of 5 recent records
- Data quality observations (nulls, unexpected values)
- Suggested queries for further analysis

Create agent.yaml in the same directory to wire the skill to your connector:

name: Database Analyst
description: Query a SQL database and summarize results in plain English
connectors:
  - connection_name: My Database
    connection_type: postgresql
skills:
  - path: ./
    trigger_type: auto

The Config File

Create oe-config.json in the same directory:

{
  "llm": {
    "provider": "openai",
    "model": "gpt-4o",
    "apiKey": "YOUR_OPENAI_API_KEY"
  },
  "server": {
    "enabled": false,
    "port": 3333,
    "apiKey": "your-secret-api-key"
  },
  "connectors": [
    {
      "connection_name": "My Database",
      "connection_type": "postgresql",
      "host": "localhost",
      "port": 5432,
      "database": "mydb",
      "user": "postgres",
      "password": "YOUR_DB_PASSWORD"
    }
  ]
}

Replace host, database, user, and password with your PostgreSQL connection details. For cloud databases like Supabase, Neon, or RDS, use the provided connection string values. Always use a read-only database user when running analytical queries.

Download OE Runtime

OE Runtime — Direct Downloads

Run the Agent

From the parent folder containing your skill directory:

MethodBest forDownload
1 npx recommended No install needed — always runs the latest version —
2 Windows .exe Download once, run offline on Windows ⊞ Windows (.exe)
3 macOS binary Download once, run offline on Mac  macOS
4 Linux binary Server deployments, cron jobs, Docker 🐧 Linux
5 API Server integration Call from any app, webhook, or automation pipeline 📮 Postman Collection

1 npx recommended

npx -y @openenthrium/oe-runtime@latest ./sql-databases

2 Windows

oe-runtime-win.exe ./sql-databases

3 macOS

chmod +x oe-runtime-macos
./oe-runtime-macos ./sql-databases

First run blocked? System Settings → Privacy & Security → Allow Anyway.

4 Linux

chmod +x oe-runtime-linux
./oe-runtime-linux ./sql-databases

5 API Server integration

Add a "server" block to oe-config.json, then start with --serve:

{
  "llm": { ... },
  "server": { "enabled": true, "port": 3333, "apiKey": "your-secret-key" },
  "connectors": [ ... ]
}
npx -y @openenthrium/oe-runtime@latest --serve --config oe-config.json

Run with inline YAML:

curl -X POST http://localhost:3333/run \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-secret-key" \
  -d '{"yaml": "...", "params": {}}'

Or run from a file on the server:

curl -X POST http://localhost:3333/run-file \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-secret-key" \
  -d '{"file": "/path/to/agent.yaml", "params": {}}'

Use Cases

Build your own agents with OE Runtime

Download OE Runtime and run any AI agent locally or as a server — no cloud required.

Get OE Runtime →
Series OE Runtime Agent Guides — 21 Connectors
Series overview →