Skip to content

Harnesses

Jackson Sá edited this page Oct 21, 2026 · 1 revision

Starting a harness

agentux-harness::HarnessSpec::builtin() lists each harness's ACP command:

Harness ACP command Vendor CLI
claude-code npx -y @agentclientprotocol/claude-agent-acp@<pinned> claude
codex npx -y @agentclientprotocol/codex-acp@<pinned> codex
opencode opencode acp opencode
antigravity (experimental) agy-acp-server agy

A harness is installed when its CLI and command are on agentuxd's PATH, and signed in when its CLI's sign-in file exists or an API key does (HarnessSpec::signed_in; None when that cannot be told). Usable means installed and not known to be signed out. The built-in pipeline and fallbacks only pick usable harnesses that are not at a limit, in the user's order.

API keys

agentuxd/src/secrets.rs: when a harness starts, its key variables (ANTHROPIC_API_KEY for Claude Code, OPENAI_API_KEY for Codex, GEMINI_API_KEY for Antigravity, all of them and OPENROUTER_API_KEY for OpenCode) are looked up — first in $CREDENTIALS_DIRECTORY (systemd credentials), then in the secret service (secret-tool lookup agentux-key VAR, 3 s timeout) — and added to that harness's environment only. A variable already in agentuxd's environment wins.

Usage limits

agentuxd/src/limits.rs reads a limit from a harness's error, or from a short reply that is only a limit notice: its kind (session, weekly, credits, rate, stalled), an optional model, and when it resets (an epoch, "resets 3pm (Zone)", "resets Oct 27, 9am", "try again in 2 days", "retry in 41.5s", retryDelay, retry-after). Without a time it guesses (2 minutes, 1 hour, 24 hours; credits: until cleared).

The engine stores the limit (harness_limits), runs the step again with a fallback or waits on a limit request, and wake_limited (every 15 s) resumes runs whose limit is over. limits.clear lifts one. Codex's plan windows come from its session logs (quota.rs); a spent window is recorded as a limit before the step starts.

Stalled turns

acp.rs: a turn with no event for idle (10 minutes) — or tool (60 minutes) while a tool call is in flight — is cancelled and its session closed, unless a permission request or a bus ask_human is waiting for the human. The error becomes a stalled limit for 15 minutes. The minutes come from the user's preferences, read at each turn.

Helper questions and tests

helper.ask and harnesses.test run one turn in a fresh session with no tools (the first tool call ends it) and every permission denied.

Clone this wiki locally