In this article
December 12, 2025
December 12, 2025

Datadog: SQL Is the New Bash for AI Agents

Reilly Wood on why structured queries beat freeform commands at scale

At MCP Night: The Holiday Special, Reilly Wood showed why Datadog bet on SQL as their MCP interface—and why agents perform better with structured queries than freeform commands.

This post is part of our MCP Night: The Holiday Special: Holiday Special Recap series. Read the full recap post here.

Reilly Wood, Staff Software Engineer at Datadog, who works on their MCP server, opened with a problem every observability platform faces: scale. Datadog ingests massive volumes of logs, metrics, and events from customers. Helping AI agents make sense of that data efficiently is a non-trivial challenge.

The solution they landed on? SQL.

The Side-by-Side Comparison

Reilly's demo split the screen. On the left, an agent with access to Datadog's traditional MCP tools—filters using proprietary syntax, standard request-response patterns. On the right, an agent with access to tools that accept SQL queries.

Both agents tackled the same investigation task. The difference in approach was immediate.

The SQL-equipped agent wrote a simple, precise query and got results quickly. The traditional tools required the agent to guess at filter syntax, iterate through responses, and piece together information across multiple calls.

The SQL agent had already finished while the traditional agent was still working through its approach.

Why SQL Wins

Reilly explained the architectural decision. At Datadog's scale, you can't just dump everything into Postgres. Their SQL execution framework uses indexes and tokens optimized for the types of queries agents actually run—selecting specific columns, performing efficient counts, aggregating across dimensions.

But beyond the performance benefits, SQL solves a fundamental problem with AI agents: context management.

When agents use freeform tools, they often resort to patterns that feel like bash scripting—piping head or tail to look at a few rows, using jq to extract fields, iterating over categories to find signal. Each of those operations consumes context window and requires the agent to manage intermediate state.

SQL collapses all of that into a single, declarative statement. The agent describes what it wants, the database figures out how to get it efficiently, and the result comes back ready to use. No intermediate state, no context window bloat.

Aggregation for Free

Reilly highlighted a specific benefit: aggregation. When investigating incidents, agents often need to answer questions like "how many errors of each type occurred in the last hour?" With freeform tools, that might require fetching raw data and processing it client-side. With SQL, it's a GROUP BY clause.

It's as much about correctness as it is token efficiency. SQL aggregations run where the data lives, using indexes and optimizations that the database knows about. Agent-side aggregation is slower and more error-prone.

The Broader Pattern

Michael Grinich noted after the demo that SQL emerged as a theme throughout the evening. Both Supabase and Datadog independently arrived at the same conclusion: SQL is a better interface for AI agents than freeform commands or proprietary query languages.

The insight goes deeper than MCP. As organizations build AI-powered tools that need to query internal systems, SQL provides a structured, well-understood interface that models can generate reliably. It's not as flexible as natural language, but that constraint is actually a feature—it forces precision.

Observability Meets AI

For Datadog users, the MCP server extends their platform into the agentic workflow. Automated incident investigation becomes conversational: ask what happened, get a SQL-backed analysis, follow up with additional queries. The agent handles the query generation; Datadog handles the execution at scale.

Try It Yourself

Datadog's MCP server provides tools for metrics, incidents, monitors, and more. For teams already using Datadog for observability, the MCP integration brings that data into AI-assisted workflows without building custom integrations.

At MCP Night: The Holiday Special, Datadog demonstrated that the debate between "let agents write bash" and "constrain agents to structured interfaces" might have a clear winner. SQL gives agents the flexibility they need while maintaining the precision that production systems require.

Read our full MCP Night: The Holiday Special: Holiday Special Recap post here.

This site uses cookies to improve your experience. Please accept the use of cookies on this site. You can review our cookie policy here and our privacy policy here. If you choose to refuse, functionality of this site will be limited.