Skip to main content

Overview

Headless (non-interactive) mode allows Qoder CLI to run without an interactive interface—it receives a prompt, executes the task, outputs the result to standard output, and exits. It is ideal for embedding Qoder into Shell scripts, automation workflows, and CI/CD Pipelines. To enter Headless mode, add the --print flag (short form -p):
Since there is no one around to confirm, permissions in Headless mode must be pre-configured—any operation that would normally require a pop-up confirmation will be automatically denied in plain text Headless mode. See Permissions for details.

Basic Usage

Pass the prompt as an argument and add -p:
You can also pass the prompt via standard input:
Capture the output in a script:

Output Format

Use --output-format (short form -o) to specify the output format. The default is text: Example:
The Input Format can be specified using --input-format, supporting text and stream-json. When using stream-json input, you can continuously send Structured Messages via standard input.

Common Flags

Headless mode is often used in combination with the following flags: For a complete list of flags, see CLI Startup Arguments Reference.

Permission Control

Since there is no interactive confirmation in Headless mode, you need to pre-determine which operations can be executed automatically using permission flags:
  • In plain text Headless mode, any operation that “requires confirmation” defaults to deny. If driven by a Host Application via the stream-json protocol (e.g., Agent SDK), confirmation requests are forwarded to the Host Application for decision. See “Consumption methods of ask in different runtime environments” in Permissions.
  • Use --permission-mode accept_edits to automatically approve safe file edits within the working directory.
  • Use --yolo (equivalent to --permission-mode bypass_permissions) to skip all confirmations. This is only recommended for use in fully trusted environments.
For details on the behavior of each permission mode, see Permissions.

CI/CD Example

In a pipeline, authentication is typically completed first via Environment Variables before running in Headless mode:
See Sign-in and Authentication for authentication methods. Set the output format to json to make it easier for subsequent pipeline steps to parse Qoder’s results.