Skip to content
baachee

Baachee platform · Production-ready agents

A data agent that answers in plain language and shows its SQL

Text2Report turns questions in English, Dutch or Turkish into SELECT-only SQL, runs it on PostgreSQL or BigQuery, and returns the table with an audit trail. It learns your schema, patterns and rules as it goes.

Client
Text2Report
Industry
Data and analytics
Region
Netherlands
Period
Deployed 2026
accuracy after learning
92%
context layers
6
self-correction retries
3
languages: EN, NL, TR
3

Challenge

  • Every ad-hoc question queues up behind the one person who writes SQL.
  • Operational data sits in PostgreSQL and marketing data in BigQuery, so answers need both.
  • General-purpose models invent metric definitions unless the organisation's own rules are in the context.

Approach

  1. 01Connect a database; tables, columns and row counts sync automatically from information_schema.
  2. 02Six context layers ground every answer: schema context, human annotations, validated query patterns, business rules, self-learned corrections and MCP tool access.
  3. 03Generated SQL is enforced as SELECT-only before it runs, and PostgreSQL and BigQuery can be queried in one conversation.
  4. 04When a query fails, the agent diagnoses and retries up to three times, then stores the error-fix pair so that class of error does not repeat.

Architecture

  1. 01 · Ask

    • Question in EN, NL or TR
  2. 02 · Context

    • Schema
    • Annotations
    • Patterns
    • Business rules
    • Learnings
  3. 03 · Agent

    • Gemini drafts SQL
    • SELECT-only check
  4. 04 · Execute

    • PostgreSQL
    • BigQuery
  5. 05 · Answer

    • Result table
    • SQL shown
    • Audit trail
Architecture: Ask (Question in EN, NL or TR), then Context (Schema, Annotations, Patterns, Business rules, Learnings), then Agent (Gemini drafts SQL, SELECT-only check), then Execute (PostgreSQL, BigQuery), then Answer (Result table, SQL shown, Audit trail).

In production

Query safety
SELECT-only enforcement before execution
Memory
per-tenant patterns, rules and learnings
Knowledge edits
admin token required in production
Deployment
separate app on text2report.baachee.ai
Setup
minutes, with schema auto-discovery

Results

MetricBeforeAfter
Accuracy on ad-hoc queries(after learning)—92%
Setup time(compared with legacy BI)weeks of data modellingminutes

Stack

  • Gemini
  • PostgreSQL
  • BigQuery
  • Model Context Protocol
  • Vercel AI SDK
  • Next.js

Source: Text2Report product documentation and the Baachee working paper “Context Engineering for Marketing Intelligence” (v0.2, May 2026).

Next step

Want this running on your data?

Next case studyFirst-party event tracking that strips personal data before it is stored