Skip to navigation

Output and exit codes

In a terminal, adacli prints readable tables. An AI assistant adds --json after the command name to get JSON, and reads the typed exit code to check the result. This page lists the global options, the output modes, and the exit codes.

Do not build an integration or a script on adacli. adacli is for a person or an AI assistant that works in a terminal. A release that removes or changes a command name, an option name, or an exit code increases the major version. Most output comes from the Ada service, so it can change without a new adacli release. Only the latest release of adacli is supported. For details, see Versioning and Supported releases. To build an integration, use the Ada API. The Ada API is the only stable interface.

Global options

Put a global option after the instance and before the command name:

adacli acme --output json alerts rules list

An option after the command name fails with unknown option, unless the command has its own option with that name. --session works in any place.

When a command has its own option with the same name as a global option, the command reads only its own option. For example, mcp-tools delete has its own --yes. adacli acme --yes mcp-tools delete <id> does not confirm the delete: the command prints that it needs a confirmation, exits with code 0, and deletes nothing. Put --yes after the command name: adacli acme mcp-tools delete <id> --yes.

Not every command reads the global output options yet. A command that does not read them prints tables. To get JSON, put --json after the command name. Most commands have their own --json option:

adacli acme knowledge list --json
OptionDescription
--jsonPrints JSON on stdout.
--output <mode>Sets the output mode: table, json, or quiet.
-q, --quietPrints minimal output. A list prints only the IDs.
--no-colorPrints no color.
-y, --yesSkips the confirmation prompts of a command that has no --yes option of its own.
--session <id>Connects the command to a session from session-tracking start.
-h, --helpShows the help for a command.
-V, --versionShows the adacli release.

Output modes

A command that reads the global output options selects the output mode in this order:

  1. The --json, --output, or --quiet option.
  2. The ADACLI_OUTPUT environment variable, set to table, json, or quiet.
  3. JSON when stdout is not a terminal, for example when you pipe the output to another command. Otherwise, tables.

A command that has its own --json option prints JSON when you put --json after the command name, whatever the output mode.

To read one value from the output in a terminal, use --json with a tool such as jq:

adacli acme playbooks list --json | jq '.playbooks[] | select(.is_active == true) | .name'

Errors

When a command fails in JSON mode, adacli writes the error to stderr as JSON. Stdout stays empty, so an AI assistant does not read the error as data.

status is an exception. When there is no working session, status --json writes not_logged_in or session_invalid to stdout and nothing to stderr. See Sessions.

{
"error": {
"code": "SESSION_EXPIRED",
"category": "auth",
"message": "Session expired. Please log in again.",
"exitCode": 3,
"hint": "Run: adacli <instance> login"
}
}

hint tells you what to do next. For a usage error, allowed lists the values that the option accepts.

Exit codes

An AI assistant reads the exit code to check the result of a command. The text of a message can change, so the exit code is the result to check.

CodeMeaning
0The command succeeded.
1The Ada service returned an error, or adacli failed.
2The command, an argument, or an option is not valid.
3You are not logged in, or the session expired.
4Your role does not allow the action.
5The item does not exist.
6Too many requests. Wait, then try again.
7The item cannot be changed.
8adacli cannot connect to the Ada service.
9The item is in a state that refuses the request. For example, a limit is reached.
20A command that reads many pages stopped before the end. The output is not complete.
21A command that reads many pages found nothing in the date range.
22A read returned empty, and adacli cannot confirm the result.
23A handoff integration reconnected, but adacli cannot confirm the new connection.

Codes 20 to 23 are not failures. Do not use the output as a complete result:

  • With 20, the command printed the rows that it read to stdout. conversations export -o <file> writes them to <file>.partial instead, and does not change <file>.
  • With 21, conversations export writes nothing to stdout and no file.
  • With 22 and 23, the command printed its output to stdout.

To read the exit codes as JSON, run adacli agent-context. For details, see agent-context.

Environment variables

VariableDescription
ADACLI_OUTPUTThe default output mode: table, json, or quiet.
ADACLI_EMAIL, ADACLI_PASSWORDThe credentials for a login without a browser, for example in a remote terminal. See Sessions.
ADACLI_NO_UPDATE_CHECKSet to 1 to stop the notice about new releases.
NO_COLOR, FORCE_COLORThe standard variables that turn color off or on.