>_ DevTrendsen

Language

Home

Languages

Sections

Frontend Backend Mobile DevOps AI / ML GameDev Blockchain Embedded Security
Rust

How to Make AI Agents Friends with Your Infrastructure Using Pup

CI

Have you ever tried feeding an AI agent (like Claude Code or Cursor) the API documentation of a cloud service and asking it to "just fix" a broken service? More likely than not, the agent gets tangled up in endpoints, authentication methods, and JSON response structures. Datadog Labs solved this elegantly: they released Pup, a dedicated CLI tool that turns the massive monitoring platform into a well-behaved "pet" for your automated helpers.

Why Do We Need Another Command Line Interface

Usually, CLIs are written for humans. They have fancy progress bars, interactive prompts, and tons of arguments we can't be bothered to memorize. Pup (short for puppy) is designed differently. Its main goal is to become a bridge between your code and all the monitoring data that Datadog collects.

Lately, I've been seeing more and more developers trying to automate routine SRE tasks. For example, finding anomalies in logs or checking monitor status before a release. Doing this through regular API requests takes a long time. Writing wrappers for every little thing is boring. Pup takes care of all the "dirty" work of communicating with the Datadog API, returning a cleanly structured response to the agent (or you).

How Pup Makes Life Easier for the Agent

The developers at Datadog Labs built several ideas into the project that make this CLI ideal for machine consumption.

The tool can automatically detect when it's being run by an AI agent. If the environment has variables like CLAUDE_CODE, CURSOR_AGENT, or GITHUB_COPILOT, Pup switches to a special mode. Instead of human-readable tables, it outputs dense JSON with metadata and hints that LLMs understand much better.

Another important point is automatic confirmation of destructive actions. If you run a monitor deletion command in normal mode, the CLI will ask: "Are you sure?". In agent mode, Pup understands the context and doesn't block automation with unnecessary questions unless explicitly configured.

Under the Hood: Features and Technologies

The project is written in Rust, which guarantees speed and no weird memory errors. But the more interesting thing is the API coverage the utility offers. It covers almost all Datadog functionality — from basic metrics to complex security settings.

Here's just a small part of what you can do with a single command:

  • Monitoring: managing alerts, dashboards, and SLOs.
  • Security: finding vulnerabilities and auditing logs.
  • CI/CD: tracking pipeline quality and finding "flaky" tests.
  • Costs: analyzing cloud spending and attribution by department.

Interestingly, Pup supports OAuth2 with PKCE. This means you don't need to store long-lived API keys somewhere in configs that an agent might accidentally "leak". Authorization happens through the browser, and tokens are securely stored in the system keychain (macOS Keychain or Windows Credential Manager).

Practical Scenarios

Imagine you're using Claude Code to refactor a microservice. Now you can give it the command: "Check error logs in Datadog for the last hour and tell me if I broke something with my last commit".

The agent just runs:

pup logs search --query="service:my-app status:error" --from="1h"

And gets a result in a format it can immediately analyze.

Another cool feature is local runbooks. These are YAML files where you can describe a chain of actions: check metrics, if they're above normal — request confirmation from the operator, then launch a Workflow in Datadog. This turns Pup into a full-fledged operations automation engine that lives right in your terminal.

Is It Worth Trying

The project is currently in Preview status. This means interfaces might change slightly, and you might encounter bugs in the code. However, Pup already looks like the easiest way to give your AI assistant "eyes" inside your infrastructure.

Who this will definitely be useful for:

  • SRE and DevOps engineers who want to speed up incident debugging.
  • Developers actively using AI agents in their workflow.
  • Teams building complex automation systems on top of Datadog.

If you want to test the tool on macOS, installation via Homebrew will take just a couple of minutes:

brew tap datadoghq/tap
brew install pup

After that, just run pup auth login, and you're ready to go.

In my view, tools like this are the future of interacting with cloud platforms. We're moving away from clicking in the browser console to meaningful communication with the system through agents, and Pup here is an excellent guide.

Related projects