Skip to content
Anlyon
Esc
↑↓navigate↵open⌘Jpreview
On this page

Anlyon CLI

Operate actions, approvals, receipts and impact limits from a terminal or a CI job, with the same server-side checks as the API and no code to write.

The anlyon command-line interface lets you work with Anlyon from a terminal or a CI job: invoke an action, decide an approval, read a receipt, check how much of an impact limit is left, connect an account or install a pack. It calls the same API your code calls, so every command passes the same policies, approvals and impact limits.

Know why you would use it

Your agent acts through Anlyon from your code. Around it, people still need to look and step in: approve the refund that is waiting, find the call whose outcome is unknown, check that a limit is not nearly spent, run an action once from a deploy job. Without a CLI, each of those means a dashboard visit or a script against the API.

  • Less effort. Each of those tasks is one command. Nothing to write, no SDK to set up. --json and stable exit codes make the same commands usable from scripts and CI.
  • No side door. The CLI sends requests to Anlyon. Policy evaluation, approvals and the provider call happen on the server, so an action invoked from a terminal is checked, gated, limited and recorded exactly like one invoked by your agent. A CLI login cannot skip a policy.
  • Hard to aim at the wrong place. A credential is bound to one workspace and one environment on the server. --environment production asserts the target and stops the command if it differs. Every write asks you to confirm and names the workspace and environment first.

Install and log in

Install

The CLI needs Node 20.3 or later. See Install the CLI for upgrades and troubleshooting.

npm install -g @anlyonhq/cli
anlyon --version

Log in

A browser opens at the Anlyon consent screen. If you belong to more than one workspace, you choose the workspace and environment there.

anlyon auth login

On a server or in CI, where there is no browser, set ANLYON_API_KEY instead. See Log in and profiles.

Check where you are

Prints the user, workspace, environment and role the credential acts as.

anlyon whoami

Tour the common tasks

Each example is a complete command. The command reference lists every flag.

See what your agents did

anlyon runs list --status failed --since 2026-10-01T00:00:00Z
anlyon invocations list --status unknown
anlyon invocations get inv_123

An invocation with status unknown may have taken effect at the provider. Reconcile it before you run the action again. See When the outcome is unknown.

Decide an approval

Deciding needs the anlyon:approvals.decide consent group, which a default login does not include.

anlyon auth login --scope anlyon:approvals.decide
anlyon approvals list --status pending
anlyon approvals approve apr_123 --note "checked with the customer"

You cannot decide an approval that you, or an app or key acting for you, requested. Another member decides it.

Read a receipt

Every governed call leaves an effect with a receipt grade: confirmed, acknowledged, unknown, failed, refused, denied or pending.

anlyon effects list --unresolved
anlyon effects get eff_123

Check an impact limit

anlyon impact-limits list

The table shows each limit’s period, its size, how much is consumed, and how much is reserved by calls that have not settled. See Impact limits.

Invoke an action

The CLI asks you to confirm, naming the workspace and environment. If the action needs approval, the command exits with code 12 and prints the approval id. --wait 10m follows it to its outcome.

anlyon actions invoke refund_payment --data '{"charge":"ch_123","amount":1200}' --wait 10m

Connect an account and install a pack

anlyon auth login --scope anlyon:secrets
anlyon connections add hubspot
anlyon packs plan ./packs/outbound-sales

Connected accounts need the anlyon:secrets consent group. A new login replaces the profile’s previous one, so to keep deciding approvals as well, name both: --scope anlyon:approvals.decide,anlyon:secrets. packs plan shows what an install would create, skip or refuse, and sends nothing.

Run it from CI

export ANLYON_API_KEY=anlyon_live_...
anlyon actions invoke refund_payment --data '{"charge":"ch_123","amount":1200}' \
  --idempotency-key refund-ch_123 --environment production --yes --json

See Scripting and CI for exit codes and a complete GitHub Actions workflow.

Know which accounts the CLI acts with

The CLI uses your workspace’s connections: the accounts connected in the credential’s environment, such as your company’s HubSpot or Stripe account. Commands send no end-user header, so an action invoked from the CLI runs with the environment’s connected account and under the environment’s limits and team approvals.

To act in one of your users’ own accounts, name the user from your server code: anlyon.forUser(userId) in the TypeScript SDK, or the Anlyon-End-User header over HTTP. See Act for your users.

Two consequences for the CLI:

  • anlyon approvals list shows your team’s approvals. An approval that a policy with decidedBy: "end_user" gives to one of your users is decided in your app, and is not in this list.
  • A key created with “Require an end user” cannot drive the CLI. Anlyon refuses its calls without an end user with 400 END_USER_REQUIRED, and the CLI exits 6. Give the CLI an operator or agent key instead. See API keys and scopes.

Find the right command

anlyon auth login | status | logout | scopes
anlyon profile list | use <name>
anlyon whoami
anlyon doctor

anlyon actions list | get <ref> | versions <ref>
anlyon actions invoke <ref> [--data '<json>' | --input <file|->] [--idempotency-key <key>] [--wait 10m]
anlyon actions declare <ref> [--dimension … --amount … --bound …] [--verify-url … --verify-status …] [--governed | --ungoverned]
anlyon invocations list [--action <ref>] [--status <status>] | get <id>
anlyon runs list [--status …] [--search …] [--agent …] [--since …] [--until …] | get <id>
anlyon approvals list [--status pending|…] [--origin …] | get <id>
anlyon approvals approve <id> [--note …] | deny <id> [--note …]
anlyon policies list [--action <name>] | get <id> | versions <id>
anlyon effects list [--action <name>] [--outcome <o>] [--grade <g>] [--unresolved] | get <id>
anlyon impact-limits list [--include-archived] | get <id>
anlyon connections integrations | list | add <integration> | check <SECRET> | reconnect <SECRET>
anlyon packs plan <pack> | install <pack> | exercise <pack>

anlyon <command> --help describes each one from the CLI itself.

The policies and impact-limits commands read. packs install creates a pack’s policies (disabled until you enable them) and, with --with-limits, its suggested limits. To change policies, use policy as code from deployment code. To change limits, use the API.

Know how versions change

The CLI is versioned on its own, apart from the SDK and the API. While it is 0.x, a minor release may add commands, flags, JSON fields and exit codes. A change that removes, renames or changes the meaning of one carries a changelog entry marked Breaking. See Rely on the machine contract.

Was this page helpful?