Appearance
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
The execute_sql tool
The agent's own execute_sql tool is narrower than the editor: read-only, one statement, and tenant-scoped. Only an allowlist of tables with an agent_id column can be named (contacts, conversations, chat_messages, calendar_tasks, schedules, transactions, workflows, agent_tasks, turn_traces, jev_decisions, data_sources, media, skills, token_usage, …), and every referenced table is shadowed by a CTE filtered to the agent, so a query cannot read another agent's rows however it is written. Platform tables (agents, tenants, keys, sessions) are not reachable from it; schema-qualified names and multiple statements are rejected.
Allowed Operations (dashboard editor)
| 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.
