Skip to content
docs

ACP in the terminal (acpx)

For scripts and CI, the main path is the built-in headless mode, waibee run: it needs nothing beyond the agent itself. See Headless mode and automation.

This page covers another option, in case you already know it: acpx, a third-party headless client for the Agent Client Protocol. The agent uses the same protocol to connect to editors; here, the command line drives it. To acpx, Waibee Code is an ordinary ACP agent started with waibee acp.

What acpx adds on top of waibee run:

  • Sessions persist between calls. Each prompt remembers the previous one, while each call is still a single terminal command.
  • Several tasks in one folder. Named sessions run in parallel without getting in each other’s way.
  • One interface and one event format across agents. The ACP JSON stream is the same for every ACP agent, which helps when other agents live next to Waibee in your scripts.
Terminal window
npm install -g acpx@latest
acpx --version

Without a global install: npx acpx@latest.

Waibee is not one of acpx’s built-in adapters, so add it to the config:

~/.acpx/config.json
{
"agents": {
"waibee": {
"command": "waibee",
"args": ["acp"]
}
}
}

If waibee is not on your PATH, give the full path: ~/.local/bin/waibee (macOS/Linux) or %LOCALAPPDATA%\Programs\waibee\waibee.exe (Windows). You can also put the config next to the project, in a .acpxrc.json file; acpx config show prints the current values.

The agent picks up the API key on its own: set it beforehand with waibee auth login or the WAIBEE_API_KEY environment variable, see Quickstart.

A one-off prompt that keeps no context:

Terminal window
acpx waibee exec 'In three points: what does this repository do?'

For prompts that build on earlier ones, create a session explicitly. This guards against creating sessions by accident in CI:

Terminal window
acpx waibee sessions new
acpx waibee 'find the slowest test and explain why'
acpx waibee 'fix it' # remembers the previous reply

Sessions are tied to the agent and the working folder. Keep parallel tasks apart with names:

Terminal window
acpx waibee sessions new --name backend
acpx waibee -s backend 'fix the timeout in checkout'
acpx waibee sessions # sessions in this folder
acpx waibee status # agent process, model, uptime
acpx waibee cancel # cancel the current prompt

In the terminal, the agent has no one to ask, so you set the approval policy with a flag. By default, acpx allows reads and asks about everything else; when there is no one to ask, it rejects the request, and the command fails with PERMISSION_DENIED even if a reply was already received.

FlagBehavior
--approve-readsAllow reads and search, ask about the rest. The default
--approve-allAllow everything: file edits and commands run without asking
--deny-allReject the approval requests passed to the client
--permission-policy <json>A custom policy: lists of what to approve and deny automatically

The flags only answer the questions Waibee Code asks, and it asks according to its mode. A session starts in the same mode as a new terminal session without the --mode flag, see Switching modes. In trust, edits and most commands go through without asking, and neither --approve-reads nor --deny-all stops them. To set the session’s mode, run acpx waibee set mode default.

Use --approve-all only where unwanted changes cost nothing: a disposable clone, a worktree, a working copy in CI. Denials from settings.json apply regardless of the flag, see Permissions.

FormatWhat it prints
--format textReadable progress of the work. The default
--format quietOnly the final reply text
--format jsonThe ACP event stream as line-delimited JSON
Terminal window
SUMMARY=$(acpx --format quiet waibee exec 'describe the changes on this branch in one paragraph')
echo "$SUMMARY"

--json-strict guarantees nothing but JSON on stdout, which helps when the output goes straight into jq. Two more useful flags: --suppress-reads (don’t print the contents of files the agent reads) and --timeout <seconds>.

Terminal window
acpx --model anthropic/claude-sonnet-5 waibee exec 'analyze this stack trace'
acpx waibee set model anthropic/claude-haiku-4.5 # for the current session
acpx waibee set thought_level high # reasoning effort
acpx waibee set mode acceptEdits # approval mode

The mode values are the same as for the --mode flag, see Switching modes. The thought_level values are the same as for /effort in the TUI and depend on the model, see Reasoning level.

Compare it with waibee run first: that needs no Node and no separate install, and its exit codes are built for goal mode. Ready-made pipeline recipes are in Headless mode. acpx makes sense when your CI needs a stateful conversation across steps, or when the pipeline already runs several agents through acpx.

Either way, keep in mind:

  • Limit time and turns (--timeout, --max-turns): an agent in CI should not hang until the runner times out.
  • Run read-only checks in default mode with --approve-reads, and edits in a separate step with an explicit --approve-all, so that a review job can’t produce a stray commit.
  • Check the exit code. A nonzero code means a denied permission, a timeout, or an agent error, not “no findings”.
  • Headless mode: the built-in way to run the agent from scripts and CI.
  • IDEs (ACP): the same protocol in Zed and JetBrains.
  • Goal mode: how to make the agent carry a task through to a checkable result.