The Monitor

Datadog + OpenAI: Codex CLI integration for AI‑assisted DevOps

5 min read

Share article

Datadog + OpenAI: Codex CLI integration for AI‑assisted DevOps
Reilly Wood

Reilly Wood

Michael Bolin

Michael Bolin

Till Pieper

Till Pieper

We are exploring how we can help on-call engineers troubleshoot incidents more effectively by providing the OpenAI Codex agent with access to real-time observability data in terminals. We've developed an integration and new tool visualizations that connect OpenAI's Codex CLI to the new Datadog MCP server. In this post, we'll share what we've been experimenting with: enabling an AI agent to retrieve production metrics, logs, and incidents from Datadog in real time and act on that context.

Codex CLI: An open source terminal agent built for performance and safety

OpenAI recently unveiled a major update to Codex CLI, now written in Rust for improved performance, security, and portability. By eliminating the need for a Node.js runtime, the new Rust-based Codex CLI installs with zero dependencies. It uses Rust's memory safety guarantees and efficient execution—without a garbage collector—to run faster and more reliably. These characteristics make Codex CLI especially well-suited for on-call DevOps engineers. It launches instantly with minimal overhead, supports a terminal-native workflow, and integrates easily into scripts or automation pipelines—critical during high-pressure incidents where every second counts. A built-in sandbox also protects against potentially destructive tool calls, which is essential during incidents.

To extend these capabilities even further, Datadog, with input from the OpenAI team, has developed a new integration that connects the Codex CLI with Datadog's new MCP server. This integration exposes Datadog’s monitoring and incident management capabilities through the standardized MCP protocol. The Codex CLI agent can now securely connect to Datadog and perform tasks such as retrieving application logs via natural language queries, fetching metrics or APM traces for any given service, updating active incidents, and checking monitor statuses—all by invoking Datadog's MCP tools. The agent operates with real-time access to production context, including errors, performance data, and alert statuses, as if it were a Datadog user. Watch the demo by Michael Bolin, Lead Engineer for Codex CLI at OpenAI:

Bringing context-aware automation to Codex CLI with Datadog

Combining OpenAI’s Codex CLI with Datadog’s MCP integration enables new automation workflows for DevOps teams. In addition to generating and modifying code, the Codex agent can now pull real-time context from Datadog to inform its actions. For example, an engineer might ask the agent to “investigate a high-CPU incident in Service X and patch any configuration issues.” Codex, powered by state-of-the-art large language models, can call Datadog’s MCP tools to identify likely causes—such as a memory leak introduced in a recent deployment—and generate a targeted code fix or a runbook script. The output includes references to relevant metric anomalies or error logs the agent observed during its analysis.

Integrating the MCP server with AI agents like Codex enables them to become context-aware—bridging the gap between code and runtime behavior during troubleshooting. As a result, the tool calls that the agent plans and executes are now grounded in real-time operational context. Whether it’s generating a script to throttle a misbehaving process or proposing a code change to fix a bug causing an alert, the Codex and Datadog together can accelerate incident response and infrastructure automation with AI-driven intelligence.

Creating a new terminal experience for DevOps workflows

To support this kind of innovation, OpenAI open-sourced the Codex CLI and designed it to be extensible by the developer community. The Datadog MCP integration is a prime example: Datadog contributed upstream to enable flexible integrations for new tools and allow external services to plug into the agent.

We believe that terminal-based AI agents can do more than distill crucial insights from vast amounts of data in plain text. Lightweight UI elements—like graphs, color-coded severity badges, and tabular log grids—can make MCP tool output more scannable and actionable for on-call engineers. We've added support for richer, structured UIs for interacting with observability tools and data to the terminal experience of Codex CLI. For example, when managing incidents in Datadog, the agent can display color-coded priorities—showing critical issues in red and lower-priority ones in yellow or green. It can also present incident details in a more scannable format, highlighting key metadata, such as status, assignee, and timestamps.

Metrics fetched via MCP could be shown as inline graphs using ASCII or Unicode plots, updating in near real time, giving on-call engineers a quick glance at trends—without leaving the terminal. If the agent applies a code change as a fix, Codex could show an inline diff summary of the change, along with a brief description of the relevant observability context, so engineers can review the AI’s modifications in context before applying them. These UX enhancements make the AI agent’s output more readable and actionable, which is critical when you’re debugging an outage at 3 a.m. and need information at a glance. Many of these improvements, including more structured and visual tool outputs, were developed with input from OpenAI, ensuring that this new interface meets real-world DevOps needs. We will continue to explore how those capabilities could also be made available to other MCP tools that have similar requirements.

AI-assisted DevOps is here

For Datadog customers and developers exploring AI agents, this integration delivers a practical solution: an AI on-call assistant that not only writes code, but also understands your production environment—and operates entirely in the terminal, the preferred work environment for many DevOps teams. Combining Datadog’s monitoring, alerts, and telemetry into the Codex agent's decision loop means it can write more relevant code and assist with operational tasks under the supervision of on-call engineers.

We invite developers and DevOps teams to try out Codex alongside the Datadog MCP server, now in Preview, and experience this new approach to AI-assisted troubleshooting and incident response.

Related Articles

Monitor your OpenAI LLM spend with cost insights from Datadog

Monitor your OpenAI LLM spend with cost insights from Datadog

Integration roundup: Monitoring your AI stack

Integration roundup: Monitoring your AI stack

Connect your AI agents to Datadog tools and context using the Datadog MCP Server

Connect your AI agents to Datadog tools and context using the Datadog MCP Server

Monitor your OpenAI agents with Datadog LLM Observability

Monitor your OpenAI agents with Datadog LLM Observability

Start monitoring your metrics in minutes