Building a Production Data Agent for 90,000 Tables at Scale

ByteByteGo3 Jun 2026

Problem

OpenAI's data platform holds 1.5 exabytes in 90,000 datasets and serves about 4,000 internal users (May 2026). At this size the hard part is finding the right table and knowing how to use it, not writing SQL. Many tables look alike but mean different things, and analysts spend hours on grain and joins before writing code.

Example from the article: two tables both have a user_id column and look almost identical, but one includes logged-out users and the other does not. From the schema alone the model cannot tell which one answers the question.

Solution in brief

The agent is plain: one LLM (GPT-5.5), a runtime loop and 13 tools. Reliability comes from six context layers prepared before a question arrives. The first three are merged daily into one embedded description per table. Trusted past queries, few tools and goal-level prompts keep the model on track.

Questions this case answers
  • How to make an LLM pick the correct table and grain when thousands of tables share similar columns and the schema alone does not tell them apart
  • How to select which historical queries to retrieve as examples when most of them are one-off exploratory work
  • How to keep a tool-using agent reliable when many connected tools return overlapping answers
  • How to make a data agent find the right tables among tens of thousands of similar-looking ones?

Tools and methods

  • OpenAI Codex — nightly job that reads pipeline code and documents each table
  • OpenAI Embeddings — one vector per table description, and the same model for the question
  • Hybrid search — vector search plus exact text matching over table descriptions
  • Context engineering — six context layers assembled per question
  • Model Context Protocol (MCP) — entry point to the agent from the Codex CLI
  • Apache Airflow, Apache Spark — queried at runtime when offline context is missing or stale
Continue reading — it's free

Google or a one-time email code. No password.