# Prism AI
> An agent inside the IDE that reads your open tab and your schema, dry-runs the SQL it writes, and edits the query in place, with your approval by default. It costs credits from your monthly allowance, or runs on a subscription you already have.
Source: https://docs.querylab.io/prism-ai/introduction/
**right panel**
**Prism**
Prism AI
Your SQL assistant for BigQuery
What can Prism do?
Optimize my query
Explain this query
Help me write a query
Plan, @ for context, / for commands Approve
auto
A fresh conversation. The four buttons are ready-made prompts; the input takes @ mentions and / commands.
## Opening it
`⌘`
`I` (`Ctrl`
`I` on Windows and Linux) toggles the panel, and so does the triangle
icon in the top bar. The panel header has **New conversation**, **Conversation
history**, **Settings**, and a credit counter such as `87/100`.
The header also shows the **attached tab**: the tab the agent reads from and writes to. It follows the active tab; click it to pin a different one.
- Signed in, or in the [Playground](https://docs.querylab.io/getting-started/playground/) (10 requests a day there)
- Settings → AI Features → **Enable Prism AI Features** is on (it is by default)
## What it can see
Nothing until you ask. Each message carries the mode, the attached tab, and whatever you attach with `@`:
| Mention | What goes to the model |
| ------------------------------------------------ | ------------------------------------------------------------ |
| `@project.dataset.table`, `@dataset`, `@project` | Schema metadata: columns, types, partitioning. No rows |
| `@graph` | A property graph's labels, properties, node and edge tables |
| `@Tab name` | That tab's SQL and its last job (bytes, cost, duration) |
| `@Tab name` under **Results** | The result's schema and row count; rows only if you allow it |
Beyond that the agent uses [tools](https://docs.querylab.io/prism-ai/features/) to look things up on its own: it can browse the schema, read tabs, validate SQL with a dry run, and read BigQuery's documentation; none of which needs confirmation. Anything that scans data or changes a tab is governed by the [mode](https://docs.querylab.io/prism-ai/modes/).
## What it can do
- Write a query from a description, or change the one in the attached tab, as a diff you apply or reject.
- Run `SELECT` queries and show the result in the chat. `INSERT`, `UPDATE`, `DELETE`, and DDL are rejected before they reach BigQuery.
- Explain, debug, and optimize: it validates its own SQL, sees the dry-run estimate, and knows about partition and cluster columns.
- Sample a table's data at no cost, draw a chart, create tabs and notebook cells, search your saved queries.
> **It can be wrong.** The agent dry-runs what it writes, so syntax errors are rare; wrong joins and wrong assumptions are not. Read the diff before you apply it.
## Where your data goes
Messages, attached SQL, and schema metadata are sent through Querylab.io's backend to the provider you chose. Conversations are saved so you can resume them.
Query **results** are the exception. By default the agent runs a query and sees only its schema and row count. The panel says _AI cannot see query results — only the schema is shared_ and offers **Share with AI** per result. Settings → AI Features → **Share Query Results Preview** has three values:
| Value | Behaviour |
| ----------------------- | -------------------------------------------------------------- |
| Disabled (never share) | Rows never leave the browser |
| Ask each time (default) | A **Share Query Results?** dialog, with **Remember my choice** |
| Always allow | Rows are shared without asking |
The same setting covers table samples.
On the desktop app you can bypass Querylab.io's backend entirely and run the agent through a CLI you already have installed, or on your own API key; see [CLI integration](https://docs.querylab.io/prism-ai/cli-integration/).
## Models and credits
The model dropdown next to the mode selector lists **Querylab.io Cloud** models and, on desktop, **Your Subscriptions**. **Auto** picks a model per message; its cost shows as _varies_. Every other model shows a multiplier (`1x`, `7x`), which is the credits one message costs. Every account gets a monthly credit allowance; the counter in the panel header and Settings → AI Features → **AI Providers** show what's left and when it resets.
The model is fixed for the length of a conversation. To change it, start a new one.