Synopsis
The client reads command options, environment variables, saved login data, and built-in defaults. A value earlier in the documented order wins. For authentication,AGENTSFLEET_API_KEY overrides the saved login credential.
Run agentsfleet login with a browser on the same computer. Compare the check code in both places before choosing Authorize. The terminal completes sign-in after approval.
For a remote terminal or another device, use agentsfleet login --no-open with manual code entry.
See terminal sign-in for cancellation, browser launch failures, and manual steps.
The command accepts no token on the command line and reads no token from piped input.
Login also records the server it signed into. Later commands reach that same server unless you name another one.
Example with output
Options
The API URL uses this order:
--api, AGENTSFLEET_API_URL, the server recorded at login, then the built-in URL.
Errors
An invalid URL returns exit code4. A missing credential returns exit code 1.
Most commands report network failures with exit code 2. Login reports sign-in failures with exit code 1.
A saved credential that records no server returns exit code 1 with error code DEPLOYMENT_UNKNOWN. Nothing is sent. Pass --api <API_URL>, set AGENTSFLEET_API_URL, or run agentsfleet login again.
The logout and doctor commands still run in that state. One ends a credential and the other explains the refusal.
Do not put credentials in command history. Use AGENTSFLEET_API_KEY through your secret manager for unattended commands.