Skip to content

Commit 8934337

Browse files
docs(readme): fix WASM auth to mention API keys, add agent mode section
- Corrected WASM auth docs to show both DD_ACCESS_TOKEN and API key options (was incorrectly stating DD_ACCESS_TOKEN was the only method) - Added Agent Mode section documenting auto-detection environment variables and how to enable structured JSON responses for AI agents Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 70fa6f9 commit 8934337

1 file changed

Lines changed: 43 additions & 4 deletions

File tree

README.md

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export DD_SITE="datadoghq.com"
245245
pup monitors list
246246
```
247247

248-
This is the only authentication method available in the WASM build. See the [WASM](#wasm) section below.
248+
API key authentication (`DD_API_KEY` + `DD_APP_KEY`) also works in WASM. See the [WASM](#wasm) section below.
249249

250250
### Authentication Priority
251251

@@ -347,13 +347,48 @@ pup incidents get abc-123-def
347347

348348
## Environment Variables
349349

350-
- `DD_ACCESS_TOKEN`: Bearer token for stateless auth (highest priority, required for WASM)
350+
- `DD_ACCESS_TOKEN`: Bearer token for stateless auth (highest priority)
351351
- `DD_API_KEY`: Datadog API key (optional if using OAuth2 or DD_ACCESS_TOKEN)
352352
- `DD_APP_KEY`: Datadog Application key (optional if using OAuth2 or DD_ACCESS_TOKEN)
353353
- `DD_SITE`: Datadog site (default: datadoghq.com)
354354
- `DD_AUTO_APPROVE`: Auto-approve destructive operations (true/false)
355355
- `DD_TOKEN_STORAGE`: Token storage backend (keychain or file, default: auto-detect)
356356

357+
## Agent Mode
358+
359+
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.
360+
361+
Agent mode is **auto-detected** when any of these environment variables are set to `1` or `true`:
362+
363+
| Variable | Agent |
364+
|----------|-------|
365+
| `CLAUDE_CODE` or `CLAUDECODE` | Claude Code |
366+
| `CURSOR_AGENT` | Cursor |
367+
| `CODEX` or `OPENAI_CODEX` | OpenAI Codex |
368+
| `AIDER` | Aider |
369+
| `CLINE` | Cline |
370+
| `WINDSURF_AGENT` | Windsurf |
371+
| `GITHUB_COPILOT` | GitHub Copilot |
372+
| `AMAZON_Q` or `AWS_Q_DEVELOPER` | Amazon Q |
373+
| `GEMINI_CODE_ASSIST` | Gemini Code Assist |
374+
| `SRC_CODY` | Sourcegraph Cody |
375+
| `FORCE_AGENT_MODE` | Any agent (manual override) |
376+
377+
You can also enable it explicitly with the `--agent` flag or by setting `FORCE_AGENT_MODE=1`:
378+
379+
```bash
380+
# Auto-detected (e.g., running inside Claude Code)
381+
pup monitors list
382+
383+
# Explicit flag
384+
pup monitors list --agent
385+
386+
# Environment variable override
387+
FORCE_AGENT_MODE=1 pup monitors list
388+
```
389+
390+
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.
391+
357392
## WASM
358393

359394
Pup compiles to WebAssembly (`GOOS=js GOARCH=wasm`) for use in browser-like runtimes such as Deno, Bun, and Cloudflare Workers.
@@ -369,17 +404,21 @@ cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" .
369404

370405
### Authentication
371406

372-
The WASM build uses **stateless authentication only** — keychain storage and browser-based OAuth login are not available. Set `DD_ACCESS_TOKEN` with a pre-obtained bearer token:
407+
The WASM build supports **stateless authentication** — keychain storage and browser-based OAuth login are not available. Use either `DD_ACCESS_TOKEN` or API keys:
373408

374409
```bash
410+
# Option 1: Bearer token
375411
DD_ACCESS_TOKEN="your-token" DD_SITE="datadoghq.com" deno run pup.wasm monitors list
412+
413+
# Option 2: API keys
414+
DD_API_KEY="your-api-key" DD_APP_KEY="your-app-key" deno run pup.wasm monitors list
376415
```
377416

378417
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`.
379418

380419
### Limitations
381420

382-
- No local token storage (keychain/file) — use `DD_ACCESS_TOKEN`
421+
- No local token storage (keychain/file) — use `DD_ACCESS_TOKEN` or API keys
383422
- No browser-based OAuth login flow
384423
- Networking relies on the host runtime's Fetch API
385424

0 commit comments

Comments
 (0)