Skip to content

SQL Interface

Query your agent's database directly with the SQL editor.

Overview

Features:

  • Monaco editor with SQL syntax highlighting
  • Schema browser
  • Query execution with timing
  • Result display and export

Using the Editor

Via Dashboard

  1. Navigate to SQL
  2. Write your query
  3. Click Execute or press Ctrl+Enter
  4. View results

Allowed Operations

OperationAllowed
SELECTYes
INSERTYes
UPDATEYes
DELETEYes
PRAGMAYes (read-only)
EXPLAINYes
CREATENo
DROPNo
ALTERNo

Schema Browser

View database structure:

  • Tables
  • Columns
  • Types
  • Indexes

Query Examples

List Workflows

sql
SELECT id, name, status, created_at
FROM workflows
WHERE agent_id = 'current-agent'
ORDER BY created_at DESC
LIMIT 10

Count Contacts

sql
SELECT COUNT(*) as total
FROM contacts
WHERE agent_id = 'current-agent'

Search Messages

sql
SELECT content, created_at
FROM chat_messages
WHERE content LIKE '%keyword%'
ORDER BY created_at DESC

Best Practices

1. Use Indexes

Query on indexed columns for performance.

2. Limit Results

Always use LIMIT for large tables:

sql
SELECT * FROM logs LIMIT 100

3. Select Needed Columns

sql
-- Good
SELECT name, email FROM contacts

-- Avoid
SELECT * FROM contacts

API Reference

See SQL API for complete endpoint documentation.

Released under the MIT License.