Skip to main content
Output policy controls whether output data is displayed to humans in TTY mode while still returning it to agents via --json, --format, or --verbose.

Overview

By default, all command output is displayed to everyone ('all'). Set outputPolicy: 'agent-only' to suppress data output in human/TTY mode while still returning structured data to agents.

Use Cases

Internal Commands

Commands designed for agent-only use that produce verbose machine-readable output:

Commands with Side Effects

Commands that perform actions but don’t need to display data:

Inheritance

Set outputPolicy on a group or root CLI to inherit across all children:

CLI-Level Policy

Set outputPolicy at the CLI level to apply to all commands by default:

Behavior Details

Human Mode (TTY)

When outputPolicy: 'agent-only' and stdout is a TTY:
  • Data output is suppressed — return value is not displayed
  • Errors are still shownerror() calls display normally
  • CTAs are still shownok() and error() CTAs display normally
  • --json overrides — explicit format flags show data
  • --verbose overrides — full envelope is shown

Agent Mode (Non-TTY)

When stdout is not a TTY (piped, redirected, or consumed by an agent):
  • Data is always included — regardless of outputPolicy
  • Full envelope format — agents always see structured output

Forcing Data Display

Humans can override agent-only with explicit format flags:

Policy Values

ValueDescription
'all'Displays to both humans and agents (default)
'agent-only'Suppresses data output in human/TTY mode while still returning it to agents

When to Use

Use 'agent-only' for:
  • Commands designed for agent orchestration
  • Internal commands that produce verbose machine-readable output
  • Commands where the side effect matters more than the return value
  • Commands that use CTAs to guide users instead of showing raw data
Use 'all' (default) for:
  • Commands where the output is the primary value (queries, reports)
  • Commands humans invoke directly
  • Commands with concise, human-readable output