diff --git a/main/docs/deploy-monitor/auth0-cli.mdx b/main/docs/deploy-monitor/auth0-cli.mdx index 4fdfdfe063..7bc7a4c14c 100644 --- a/main/docs/deploy-monitor/auth0-cli.mdx +++ b/main/docs/deploy-monitor/auth0-cli.mdx @@ -160,6 +160,74 @@ auth0 apps show --json auth0 apps create --name "My App" --type spa --json > app-details.json ``` +## Use with AI agents + +Agent Mode makes the CLI safe for an AI coding agent to drive without a human watching every step. Enable it with the `--agent-mode` flag or the `AUTH0_AGENT_MODE` environment variable: + +```bash lines +auth0 apps list --agent-mode +``` + +```bash lines +AUTH0_AGENT_MODE=true auth0 apps list +``` + +Agent Mode turns on structured JSON output, disables interactive prompts and color, and guarantees a non-zero exit code on any failure. You don't have to set it explicitly in most cases — the CLI detects when it isn't talking to an interactive terminal (for example, when run by Claude Code, Cursor, or a CI job) and applies the same behavior automatically. + +Agent Mode defaults to indented JSON output. For high-volume or token-sensitive workflows, pass `--json-compact` to get the same data without the extra whitespace: + +```bash lines +auth0 apps list --agent-mode --json-compact +``` + +Streaming commands, such as `auth0 logs tail`, always use the compact form in Agent Mode. + +### Discover the command surface + +An agent can map the entire CLI in a single call instead of working through `--help` one level at a time: + +```bash lines +auth0 commands --flat +``` + +Add `--detailed` to include flags, arguments, defaults, and whether authentication is required for each command — enough to construct a valid call without opening a `--help` page. + +### Check a payload shape before sending it + +`--schema` prints the exact request payload a command expects, sourced from the OpenAPI spec: + +```bash lines +auth0 apps create --schema +``` + +`--data` sends the whole payload as one JSON object — inline, from a file, or piped through stdin — and validates it locally before the request reaches the API: + +```bash lines +auth0 apps create --data '{"name":"My App","app_type":"spa"}' +auth0 apps create --data @app.json +cat app.json | auth0 apps create +``` + +### Structured errors + +Every failure in Agent Mode returns a JSON error envelope instead of a plain-text message: + +```json +{"error":{"code":"validation","reason":"required_field","message":"...","details":{"field":"name","reason":"required"}}} +``` + +`code` is a stable, machine-readable failure class (`usage`, `auth`, `validation`, `not_found`, `rate_limit`, and others). `reason` adds finer detail, and `details` carries field-level information when a payload fails validation — an agent can branch on these values instead of parsing a sentence. + +### Search documentation from the terminal + +`auth0 docs search` queries Auth0's public documentation without leaving the terminal and without requiring authentication: + +```bash lines +auth0 docs search "organizations" +``` + +In Agent Mode, results include raw-markdown URLs an agent can fetch directly. + ## Documentation and Support For complete documentation, command reference, and examples, visit: diff --git a/main/docs/get-started/build-with-ai-tools.mdx b/main/docs/get-started/build-with-ai-tools.mdx index d9af0d6f8b..db6886ee7b 100644 --- a/main/docs/get-started/build-with-ai-tools.mdx +++ b/main/docs/get-started/build-with-ai-tools.mdx @@ -142,6 +142,12 @@ To verify, ask `What MCP servers do you have installed?` in Cascade’s chat. Ca +## Auth0 CLI + +The [Auth0 CLI](/docs/deploy-monitor/auth0-cli) supports Agent Mode, which makes it safe for an AI coding agent to drive directly from your terminal: structured JSON output, no interactive prompts, and a reliable exit code on every failure. Agent Mode turns on automatically when the CLI detects it isn't talking to an interactive terminal, so most coding agents get this behavior without any setup. + +To learn how to discover commands, check a payload shape before sending it, and search documentation from the terminal, read [Use with AI agents](/docs/deploy-monitor/auth0-cli#use-with-ai-agents). + ## Sample prompts