Building Production Text-to-SQL for 70,000+ Tables: OpenAI’s Data Agent Architecture
Last Updated on February 3, 2026 by Editorial Team
Author(s): MKWriteshere
Originally published on Towards AI.
How OpenAI handles 600PB of data with self-correcting agents, six context layers, and closed-loop validation — a technical guide you can replicate
It’s 4:55pm.

The article discusses OpenAI’s architecture for its internal data agent designed to handle complex SQL queries over large datasets (600PB across 70,000 tables). It highlights the importance of combining text-to-SQL capabilities with deep context and self-correction mechanisms to improve accuracy. Key elements include managing institutional knowledge, human annotations, and ensuring security through pass-through permissions. OpenAI emphasizes that building trust in the system requires a thoughtful design that continually evaluates its own outputs against established metrics and patterns.
Read the full blog for free on Medium.
Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.
Published via Towards AI
Towards AI Academy
We Build Enterprise-Grade AI. We'll Teach You to Master It Too.
15 engineers. 100,000+ students. Towards AI Academy teaches what actually survives production.
Start free — no commitment:
→ 6-Day Agentic AI Engineering Email Guide — one practical lesson per day
→ Agents Architecture Cheatsheet — 3 years of architecture decisions in 6 pages
Our courses:
→ AI Engineering Certification — 90+ lessons from project selection to deployed product. The most comprehensive practical LLM course out there.
→ Agent Engineering Course — Hands on with production agent architectures, memory, routing, and eval frameworks — built from real enterprise engagements.
→ AI for Work — Understand, evaluate, and apply AI for complex work tasks.
Note: Article content contains the views of the contributing authors and not Towards AI.