/ /
From prompt to PR: how Careem’s AI writes and validates dbt models before a human ever sees them

From prompt to PR: how Careem’s AI writes and validates dbt models before a human ever sees them

Daniel Poppy

Last edited on Oct 26, 2026

Careem, the UAE super app behind ride-hailing, grocery delivery, food delivery, and remittance, runs on a lean data engineering team supporting more than 5,000 models. The company's stack is built entirely in-house and runs on open source end to end, from ingestion through transformation to BI, with dbt doing the transformation work. In a dbt Summit 2026 breakout session, Niyazulla Khan Pathan, engineering manager for the data platform team, and Akash Srivastava, lead software engineer on the data platform team, described a backlog of over 100 pending data requests, each of which used to take one to two weeks to answer.

Their first attempt at a fix was the obvious one: point an LLM at the problem and let it write models. It failed, because a human reviewer skimming AI-generated code for patterns rather than reading every line will miss the one corner case that breaks a pipeline, and, with it, the business's trust in the numbers.

"Confidence comes from validation, and not really from the code generator," Srivastava said. "Any LLM can write code. The confidence to merge that code comes from an end-to-end validation."

That became the design principle behind their four-pillar agent architecture. A context layer built on open metadata gives the agent table and column-level documentation, lineage, a glossary of tribal terms like AOV and GTV, and centralized metric definitions, preventing the agent from guessing at ambiguous terms.

A spec-locking step forces the agent to ask clarifying questions about grain, metric definition, and filters before writing anything. That step alone kills a common failure mode: at Careem, "revenue" alone could mean GTV, GMV, or order count depending on who's asking, and the agent now asks which one instead of silently picking one and hoping.

The platform also draws a hard line between a golden layer, reserved for fully governed, federated metrics, and a transient layer for one-off analyst requests, which get a 30-day lifespan before they're either promoted to a proper data mart or automatically cleaned up. That housekeeping matters at Careem's scale: the team cleared out 3.6 petabytes of transient data in the last year alone.

Structural guardrails isolate every agent-generated change in a sandboxed dev environment, with separate IAM roles, storage paths, and compute, so nothing an agent does can touch production. And an agent loop compiles, tests, and materializes each change, catching failures like type mismatches and fixing them automatically until the run succeeds, before a human ever reviews the pull request.

In a live demo, an analyst's plain-English request, "I want a daily food revenue for each merchant," turned into a fully tested, documented dbt model and pull request in minutes, self-correcting through two failed test runs along the way. The automated checks on that pull request went beyond standard dbt tests, verifying that data moved correctly from bronze to silver to gold and validating the model's storage location against Careem's domain conventions. The first sandbox run failed on a data type mismatch; the agent read the error, corrected it, and reran.

The second run failed because a needed column lived in a different source table; the agent used the context layer to find it, joined it in, and reran again. Only after a clean run did the pull request go to a human.

The results: metric delivery time dropped from two to three weeks down to hours, roughly 90% of new models at Careem now come out of this framework, with no sev0 or sev1 incidents since the process was introduced.

The team also built in duplicate-request protection: since every change runs through the dbt manifest, a second request for a column that's already been added gets caught and redirected to the existing model instead of creating a near-identical one.

And the whole platform came together fast: Careem started evaluating dbt in December, had the full infrastructure built by March, and had the agent live by April or May, with the legacy warehouse migration itself taking only a few additional weeks. As Pathan put it, closing the talk: "The generator is easy. The validation layer is the product."

Watch every keynote and breakout from dbt Summit 2026 on demand. Watch dbt Summit 2026 on demand →

Get started in dbt

Join the analytics engineers building data infrastructure that actually scales.

Install dbt Wizard CLI

Get started with an agent purpose-built for analytics engineering. It knows which tool to call, which context to pull, and checks its own work before surfacing anything to you.

Share this article
The dbt Community

Join the largest community shaping data

The dbt Community is your gateway to best practices, innovation, and direct collaboration with thousands of data leaders and AI practitioners worldwide. Ask questions, share insights, and build better with the experts.

100,000+active members
50k+teams using dbt weekly
50+Community meetups