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

openai · Tech · 2026 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Enterprise data discovery and analytics agent at exabyte scale

OpenAI needed internal users to answer data questions across 90,000 datasets without spending hours discovering which tables were semantically correct, how they joined, or which caveats applied before writing SQL.

Constraints:

Architecture

OpenAI built a deliberately simple data agent around GPT-5.5, an agent runtime, a six-layer context assembly system, and a curated tool set. Offline pipelines merge table usage metadata, human annotations, and Codex-enriched pipeline-code descriptions into table descriptions that are embedded for retrieval. At runtime, a user question is embedded, matched against the table vector store with semantic and exact search, augmented with access-controlled institutional knowledge and memory, then sent through an agent loop that writes SQL, runs tools, observes results, corrects itself, and returns the answer, SQL, and referenced tables.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  user-entry-points[User entry points] --> agent-runtime[Agent runtime]
  agent-runtime --> gpt-5-5[GPT-5.5]
  agent-runtime --> context-assembly-layer[Context assembly layer]
  context-assembly-layer --> table-description-index[Table description index]
  table-description-index --> codex-enrichment-pipeline[Codex enrichment pipeline]
  context-assembly-layer --> institutional-knowledge-service[Institutional knowledge service]
  context-assembly-layer --> memory-store[Memory store]
  agent-runtime --> curated-tools[Curated tools]
  curated-tools --> warehouse-and-platform-systems[Warehouse and platform systems]
  context-assembly-layer --> warehouse-and-platform-systems
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
User entry points Slack, web portal, IDE, and Codex CLI/MCP surfaces where users ask data questions in natural language. Agent runtime
Agent runtime Harness that parses model outputs, dispatches tool calls, feeds results back, and manages the reason-act-observe loop. User entry points, GPT-5.5, Curated tools, Context assembly layer
GPT-5.5 Single foundation model used for every request to generate SQL, inspect results, correct queries, and reason to verified answers. Agent runtime
Context assembly layer Retrieval and context-building system that combines table descriptions, institutional knowledge, memory, and runtime context. Agent runtime, Table description index, Institutional knowledge service, Memory store, Warehouse and platform systems
Table description index Daily merged and embedded descriptions from table usage metadata, human annotations, and Codex enrichment. Context assembly layer, Codex enrichment pipeline
Codex enrichment pipeline Nightly code-reading pipeline that summarizes what each table contains, how it is derived, freshness, and when to use it. Table description index
Institutional knowledge service Access-controlled retrieval over Slack threads, Google Docs, Notion pages, and company context outside the warehouse. Context assembly layer
Memory store Global or personal corrections and learnings from prior conversations used to avoid repeated mistakes. Context assembly layer
Curated tools Thirteen non-overlapping tools for context lookup, internal knowledge, Airflow, Spark, metadata, and warehouse access. Agent runtime, Warehouse and platform systems
Warehouse and platform systems Data warehouse, metadata services, Airflow, Spark, and other platform systems queried for runtime facts and SQL execution. Curated tools, Context assembly layer

Data flow

A user asks in Slack, the web portal, an IDE, or Codex CLI through MCP. The question is embedded with the same model used for offline table descriptions, the context layer retrieves matching tables plus institutional knowledge and memory, the runtime sends that context to GPT-5.5, and the tool loop lets the agent write SQL, execute it, inspect results, retry, and return a verified answer with reasoning, SQL, and table references.

4 supporting quotes
“A user can ask in Slack, in a web portal, in their IDE, or in the Codex CLI through MCP. The agent figures out which tables are relevant, writes SQL, runs it, checks the result, and returns the answer with its reasoning attached.”article, stated
“The user’s question is converted into a vector using the same embedding model the team used to embed table descriptions offline.”article, stated
“The context assembly layer searches the vector store for the table descriptions that best match the question, combining semantic search with exact text matching.”article, stated
“The agent sends the assembled context to the LLM and puts it in a loop so it can write a SQL query, look at what comes back from the tool execution, and try again until the answer is correct.”article, stated

Why this architecture

OpenAI kept the agent itself simple because the failure mode was not lack of agent complexity; it was lack of the right semantic context. A single strong model, a runtime harness, curated tools, and carefully engineered context assembly were easier to operate than routers, fine-tunes, and overlapping retrieval systems, while the unified data platform made table meaning legible enough for the model to reason.

4 supporting quotes
“The team’s approach is the opposite of what most people expect. The agent itself is simple. The reliability comes from the engineering around it: careful data acquisition that gives the agent the right context before it ever sees a question.”article, stated
“The reliability comes from the engineering around it: careful data acquisition that gives the agent the right context before it ever sees a question.”article, stated
“The four components described above are the whole architecture of the data agent. There is no router, no fine-tuning, and no special post-training.”article, stated
“What makes the agent reliable is the quality of the context that flows through the three steps, which depends on the quality of the underlying infrastructure and how easy it is for the model to reason about.”article, stated

Models used: GPT-5.5 · OpenAI embedding model · Codex · Codex Skills

Scale

Alternatives considered (roads not taken)

Add routers, multiple LLMs, fine-tuning, and specialized retrieval stacks

Rejected because: Each extra moving part could add cost, latency, and failure modes, while OpenAI's unified data foundation let a simple single-model agent work.

“A team might add a router that sends easy questions to a small, cheap model and hard ones to a larger model. It might mix multiple LLMs, fine-tune models on internal data, or build complex retrieval pipelines with different embedding models for different content types.”article, stated
“It might mix multiple LLMs, fine-tune models on internal data, or build complex retrieval pipelines with different embedding models for different content types. Each choice can help, but each also adds cost, latency, and more ways for the system to fail.”article, stated

Expose about 40 metadata/orchestration/big-data tools

Rejected because: The model chose wrong tools and got conflicting overlapping answers, so OpenAI reduced the surface to around 13 non-overlapping tools.

“The team initially connected the agent to around 40 tools, including metadata systems, orchestration tools, and big data systems.”article, stated
“The results were bad. The model picked the wrong tool and got confused by overlapping answers from tools that did similar things.”article, stated

Embed all historical queries as context

Rejected because: Most company queries are exploratory one-offs, so OpenAI ranked query examples by trustworthiness instead of treating them equally.

“A natural first instinct for a data agent is to embed all historical queries and use them as context. OpenAI tried this approach, and it did not work.”article, stated
“Queries behind heavily used dashboards, usually written by data scientists, rank highest, because they tend to be correct and reused often.”article, stated

Use detailed step-by-step prescriptive prompts

Rejected because: The agent followed the instructions and produced worse answers; high-level goals plus good context worked better.

“Prescriptive prompts hurt the agent’s results. The team experimented with detailed step-by-step instructions about how the agent should approach each kind of question.”article, stated
“High-level guidance worked better. Tell the model what the goal is. Let it reason about how to get there. Give it the right context and the right tools, and trust the reasoning.”article, stated

Build a data agent before fixing the data foundation

Rejected because: If company data is scattered or inconsistent, no agent architecture can make it legible enough to answer reliably.

“A coding agent has one source of truth: the repository. A data agent’s source of truth is the whole company. Every system, every siloed data store, every team’s conventions, every table defined outside a unified codebase. If none of that is legible to a model, no agent architecture will save you.”article, stated
“If your team is considering building a data agent and your data is scattered or inconsistent, the agent is not the first investment. The foundation is.”article, stated

Patterns

rag-retrieval (context-assembly)

The agent retrieves table descriptions, institutional knowledge, memory, and runtime context before asking GPT-5.5 to answer.

“Building on these signals, the agent relies on six layers to assemble the right context when a user query arrives”article, stated
“Retrieval over the table descriptions identifies the relevant tables, and relevant memory is pulled in as additional context.”article, stated

tool-use-orchestration (agent-runtime)

The runtime turns GPT-5.5 into an action-capable agent by dispatching tool calls, feeding results back, and looping until the answer is correct.

“The runtime parses the model’s output, dispatches the requested calls to tools, feeds the results back into the model”article, stated
“The agent uses them to fetch the information it needs to answer a question and verify its work.”article, stated

agent-memory (context-assembly)

Corrections and learnings from previous conversations are stored globally or personally and applied to future retrieved context.

“Memory is the other source to assemble the context from. It holds corrections and learnings saved from past conversations”article, stated
“Corrections and learnings the agent has saved from prior conversations, scoped at global or personal level.”article, stated

retrieval-ranking (retrieval-quality)

Historical queries are ranked by trustworthiness so canonical dashboard queries influence the model more than one-off exploratory SQL.

“The team improved results by ranking past queries by how trustworthy they are.”article, stated
“Once the team ranked queries this way, the model started copying the good patterns instead of the bad ones.”article, stated

privacy-preserving-processing (access-control)

Institutional knowledge is retrieved through an access-controlled service so the agent does not expose documents the user cannot access.

“These documents are ingested and embedded separately, and served through an access-controlled retrieval service”article, stated
“so the agent never surfaces documents a user is not allowed to see.”article, stated

Tradeoffs

Keep the agent architecture simple

Chose single GPT-5.5 model, runtime, context layer, and curated tools over routers, multiple models, fine-tuning, and special post-training.

Rationale: The team reduced cost, latency, and operational failure modes because strong context infrastructure carried reliability.

“There is no router, no fine-tuning, and no special post-training. Every question goes to the same model.”article, stated
“Each choice can help, but each also adds cost, latency, and more ways for the system to fail.”article, stated

Invest in context assembly instead of agent cleverness

Chose six layers of curated context before model invocation over letting a bare schema and model reason alone.

Rationale: The model could not distinguish semantically similar tables from schema alone.

“This is where the real engineering work lives. A strong model still produces wrong answers without the right context.”article, stated
“two tables may both have a user_id column and look almost identical, yet one includes logged-out users and the other does not.”article, stated

Use a curated 13-tool surface

Chose right non-overlapping tools over every available metadata/orchestration/big-data tool.

Rationale: Reducing overlap prevented the model from picking near-duplicate tools and conflicting answers.

“The lesson is that an agent does not need access to every system in the company. It needs access to the right ones, with no two tools doing the same job.”article, stated
“The model is better at reasoning than at choosing between near-duplicate tools.”article, stated

Rank historical queries by trust

Chose dashboard and data-scientist-authored query examples ranked highest over embedding every historical query equally.

Rationale: The retrieval corpus needed to favor reusable correct patterns over exploratory one-offs.

“Queries from popular dashboards written by data scientists rank highest because they tend to be correct and reusable.”article, stated
“One-off, exploratory queries rank lower.”article, stated

Use high-level prompt guidance

Chose goal-oriented instructions with strong context and tools over detailed procedural prompting for each question type.

Rationale: Prescriptive prompting produced worse answers, while modern models planned better when given enough information.

“Prescriptive prompts hurt the agent’s results.”article, stated
“Tell the model what the goal is. Let it reason about how to get there. Give it the right context and the right tools”article, stated

Gotchas (what bit them)

SQL generation was not the hard part.

Root cause: At 90,000 datasets, users first had to find semantically correct tables, understand grain, joins, and caveats, and avoid lookalike tables.

Resolution: OpenAI invested in context assembly from metadata, human annotations, Codex enrichment, institutional knowledge, memory, and runtime context.

“At this scale, the hardest part of data analysis isn’t writing SQL. It’s finding the right tables to use in the first place”article, stated
“A bare schema is not enough to tell tables apart.”article, stated

Too many tools made the agent worse.

Root cause: Overlapping metadata, orchestration, and big-data tools returned similar/conflicting information that the model struggled to choose among.

Resolution: The team capped the tool surface at around 13 tools and removed overlapping tools.

“The results were bad. The model picked the wrong tool and got confused by overlapping answers from tools that did similar things.”article, stated
“Capping the agent at around 13 tools per call, and removing overlapping ones, fixed the problem.”article, stated

Historical query retrieval can teach bad habits.

Root cause: Most historical queries are exploratory one-offs rather than canonical examples of correct table usage.

Resolution: OpenAI ranked past queries by trustworthiness so heavily used dashboard queries had more influence.

“Most queries in any company are exploratory one-offs, not canonical examples of how a table should be used.”article, stated
“The agent learns from queries the company has already written, but not all of them are worth imitating.”article, stated

Overly prescriptive prompts degraded answer quality.

Root cause: Detailed step-by-step instructions constrained planning even when modern models had enough context to reason.

Resolution: The team shifted to high-level guidance and relied on context plus tools.

“The agent followed the instructions and produced worse answers. High-level guidance worked better.”article, stated
“Modern models are good at planning when they have good information. They are less good at being told what to plan.”article, stated

Agent reliability depended on unglamorous data-platform foundations.

Root cause: A data agent's source of truth spans the whole company, not just a repository, so inconsistent data stores and conventions would make context illegible.

Resolution: OpenAI relied on a unified data lake, monorepo-produced tables, conventions, duplicate-column policing, and table annotations.

“A data agent’s source of truth is the whole company. Every system, every siloed data store, every team’s conventions”article, stated
“Every table on the platform is produced by code in a single monorepo, and data engineering teams enforce conventions and police duplicate or unclear columns”article, stated

Evaluation

The article describes production validation through verified-answer behavior, SQL execution and correction loops, table/source transparency, context quality, tool-surface failures and fixes, query-ranking improvements, and operational outcomes from adjacent Codex workflows.

Metrics: answer returned with SQL and referenced tables · correctness after SQL execution and result inspection · tool confusion before and after reducing from around 40 to 13 tools · copying good query patterns after trust ranking · migration completion time · release-agent incident count · support fixes per engineer per day

4 supporting quotes
“the agent replies with its answer, the SQL it ran, and the tables it pulled from.”article, stated
“The agent figures out which tables are relevant, writes SQL, runs it, checks the result, and returns the answer with its reasoning attached.”article, stated
“Once the team ranked queries this way, the model started copying the good patterns instead of the bad ones.”article, stated
“The release agent has now been running end to end for three to four months without human involvement and without a single incident.”article, stated

Outcomes

OpenAI reports 1.5 exabytes, 90,000 datasets, about 4,000 data-platform users, 100-200-table nightly Codex batches, around 13 agent tools, 600 petabytes migrated, 5,500 support users, and about 100 support fixes per day per engineer.

4 supporting quotes
“the same investment in Codex that powers the agent has let the team do things most companies consider impossible”article, stated
“With a strong team, and Codex doing much of the code changes, the migration finished end to end in roughly two months.”article, stated
“What used to require an engineer per release now runs unattended.”article, stated
“The engineer is amplified.”article, stated