Skip to main content
Run SQL queries against Braintrust. In a terminal, bt sql opens an interactive editor with query history. Pass a query directly or pipe from stdin for scripting.
bt sql                                                          # Interactive terminal UI editor
bt sql "SELECT * FROM project_logs('my-project') LIMIT 10"      # Inline query
cat query.sql | bt sql                                          # Pipe from file
bt sql --non-interactive "SELECT count(*) FROM project_logs('my-project')"

Interactive controls

KeyAction
/ Navigate query history
EnterExecute query
Ctrl+cClear input
Ctrl+lClear output
Ctrl+d / EscExit

Query syntax

  • A FROM clause is required (project_logs(...), experiment(...), dataset(...))
  • Prefer filtering with WHERE; use HAVING only after aggregation
  • Joins, subqueries, unions, and window functions are not supported
  • Use explicit column aliases and type casts for clarity
  • Paginate large results with OFFSET '<cursor_token>'