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.
Installation
Section titled “Installation”npm install -g acpx@latestacpx --versionWithout a global install: npx acpx@latest.
Registering Waibee
Section titled “Registering Waibee”Waibee is not one of acpx’s built-in adapters, so add it to the config:
{ "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.
First prompt
Section titled “First prompt”A one-off prompt that keeps no context:
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:
acpx waibee sessions newacpx waibee 'find the slowest test and explain why'acpx waibee 'fix it' # remembers the previous replySessions are tied to the agent and the working folder. Keep parallel tasks apart with names:
acpx waibee sessions new --name backendacpx waibee -s backend 'fix the timeout in checkout'
acpx waibee sessions # sessions in this folderacpx waibee status # agent process, model, uptimeacpx waibee cancel # cancel the current promptPermissions
Section titled “Permissions”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.
| Flag | Behavior |
|---|---|
--approve-reads | Allow reads and search, ask about the rest. The default |
--approve-all | Allow everything: file edits and commands run without asking |
--deny-all | Reject 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.
Output for scripts
Section titled “Output for scripts”| Format | What it prints |
|---|---|
--format text | Readable progress of the work. The default |
--format quiet | Only the final reply text |
--format json | The ACP event stream as line-delimited JSON |
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>.
Model and reasoning level
Section titled “Model and reasoning level”acpx --model anthropic/claude-sonnet-5 waibee exec 'analyze this stack trace'
acpx waibee set model anthropic/claude-haiku-4.5 # for the current sessionacpx waibee set thought_level high # reasoning effortacpx waibee set mode acceptEdits # approval modeThe 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.
If this is for CI
Section titled “If this is for CI”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
defaultmode 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”.
Next steps
Section titled “Next steps”- 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.