In production
Intelligence Center
An AI analyst that answers questions about an organisation's own data. It can read anything, but nothing changes until the user says so.
- Cost per answer
- After12% lower

Short version
GAIA's insight cards could tell an organisation that an opportunity was at risk, but not why. I built Intelligence, an AI analyst you ask about your own records. It reads through one SQL tool over a copy of your organisation's data. It answers sales questions and generates spreadsheets, tables, graphs and reports. I got the first words of an answer from 27.3 seconds to 12.9.
Problem
The question was what AI could do with the data an organisation already keeps in GAIA: its partners, opportunities and activities. Insight cards on the dashboard were the first answer. They flag what needs attention.
A card can say an opportunity is at risk. It can’t say why, which other records are involved or what to do about it. Intelligence was built to answer that. You open it from the card, or from a record’s own page, and ask in plain words.
I wrote the brief, and in it I named answer quality as the biggest risk. An answer about someone’s pipeline that is wrong but sounds sure is worse than no answer at all.
Constraints
- Every figure in an answer traces back to a query the answer actually ran. If the data can’t support an answer, it says so.
- No question can reach another organisation’s data, however it’s worded. That has to hold even when the model is fooled.
- I had two and a half to three weeks, and model calls had to stay in an EU region.
Approach
You ask from the Intelligence page, from “Ask why” on an insight card, or from a panel on any record’s page.

Each organisation gets its own snapshot, a DuckDB file that holds only the rows that organisation can see. It rebuilds when their records change. The model gets one tool, a read-only SQL query against that file, plus a catalogue of the tables with example queries. Figures in chat use the same definitions as the insight cards, so the numbers match.
The model never states a fact about a record itself. It names record ids, and code looks the facts up in the snapshot to fill the list of sources beside the answer. Charts work the same way. The model picks a query result and the columns, and never types a number into a chart.

Every conversation is traced in Langfuse, from the question through each tool call to the final answer. When a user gives a thumbs-up or flags an answer, it lands as a score on the exact model call that wrote it, along with their comment. That’s where I found the failures further down.
Decisions
One SQL tool instead of five hand-built ones
- Ruled out
- Five curated query tools
- Went with
- One read-only SQL tool over a per-organisation snapshot
My own brief said no free-form SQL, ever. The first version had five curated tools, each a query I had written, with the organisation bound in so the model could never name another one. It was safe, and it could answer five shapes of question. Every new question needed a new tool. Two weeks in I deleted all five. Safety used to rest on the model not writing SQL. Now it rests on the file it queries, which holds one organisation’s rows and nothing else. A guard still allows one SELECT and nothing more. The agent can now answer questions nobody wrote a tool for. The price is that a bug in building the snapshot is now the worst kind of bug this feature can have.
One streamed pass instead of two
- Ruled out
- Gemini Pro drafts, Flash reformats into blocks
- Went with
- One streamed pass, parsed in code
The first version took 27.3 seconds to answer, and you saw nothing until the end. A second model call reformatted prose the first had already written. It took 7 to 13 seconds and added nothing. The first model also spent around 900 reasoning tokens a turn deciding which tool to call. The draft format was already strict, so I parse it in code, stream it as it’s written and cap the reasoning. The first words now arrive at 12.9 seconds, and each answer costs about 12% less. I also measured the cheaper Gemini Flash on this path and rejected it. It pulled from one tool where Pro used three, leaked raw column values into the prose and added up figures no tool had returned.
12.9 seconds is still slow. The difference is that the answer now appears as it’s written, where before you saw nothing for 27 seconds.
The model drafts, the user creates
- Ruled out
- Create the activity when the user says yes in chat
- Went with
- Draft a card, and only the user's click creates it
In September users asked to log activities by describing them. Creating the record when someone types “yes” would have been less work. But a “yes” in chat is weak permission for a write, and the details can drift between the offer and the call. So the model drafts a card. The click goes to a route that re-reads the stored draft, checks every id and the user’s access again, and calls the same service as the normal form. Audit, notifications and the timeline entry happen once, in the usual place. The worst a prompt injection can do is put a visible card in front of someone.

When it broke
On 24 August I read a trace that should never have reached anyone. The question was “what do I need to do?” The model ran no query at all. It wrote the answer from the context it was opened with and invented two opportunities, with real-looking ids and $480,000 of value between them. When asked whether it had made them up, it queried the wrong column, found nothing, apologised and said a partner had no open opportunities. That partner had two.
Two things had to go wrong at once for that answer to get through.
- The model could answer without querying. Now its first step has to call a tool. I had also cut reasoning too far in the latency work. 512 tokens left no room to plan a query, so the cap went up to 2,048.
- The code already knew those records didn’t exist. The lookup that fills the sources list couldn’t find them, marked them unverified and let the prose keep the figures. Now an answer that names an id the snapshot can’t find gets sent back. The model gets one retry that names the missing ids, and after that the answer becomes a refusal.
The same day, “which open task is assigned to me?” came back as “could you tell me your full name?” The panel had the user’s session the whole time and never told the model who was asking. Now it does.
On 22 October the flags came off and every organisation got Intelligence.
Next
Users check the answers. Nothing else does yet. Thumbs and flags land in Langfuse, but no test scores an answer before a prompt or model change ships. The first thing I’d build is a fixed set of questions with checked answers, plus injection tests, run on every change. After that I’d make files clickable. The agent can quote a PDF attached to an opportunity, but the user can’t open it from the answer.