A pattern for an agent that answers business questions over your database: BrainBox supplies the schema, metric definitions and rules over MCP; your agent writes and runs the SQL on its own connection. BrainBox does not run SQL.
Updated
An analytics agent needs two things: to know what your data means, and to run queries. BrainBox does the first. BrainBox does not run SQL. Your agent keeps its own database connection, with the permissions you choose, and executes the queries it writes.
This split keeps database credentials and query results on your side: the CLI and SDK connect to your database locally and upload schema metadata, not credentials or results. Opt-in column profiling (`--profile-data`) also uploads statistics derived from rows, such as enum values; leave it off if that is not acceptable for your data.
A cross-table definition such as net revenue (items minus refunds) can be saved as structured data: see Metric definitions agents can query for the call. BrainBox stores the SQL and returns it; your agent runs it.
Per question, the agent works in this order:
In TypeScript, `brain.recall.asTools()` and `brain.update.asTools()` from the SDK give your model those tools directly. The TypeScript agent walkthrough shows the loop end to end, and the MCP endpoints work with any client.
Ingest the database and your SQL and docs, stopping before publish so you can review what ingestion proposes:
npx -y @brainbox-labs/cli@latest ingest postgres://user@host/db ./sql ./docs --reviewThen keep the definitions file in step with the Brain from CI:
npx -y @brainbox-labs/cli@latest sync ./docs/metrics --namespace defsRe-run `ingest` after schema migrations. BrainBox does not watch your database for drift on its own.
Building an analytics agent? Talk to us, or see Data agents and text-to-SQL.
Grounded answers, not guesses — from a living model of your business.