ONE When your AI is wrong, does your database tell you? - ONE Blog
• Anthony O'Connell

When your AI is wrong, does your database tell you?

AI agents now ask your database the questions your business runs on. Some databases say so when the question is wrong. Most hand back a number that looks right. Why we built ONE on TypeDB.

typedb typeql ai agents databases leadership

You ask your AI a simple question. How many customers renewed last quarter?

It says 412.

The real answer is 588. Nothing crashed. No warning appeared. The number looked like every other number on the dashboard, so it went into the board deck.

This is the failure that matters now. Not the AI that breaks. The AI that is wrong and sounds right.

Your AI is writing database queries

When you ask an agent about your business, it does not know the answer. It writes a query, a short instruction to your database, and reads back what comes out.

When that query is wrong, one of two things happens.

The database refuses it and says why. The agent reads the reason, fixes the query and tries again. You get the right answer a second later.

Or the database runs it anyway, and hands back a wrong answer that looks exactly like a right one. Nobody knows. Nothing can be fixed, because nothing knows it is broken.

The first is a typo. The second is a lie in your numbers.

The numbers

TypeDB, the company behind the database we use, tested this in September. They asked Claude Sonnet 5 the same 42 questions against the same real dataset stored three ways: in MySQL (SQL), in Neo4j (Cypher) and in TypeDB (TypeQL). They ran every question three times and checked every answer.

It is their benchmark, so read it with that in mind. They published the method and the weak spots with it.

On the first try:

                       SQL    Cypher   TypeQL
right                  82%     74%      75%
wrong, and said so      1%     10%      23%
wrong, said nothing    17%     15%       2%

SQL looks like the winner. Look at the bottom row. When SQL was wrong, it was silently wrong almost every time: 20 of its 21 mistakes came back as a believable number, usually too low.

Now let the agent see its errors and try again, up to four times:

                       SQL    Cypher   TypeQL
right                  83%     82%      92%
wrong, said nothing    17%     16%       5%

SQL barely moved, because there was almost nothing to fix. Its wrong answers never said they were wrong. TypeQL went from 75% to 92%, the best result in the whole test, because nearly every mistake announced itself.

One wrong answer in six, delivered with confidence, is not a database you hand to an agent.

Why TypeDB can say no

Most databases store data. TypeDB stores data and a description of your business.

You write down, once, what exists and how it connects. A customer is a person or a company. A person can be employed by a company. A loan has a lender and a borrower, and only an organisation can be the lender.

From then on the database checks everything against that description. Try to record a person as the lender on a loan and it refuses: a person cannot play that role. Ask a question that does not fit how your business works and you get an error with a reason, not an empty table.

That is the whole trick. An empty answer from TypeDB means there really is nothing there. An empty answer from most databases might mean that, or might mean the question was wrong.

Why TypeQL suits your business

TypeQL is the language you use to talk to TypeDB. Four things about it matter to someone running a company.

It reads close to how you talk. This asks for everyone employed by Acme:

match
  $c isa company, has name "Acme";
  employment (employer: $c, employee: $p);

A company, an employment, an employer and an employee. Your operations lead can read that.

One fact can have many sides. A sale has a buyer, a seller, a product and often an agent who made the introduction. In most databases that one fact is split across four tables and joined back together every time someone asks. In TypeDB it is one fact with four parties, the way it actually happened.

New kinds of things do not break old questions. Add contractors as a kind of person next year, and every question about people already includes them. Nobody rewrites the reports.

Rules live in one place. “Who can approve a payment over $50?” is written into the database once. Your app, your dashboard and every agent get the same answer, because there is only one place the answer can come from.

What it did for us

ONE runs on TypeDB. It is where people and AI agents work together: shared groups, shared tasks, shared wallets. Every action is a record in one database.

Six months in, the whole business fits in 32 types and 20 kinds of thing. When we added a task factory, a router and a reasoning layer, we added questions, not structure: 97 new questions and not one new type.

And it caught us. In July our own notes said three new parts of the design had been checked and loaded. They had not. TypeDB had refused them, with the exact reason, and loaded nothing half-finished. Our documents were wrong. The database was right.

What it costs

It is not free, and you should know where it hurts.

AI models know less TypeQL than SQL. With no examples in front of it, Claude wrote correct TypeQL a quarter of the time, and DeepSeek never did. You fix that by giving your agents a guide, worked examples and room to retry, and then they beat SQL. But you have to do it.

Fewer engineers know it. Hiring for SQL is easy. For TypeQL, you train.

It does not catch everything. 2% of answers were still silently wrong. A query can be perfectly valid and answer a slightly different question than the one you asked. A strict description of your business rules out whole kinds of mistakes, not all of them.

The question to ask

More of your company’s questions go through an agent every month. Most leaders still choose a database by speed and price.

Ask a different question first. When the AI gets it wrong, will anyone find out?

With TypeDB, the database does.

The deep dive: The part of AI that never guesses. We build ONE on TypeDB. See it at one.ie. The benchmark: typedb.com.