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
- Navigate to SQL
- Write your query
- Click Execute or press Ctrl+Enter
- View results
Allowed Operations
| Operation | Allowed |
|---|---|
| SELECT | Yes |
| INSERT | Yes |
| UPDATE | Yes |
| DELETE | Yes |
| PRAGMA | Yes (read-only) |
| EXPLAIN | Yes |
| CREATE | No |
| DROP | No |
| ALTER | No |
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 10Count 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 DESCBest Practices
1. Use Indexes
Query on indexed columns for performance.
2. Limit Results
Always use LIMIT for large tables:
sql
SELECT * FROM logs LIMIT 1003. Select Needed Columns
sql
-- Good
SELECT name, email FROM contacts
-- Avoid
SELECT * FROM contactsAPI Reference
See SQL API for complete endpoint documentation.