pup

command module
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

README ยถ

๐Ÿ• Give Your Agent a Puppy: Introducing Pup CLI

NOTICE: This is in Preview mode, we are fine tuning the interactions and bugs that arise. Please file issues or submit PRs. Thank you for your early interest!

CI Go Version License

Every AI agent needs a loyal companion. Meet Pup โ€” the CLI that gives your agents full access to Datadog's observability platform (because even autonomous agents need good tooling, not just tricks).

What is Pup?

A comprehensive, AI-agent-ready CLI with 200+ commands across 33 Datadog products. We've unleashed the full power of Datadog's APIs so your agents can fetch metrics, sniff out errors, and track down issues without barking up the wrong API tree.

AI agents are the fastest-growing interface for infrastructure management. Companies like Vercel and AWS are racing to make their platforms agent-accessible, but we're leading the pack. Pup makes Datadog the alpha choice for AI-native workflows with 100% documented API coverage while competitors are still learning basic commands.

Why Your Agent Will Love It

  • ๐Ÿพ Well-trained: Self-discoverable commands (no need to chase documentation)
  • ๐Ÿฆฎ Obedient: Structured JSON/YAML output for easy parsing
  • ๐Ÿ•๐Ÿฆบ On a leash: OAuth2 + PKCE for scoped access (no more long-lived keys running wild)
  • ๐Ÿถ Knows all the tricks: Monitors, logs, metrics, RUM, security and more!

Try It (Humans Welcome Too!)

# Give your agent credentials (house-training, basically)
pup auth login

# Now they can fetch data like a good pup
pup monitors list --tags="team:api-platform"         # Fetch monitors
pup logs search --query="status:error" --from="1h"   # Sniff out errors
pup metrics query --query="avg:system.cpu.user{*}"   # Track the metrics tail

๐Ÿถ TL;DR: We built a comprehensive CLI so AI agents can use Datadog like a pro. Give your agent a pup. They're housetrained, loyal, and know way more tricks than you'd expect.

P.S. No actual puppies were harmed in the making of this CLI. Just a lot of Go code and API endpoints.

API Coverage

Pup implements 39 of 85+ available Datadog APIs (45.9% coverage).

See docs/COMMANDS.md for detailed command reference.

๐Ÿ’ก Tip: Use Ctrl/Cmd+F to search for specific APIs. Request features via GitHub Issues.


๐Ÿ“Š Core Observability (6/9 implemented)
API Domain Status Pup Commands Notes
Metrics โœ… metrics search, metrics query, metrics list, metrics get V1 and V2 APIs supported
Logs โœ… logs search, logs list, logs aggregate V1 and V2 APIs supported
Events โœ… events list, events search, events get Infrastructure event management
RUM โœ… rum apps, rum sessions, rum metrics list/get, rum retention-filters list/get Apps, sessions, metrics, retention filters (create/update pending)
APM Services โœ… apm services, apm entities, apm dependencies, apm flow-map Services stats, operations, resources; entity queries; dependencies; flow visualization
Traces โŒ - Not yet implemented
Profiling โŒ - Not yet implemented
Session Replay โŒ - Not yet implemented
Spans Metrics โŒ - Not yet implemented
๐Ÿ”” Monitoring & Alerting (6/9 implemented)
API Domain Status Pup Commands Notes
Monitors โœ… monitors list, monitors get, monitors delete, monitors search Full CRUD support with advanced search
Dashboards โœ… dashboards list, dashboards get, dashboards delete, dashboards url Full management capabilities
SLOs โœ… slos list, slos get, slos create, slos update, slos delete, slos corrections Full CRUD plus corrections
Synthetics โœ… synthetics tests list, synthetics locations list Test management support
Downtimes โœ… downtime list, downtime get, downtime cancel Full downtime management
Notebooks โœ… notebooks list, notebooks get, notebooks delete Investigation notebooks supported
Dashboard Lists โŒ - Not yet implemented
Powerpacks โŒ - Not yet implemented
Workflow Automation โŒ - Not yet implemented
๐Ÿ”’ Security & Compliance (6/9 implemented)
API Domain Status Pup Commands Notes
Security Monitoring โœ… security rules list, security signals search, security findings search Rules, signals, findings with advanced search
Static Analysis โœ… static-analysis ast, static-analysis custom-rulesets, static-analysis sca, static-analysis coverage Code security analysis
Audit Logs โœ… audit-logs list, audit-logs search Full audit log search and listing
Data Governance โœ… data-governance scanner-rules list Sensitive data scanner rules
Application Security โŒ - Not yet implemented
CSM Threats โŒ - Not yet implemented
Cloud Security (CSPM) โŒ - Not yet implemented
Sensitive Data Scanner โŒ - Not yet implemented
โ˜๏ธ Infrastructure & Cloud (6/8 implemented)
API Domain Status Pup Commands Notes
Infrastructure โœ… infrastructure hosts list, infrastructure hosts get Host inventory management
Tags โœ… tags list, tags get, tags add, tags update, tags delete Host tag operations
Network โณ network flows list, network devices list Placeholder - API endpoints pending
Cloud (AWS) โœ… cloud aws list AWS integration management
Cloud (GCP) โœ… cloud gcp list GCP integration management
Cloud (Azure) โœ… cloud azure list Azure integration management
Containers โŒ - Not yet implemented
Processes โŒ - Not yet implemented
๐Ÿšจ Incident & Operations (7/8 implemented)
API Domain Status Pup Commands Notes
Incidents โœ… incidents list, incidents get, incidents attachments Incident management with attachment support
On-Call (Teams) โœ… on-call teams (CRUD, memberships with roles) Full team management system with admin/member roles
Case Management โœ… cases (create, search, assign, archive, projects) Complete case management with priorities P1-P5
Error Tracking โœ… error-tracking issues search, error-tracking issues get Error issue search and details
Service Catalog โœ… service-catalog list, service-catalog get Service registry management
Scorecards โœ… scorecards list, scorecards get Service quality scores
Fleet Automation โœ… fleet agents, fleet deployments, fleet schedules Agent management, deployments, schedules (Preview)
Incident Services/Teams โŒ - Not yet implemented
๐Ÿ”ง CI/CD & Development (1/3 implemented)
API Domain Status Pup Commands Notes
CI Visibility โœ… cicd pipelines list, cicd events list CI/CD pipeline visibility and events
Test Optimization โŒ - Not yet implemented
DORA Metrics โŒ - Not yet implemented
๐Ÿ‘ฅ Organization & Access (5/6 implemented)
API Domain Status Pup Commands Notes
Users โœ… users list, users get, users roles User and role management
Organizations โœ… organizations get, organizations list Organization settings management
API Keys โœ… api-keys list, api-keys get, api-keys create, api-keys delete Full API key CRUD
App Keys โœ… app-keys list, app-keys get, app-keys register, app-keys unregister App key registration for Action Connections
Service Accounts โœ… - Managed via users commands
Roles โŒ - Only list via users
โš™๏ธ Platform & Configuration (7/9 implemented)
API Domain Status Pup Commands Notes
Usage Metering โœ… usage summary, usage hourly Usage and billing metrics
Cost Management โœ… cost projected, cost attribution, cost by-org Cost attribution by tags and organizations
Product Analytics โœ… product-analytics events send Server-side product analytics events
Integrations โœ… integrations slack, integrations pagerduty, integrations webhooks Third-party integrations support
Observability Pipelines โณ obs-pipelines list, obs-pipelines get Placeholder - API endpoints pending
Miscellaneous โœ… misc ip-ranges, misc status IP ranges and status
Key Management โŒ - Not yet implemented
IP Allowlist โŒ - Not yet implemented

Installation

Homebrew (macOS/Linux) - Coming soon!
brew tap datadog-labs/pack
brew install datadog-labs/pack/pup
Go Install
go install github.com/datadog-labs/pup@latest
Manual Download

Download pre-built binaries from the latest release.

Authentication

Pup supports two authentication methods. OAuth2 is preferred and will be used automatically if you've logged in.

OAuth2 Authentication (Preferred)

OAuth2 provides secure, browser-based authentication with automatic token refresh.

# Set your Datadog site (optional)
export DD_SITE="datadoghq.com"  # Defaults to datadoghq.com

# Login via browser
pup auth login

# Use any command - OAuth tokens are used automatically
pup monitors list

# Check status
pup auth status

# Logout
pup auth logout

Token Storage: Tokens are stored securely in your system's keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service). Set DD_TOKEN_STORAGE=file to use file-based storage instead.

Note: OAuth2 requires Dynamic Client Registration (DCR) to be enabled on your Datadog site. If DCR is not available yet, use API key authentication.

See docs/OAUTH2.md for detailed OAuth2 documentation.

API Key Authentication (Fallback)

If OAuth2 tokens are not available, Pup automatically falls back to API key authentication.

export DD_API_KEY="your-datadog-api-key"
export DD_APP_KEY="your-datadog-application-key"
export DD_SITE="datadoghq.com"  # Optional, defaults to datadoghq.com

# Use any command - API keys are used automatically
pup monitors list
Bearer Token Authentication (WASM / Headless)

For WASM builds or environments without keychain access, use a pre-obtained bearer token:

export DD_ACCESS_TOKEN="your-oauth-access-token"
export DD_SITE="datadoghq.com"

pup monitors list

API key authentication (DD_API_KEY + DD_APP_KEY) also works in WASM. See the WASM section below.

Authentication Priority

Pup checks for authentication in this order:

  1. DD_ACCESS_TOKEN - Stateless bearer token (highest priority)
  2. OAuth2 tokens (from pup auth login) - Used if valid tokens exist
  3. API keys (from DD_API_KEY and DD_APP_KEY) - Used if OAuth tokens not available

Usage

Authentication
# OAuth2 login (recommended)
pup auth login

# Check authentication status
pup auth status

# Refresh access token
pup auth refresh

# Logout
pup auth logout
Test Connection
pup test
Monitors
# List all monitors
pup monitors list

# Get specific monitor
pup monitors get 12345678

# Delete monitor
pup monitors delete 12345678 --yes
Metrics
# Search metrics using classic query syntax (v1 API)
pup metrics search --query="avg:system.cpu.user{*}" --from="1h"

# Query time-series data (v2 API)
pup metrics query --query="avg:system.cpu.user{*}" --from="1h"

# List available metrics
pup metrics list --filter="system.*"
Dashboards
# List all dashboards
pup dashboards list

# Get dashboard details
pup dashboards get abc-123-def

# Delete dashboard
pup dashboards delete abc-123-def --yes
SLOs
# List all SLOs
pup slos list

# Get SLO details
pup slos get abc-123

# Delete SLO
pup slos delete abc-123 --yes
Incidents
# List all incidents
pup incidents list

# Get incident details
pup incidents get abc-123-def

Global Flags

  • -o, --output: Output format (json, table, yaml) - default: json
  • -y, --yes: Skip confirmation prompts for destructive operations

Environment Variables

  • DD_ACCESS_TOKEN: Bearer token for stateless auth (highest priority)
  • DD_API_KEY: Datadog API key (optional if using OAuth2 or DD_ACCESS_TOKEN)
  • DD_APP_KEY: Datadog Application key (optional if using OAuth2 or DD_ACCESS_TOKEN)
  • DD_SITE: Datadog site (default: datadoghq.com)
  • DD_AUTO_APPROVE: Auto-approve destructive operations (true/false)
  • DD_TOKEN_STORAGE: Token storage backend (keychain or file, default: auto-detect)

Agent Mode

When pup is invoked by an AI coding agent, it automatically switches to agent mode which returns structured JSON responses optimized for machine consumption (including metadata, error details, and hints). Agent mode also auto-approves confirmation prompts.

Agent mode is auto-detected when any of these environment variables are set to 1 or true:

Variable Agent
CLAUDE_CODE or CLAUDECODE Claude Code
CURSOR_AGENT Cursor
CODEX or OPENAI_CODEX OpenAI Codex
AIDER Aider
CLINE Cline
WINDSURF_AGENT Windsurf
GITHUB_COPILOT GitHub Copilot
AMAZON_Q or AWS_Q_DEVELOPER Amazon Q
GEMINI_CODE_ASSIST Gemini Code Assist
SRC_CODY Sourcegraph Cody
FORCE_AGENT_MODE Any agent (manual override)

You can also enable it explicitly with the --agent flag or by setting FORCE_AGENT_MODE=1:

# Auto-detected (e.g., running inside Claude Code)
pup monitors list

# Explicit flag
pup monitors list --agent

# Environment variable override
FORCE_AGENT_MODE=1 pup monitors list

If you are integrating pup into an AI agent workflow, make sure the appropriate environment variable is set so responses are optimized for your agent. Without it, pup defaults to human-friendly output.

WASM

Pup compiles to WebAssembly (GOOS=js GOARCH=wasm) for use in browser-like runtimes such as Deno, Bun, and Cloudflare Workers.

Building
GOOS=js GOARCH=wasm go build -o pup.wasm .

# Copy the Go WASM support file
cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" .
Authentication

The WASM build supports stateless authentication โ€” keychain storage and browser-based OAuth login are not available. Use either DD_ACCESS_TOKEN or API keys:

# Option 1: Bearer token
DD_ACCESS_TOKEN="your-token" DD_SITE="datadoghq.com" deno run pup.wasm monitors list

# Option 2: API keys
DD_API_KEY="your-api-key" DD_APP_KEY="your-app-key" deno run pup.wasm monitors list

The pup auth status command works in WASM and reports which credentials are configured. The login, logout, and refresh subcommands return guidance to use DD_ACCESS_TOKEN.

Limitations
  • No local token storage (keychain/file) โ€” use DD_ACCESS_TOKEN or API keys
  • No browser-based OAuth login flow
  • Networking relies on the host runtime's Fetch API
Running with Deno
import "./wasm_exec.js";

const go = new Go();
const wasm = await Deno.readFile("pup.wasm");
const result = await WebAssembly.instantiate(wasm, go.importObject);
go.run(result.instance);

Pre-built WASM archives (including wasm_exec.js) are available in GitHub Releases.

Development

# Run tests
go test ./...

# Build
go build -o pup .

# Build WASM
GOOS=js GOARCH=wasm go build -o pup.wasm .

# Run without building
go run main.go monitors list

License

Apache License 2.0 - see LICENSE for details.

Documentation

For detailed documentation, see CLAUDE.md.

Documentation ยถ

The Go Gopher

There is no documentation for this package.

Directories ยถ

Path Synopsis
cmd
internal
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL