Common workflows and usage patterns for Pup CLI.
# Login with default site (datadoghq.com)
pup auth login
# Login with specific site
pup --site=datadoghq.eu auth login
# Check authentication status
pup auth status
# Logout
pup auth logoutexport DD_API_KEY="your-api-key"
export DD_APP_KEY="your-app-key"
export DD_SITE="datadoghq.com"# List all metrics
pup metrics list
# Filter by pattern
pup metrics list --filter="system.*"
pup metrics list --filter="custom.app.*"# Classic query syntax
pup metrics search --query="avg:system.cpu.user{*}" --from="1h"
# Search with aggregation and grouping
pup metrics search --query="sum:app.requests{env:prod} by {service}" --from="4h"# Timeseries formula query
pup metrics query --query="avg:system.cpu.user{*}" --from="1h" --to="now"
# Query with aggregation
pup metrics query --query="sum:app.requests{env:prod} by {service}" --from="4h"# List all monitors
pup monitors list
# Filter by tag
pup monitors list --tag="env:production"
pup monitors list --tag="team:backend"
# Multiple tags
pup monitors list --tag="env:prod" --tag="service:api"# Get specific monitor by ID
pup monitors get 12345678# Delete monitor (prompts for confirmation)
pup monitors delete 12345678
# Skip confirmation
pup monitors delete 12345678 --yes# Search for errors in last hour
pup logs search --query="status:error" --from="1h" --to="now"
# Search by service
pup logs search --query="service:web-app status:warn" --from="30m"
# Complex query with attributes
pup logs search --query="@user.id:12345 status:error" --limit=100
# Search with time range
pup logs search \
--query="service:api" \
--from="2024-02-04T10:00:00Z" \
--to="2024-02-04T11:00:00Z"# Count logs by status
pup logs aggregate \
--query="service:web-app" \
--from="1h" \
--compute="count" \
--group-by="status"
# Average duration by service
pup logs aggregate \
--query="service:web-app" \
--from="1h" \
--compute="avg(@duration)" \
--group-by="service"
# 99th percentile latency by service
pup logs aggregate \
--query="env:prod" \
--from="30m" \
--compute="percentile(@duration, 99)" \
--group-by="service"
# Multiple metrics in one query (comma-separated)
pup logs aggregate \
--query="service:web-app" \
--from="1h" \
--compute="count,avg(@duration),percentile(@duration, 95)" \
--group-by="service,status"# Search Flex logs (cost-optimized storage tier)
pup logs search --query="service:api" --from="7d" --storage="flex"
# Search online archives (long-term storage)
pup logs search --query="status:error" --from="30d" --storage="online-archives"
# Search standard indexes (default, fastest tier)
pup logs search --query="service:web-app" --from="1h" --storage="indexes"
# Use Datadog's default storage behavior
pup logs search --query="status:warn" --from="1h"# List all dashboards
pup dashboards list
# Output as table
pup dashboards list --output=table# Get dashboard details
pup dashboards get "abc-123-def"
# Get public URL for sharing
pup dashboards url "abc-123-def"pup dashboards delete "abc-123-def" --yes# List all SLOs
pup slos list
# Filter by tag
pup slos list --tag="service:api"pup slos get "abc-123-def"pup slos create \
--name="API Availability" \
--type="metric" \
--target=99.9 \
--timeframe="30d"# List corrections for SLO
pup slos corrections list "abc-123-def"
# Create correction
pup slos corrections create "abc-123-def" \
--start="2024-02-04T10:00:00Z" \
--end="2024-02-04T11:00:00Z" \
--category="deployment"# List all incidents
pup incidents list
# Filter by status
pup incidents list --status="active"pup incidents get "abc-123"pup incidents create \
--title="High Error Rate in API" \
--severity="SEV-2" \
--customer-impacted=truepup incidents update "abc-123" --status="resolved"pup rum apps listpup rum apps get "abc-123"pup rum sessions search \
--query="@application.id:abc-123" \
--from="1h"pup security rules listpup security rules get "abc-123"pup security signals list --from="1h"pup security findings search \
--query="@severity:high"# Show APM instrumentation errors for a specific host
pup apm troubleshooting list --hostname my-host
# Narrow results to a specific time window
pup apm troubleshooting list --hostname my-host --timeframe 4h# List all containers
pup containers list
# Filter by tags
pup containers list --filter-tags="env:production"
# Group by image
pup containers list --group-by="image_name"# List all container images
pup containers images list
# Filter images by tags
pup containers images list --filter-tags="env:production"# List all hosts
pup infrastructure hosts list
# Filter by tag
pup infrastructure hosts list --filter="env:production"# Filter agents by hostname
pup fleet agents list --filter "hostname:my-host"
# Filter by IP address
pup fleet agents list --filter "ip_address:1.2.3.4"
# Boolean filter expression
pup fleet agents list --filter "(hostname:host-a OR hostname:host-b) AND env:prod"pup infrastructure hosts get "host-name"# List all host tags
pup tags listpup tags get "host-name"pup tags add "host-name" \
--tag="env:production" \
--tag="team:backend"pup tags update "host-name" \
--tag="env:prod" \
--tag="service:api"pup users listpup users get "user-id"pup users roles listpup organizations getpup api-keys listpup api-keys get "key-id"pup api-keys create --name="CI/CD Key"pup api-keys delete "key-id" --yespup synthetics tests listpup synthetics tests get "test-id"pup synthetics locations listpup workflows get <workflow-id>pup workflows create --file=workflow.jsonpup workflows update <workflow-id> --file=workflow.jsonpup workflows delete <workflow-id># Run with inline payload (requires DD_API_KEY + DD_APP_KEY)
pup workflows run <workflow-id> --payload '{"key": "value"}'
# Run with payload from file
pup workflows run <workflow-id> --payload-file=params.json
# Run and wait for completion (default timeout: 5m)
pup workflows run <workflow-id> --wait
# Run with custom timeout
pup workflows run <workflow-id> --wait --timeout 2m# List recent executions
pup workflows instances list <workflow-id>
# List with pagination
pup workflows instances list <workflow-id> --limit=20 --page=2
# Get instance details
pup workflows instances get <workflow-id> <instance-id>
# Cancel a running instance
pup workflows instances cancel <workflow-id> <instance-id>Runbooks are YAML files stored in ~/.config/pup/runbooks/ that encode multi-step operational procedures. Each step runs a pup command, shell command, HTTP request, Datadog Workflow, or an interactive confirmation.
pup runbooks list
pup runbooks list --tag=type:deploymentpup runbooks describe deploy-service# Run with required variables via --arg flags
pup runbooks run deploy-service --arg SERVICE=payments --arg VERSION=1.2.3
# Dry-run (print steps without executing)
pup runbooks run incident-triage --dry-run# Copy a runbook YAML into ~/.config/pup/runbooks/
pup runbooks import ./my-runbook.yamlpup runbooks validate ./my-runbook.yamlname: restart-service
description: Safely restart a service after checking monitors
vars:
SERVICE:
description: Service name
required: true
steps:
- name: Check active monitors
kind: pup
run: monitors list --tags="service:{{SERVICE}}"
capture: MONITORS_JSON
- name: Confirm restart
kind: confirm
message: "Restart {{SERVICE}}? Review monitors above."
- name: Trigger restart workflow
kind: datadog-workflow
workflow_id: "abc-123"
inputs:
service: "{{SERVICE}}"
on_failure: fail
- name: Notify via webhook
kind: http
url: https://hooks.example.com/notify
method: POST
body: '{"text": "Restarted {{SERVICE}}"}'
content_type: application/json
on_failure: warnStore shared step logic in ~/.config/pup/runbooks/_templates/<name>.yaml:
# _templates/slack-notify.yaml
kind: http
url: "{{SLACK_WEBHOOK}}"
method: POST
body: '{"text": "{{MESSAGE}}"}'
content_type: application/json
on_failure: warnReference a template in any runbook step:
steps:
- name: Notify Slack
template: slack-notify
# Override any template field as neededSee docs/examples/runbooks/ for complete examples.
# Get owner, on-call, health, dependencies, and metadata gaps in one call
pup idp assist my-service
# Useful as a starting point for incident response or code review
pup idp assist payments-api# Search services by name (fuzzy match)
pup idp find payments
# Use kind: prefix to search other entity types
pup idp find "kind:team AND name:backend"# Show owning team and current on-call responders
pup idp owner my-service# List upstream (callers) and downstream (callees) services
pup idp deps my-service# POST a service.datadog.yaml to the Service Definitions API
pup idp register service.datadog.yaml
# Verify after registration
pup idp assist my-service# Get full service context immediately
pup idp assist payments-api
# Investigate alerts for the service
pup monitors list --tag="service:payments-api"
# Check who is on-call
pup idp owner payments-api
# Review upstream services that may be affected
pup idp deps payments-apipup monitors list --output=jsonpup monitors list --output=yamlpup monitors list --output=tablepup monitors list --fields="id,name,type,status"pup --config=/path/to/config.yaml monitors listpup --site=datadoghq.eu monitors listpup --verbose monitors listpup --yes monitors delete 12345678# Block all write operations (create, update, delete)
pup --read-only monitors list
pup --read-only dashboards list
# Also available via env var or config file
DD_READ_ONLY=true pup monitors list# List monitors for a service
pup monitors list --tag="service:api" --output=table
# Check recent logs
pup logs search --query="service:api" --from="1h" --output=table
# Query metrics
pup metrics query --query="avg:api.latency{*}" --from="1h"# Create incident
pup incidents create --title="API Down" --severity="SEV-1"
# Search related logs
pup logs search --query="status:error service:api" --from="1h"
# Check monitors
pup monitors list --tag="service:api"
# Update incident status
pup incidents update "incident-id" --status="investigating"# List recent security signals
pup security signals list --from="24h"
# Check security rules
pup security rules list
# Search security findings
pup security findings search --query="@severity:critical"
# Review audit logs
pup audit-logs list --from="7d"# List all hosts
pup infrastructure hosts list --output=table
# Get host details
pup infrastructure hosts get "host-name"
# Review host tags
pup tags list --output=table--from="1h" # 1 hour ago
--from="30m" # 30 minutes ago
--from="7d" # 7 days ago
--from="now" # Current time--from="2024-02-04T10:00:00Z"
--to="2024-02-04T11:00:00Z"--from="1707048000" # Unix timestamp in seconds# Authentication
export DD_API_KEY="your-api-key"
export DD_APP_KEY="your-app-key"
export DD_SITE="datadoghq.com"
# Configuration
export PUP_CONFIG="/path/to/config.yaml"
export PUP_OUTPUT="json"
export PUP_LOG_LEVEL="debug"pup acp serve starts a local HTTP server that lets AI coding assistants and agents
talk directly to Datadog Bits AI. It speaks two protocols:
- ACP (Agent Communication Protocol) — for ACP-native clients
- OpenAI-compatible — for tools like opencode, Cursor, or any
@ai-sdk/openai-compatibleclient
# Authenticate first (notebooks_read + notebooks_write scopes required)
pup auth login
# Start the server (auto-discovers your first Datadog Bits AI agent)
pup acp serve
# Specify a particular agent
pup acp serve --agent-id <uuid>
# Custom port or bind address
pup acp serve --port 8080
pup acp serve --host 0.0.0.0 --port 9099| Method | Path | Protocol | Description |
|---|---|---|---|
| GET | /agent.json |
ACP | Agent card / capability discovery |
| POST | /runs |
ACP | Synchronous run — returns full response |
| POST | /runs/stream |
ACP | Streaming run — SSE events |
| GET | /models or /v1/models |
OpenAI | Model list |
| POST | /chat/completions or /v1/chat/completions |
OpenAI | Chat completions (streaming or sync) |
# ACP sync
curl -s -X POST http://127.0.0.1:9099/runs \
-H "Content-Type: application/json" \
-d '{"input": [{"role": "user", "content": [{"type": "text", "text": "list my monitors with status alert"}]}]}' \
| jq .output[0].content[0].text
# ACP streaming
curl -X POST http://127.0.0.1:9099/runs/stream \
-H "Content-Type: application/json" \
-d '{"input": [{"role": "user", "content": [{"type": "text", "text": "what services have errors in the last hour?"}]}]}'
# OpenAI-compatible
curl -s -X POST http://127.0.0.1:9099/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "datadog-ai", "messages": [{"role": "user", "content": "how many monitors are currently alerting?"}]}' \
| jq .choices[0].message.contentAdd to ~/Library/Application Support/opencode/opencode.jsonc (macOS) or
~/.config/opencode/opencode.jsonc (Linux):
Then start the server (pup acp serve) and select the Datadog AI provider in opencode.
Create ~/.config/pup/config.yaml:
site: datadoghq.com
output: json
verbose: false
# Default time ranges
default_from: 1h
default_to: now
# Output preferences
output_format: json
table_max_width: 120
{ "$schema": "https://opencode.ai/config.json", "provider": { "datadog": { "name": "Datadog AI", "npm": "@ai-sdk/openai-compatible", "models": { "datadog-ai": { "name": "Datadog AI Agent" } }, "options": { "baseURL": "http://127.0.0.1:9099" } } } }