Datadog Pup CLI: Give AI Agents Scoped Access to Your Observability Stack

Datadog Pup CLI: Give AI Agents Scoped Access to Your Observability Stack

Enterprise Developer Platforms

AI agents need access to your observability data to be useful for on-call automation, incident triage, and production analysis. Pup CLI is Datadog’s answer to that access problem — scoped, revocable, and structured for agent consumption.

Purpose

Connect AI agents (Claude Code, Cursor, custom harnesses) to Datadog’s full product surface — metrics, logs, APM, cloud security, cost management — without embedding long-lived API keys in agent prompts or environment variables.

Pre-requisites

  • A Datadog account with the relevant product domains active
  • Claude Code, Cursor, or a custom AI agent setup
  • macOS, Linux, or Windows (Pup CLI is distributed as a single binary)

Steps

1. Install Pup CLI.

# macOS/Linux
curl -L https://install.datadoghq.com/pup | bash

# Or download the binary directly from the Datadog Pup CLI release page

2. Authenticate once with OAuth.

pup auth login

This opens a browser-based OAuth 2.0 + PKCE flow. You log in to your Datadog account, grant scoped access, and receive a credential stored locally. No API key is embedded anywhere. Credentials are revocable from the Datadog console.

3. Expose the command schema to your agent.

pup agent schema

This returns structured JSON describing all available commands across Datadog’s 200+ command surface. Your agent retrieves only the schema it needs at query time — avoiding upfront context bloat.

4. Run commands and chain results.

# Get recent error logs
pup logs tail --service payment-api --status error | jq '.logs[:5]'

# Check APM traces for a service
pup apm services list --env production

All commands return structured JSON or YAML, making output pipeable to standard shell tools or agent tool-call result parsers.

5. Connect to Claude Code or Cursor. In your agent’s tool configuration, set Pup CLI as a shell tool:

command: pup
description: "Access Datadog observability data — metrics, logs, APM, incidents, cloud security"

The agent calls pup agent schema on first use, then selects commands from the schema as needed.

6. Enable local AI server mode (optional).

pup acp serve

This starts a local Model Context Protocol (MCP) server that wraps Pup CLI commands as tool definitions. Use this for AI clients that prefer MCP over shell execution.

The Trap

Giving your agent the full 200+ command surface upfront. Load the schema dynamically with pup agent schema per query — it returns only the commands your agent asks about. Loading everything at session start fills context windows and slows performance. Let the Datadog AI agent guardrail pattern guide where in the pipeline agent access should sit.

Cited References

Source: Datadog Blog

Content created with AI assistance and reviewed for accuracy.

💬

Join the conversation

Stack Insiders is our free community for readers who want to go deeper — share resources, ask questions, and connect with others across every vertical we cover.

Join Stack Insiders →

Newsletter coming soon.

Curated digests across AI, biohacking, photography, travel, and more. Be the first to know when we launch.