We need to query Laminar traces/spans via SQL from...
# questions
c
We need to query Laminar traces/spans via SQL from scripts (not the UI). What works: browser session cookie →
POST /api/projects/{project_id}/sql
→ 200 What doesn’t: • `Authorization: Bearer <project API key>`on that route → 401 • `POST /v1/sql/query`on the public base URL → 404 (HTML) Laminar docs say SQL should work with the project API key on
/v1/sql/query
. On our self hosted deployment, only the browser cookie works. 1. Is there an app-server URL where Bearer +`/v1/sql/query`works? 2. Should the project API key work on the public URL, or is cookie auth expected? 3. What’s the recommended way to automate read-only SQL access?
l
Hey @millions-crayon-32880 maybe you could take a look?
👀 1
m
@clever-window-69122 good questions, let me answer: 1. For the public laminar cloud this should work:
Copy code
curl <https://api.lmnr.ai/v1/sql/query> \
  -H "Authorization: Bearer $LMNR_PROJECT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"SELECT * FROM traces ORDER BY start_time DESC LIMIT 10"}'
notice that for the laminar cloud it is
<http://api.lmnr.ai|api.lmnr.ai>
likewise it should be your api endpoint if you are using self hosted. 2. I don't think the cookie auth is expected. 3. For now the expected read-only access is through
lmnr-cli
laminar.sh/docs/platform/cli
Copy code
lmnr-cli login

lmnr-cli sql query "SELECT * FROM traces ORDER BY start_time DESC LIMIT 1"
for self-hosted you should add before
Copy code
export LMNR_FRONTEND_URL=<https://example.com>   
export LMNR_BASE_URL=<https://api.example.com>  
export LMNR_HTTP_PORT=8000
Please let me know if you are able to run sql queries through
<http://api.lmnr.ai|api.lmnr.ai>
or
lmnr-cli
c
Hi @millions-crayon-32880; quick follow-up on our self-hosted instance .
lmnr-cli login
works, but
lmnr-cli sql query
fails because the app-server isn’t exposed publicly: we get connection timeouts from outside the cluster. The frontend is reachable and the SQL editor works in the browser at
/project/{id}/sql
. Since we can’t reach the app-server API directly, how should we use the project API key for programmatic read-only SQL? Should we hit a frontend endpoint, or is there another supported path when the app-server is internal-only?
m
@clever-window-69122 I see, is there a reason while you are exposing the the frontend publicly but not the api endpoint?
➕ 1
m
Laminar's general recommendation is to expose the app-server publicly, but only for the paths prefixed with
/v1
using some kind of a reverse proxy / ingress
c
Thanks @millions-crayon-32880 @melodic-furniture-87909 — we’ll ask to expose
/v1/*
on ingress and retry CLI/API access then. One more question: does Laminar have a built-in way to inspect workspace/code artifacts from the OpenHands VS Code sandbox (files under
/workspace/project/
), or is the supported model only what appears in tool/terminal spans (and browser replay for browser-use)? We’re trying to understand if there’s an official artifact/workspace view beyond parsing span I/O.
m
not at the moment. We only track span and tools inputs and outputs. Would you like to be able to quickly navigate the workspace from the trace view?