Install and auth

Install fagi with npm, keep it updated, sign in with a key pair, switch profiles, turn on completion and check your setup with doctor

Install the CLI from npm, sign in with your API key pair, and check your setup against Future AGI Cloud or a self-hosted install.

Prerequisites
  • Node.js 22.15 or later on the 22 line, or 23.11 or later
  • npm
  • A key pair: the API key and secret key of one entry under Build > Keys (see API keys)

Install

npm install -g @future-agi/cli
fagi version

fagi version (or fagi --version) prints the installed version. Add --json for machine-readable output.

npx -p @future-agi/cli fagi --help

Runs the CLI once without installing it. Keep -p @future-agi/cli fagi exactly as shown.

Don’t install with --omit=optional or --no-optional: the CLI needs its platform package (macOS, Linux and Windows on x64 and arm64).

Upgrade

Upgrade an npm install with npm:

npm install -g @future-agi/cli@latest

fagi update --check shows the installed and latest versions without changing anything. On an npm install, fagi update prints the npm command above.

If you installed from a release installer instead of npm, fagi update (add --yes for non-interactive use) installs the latest release; see fagi update --help for --check, --dry-run, --version and --force.

Remove fagi

Remove each profile first, while fagi is still installed, so the key pairs leave your OS keychain:

fagi profiles list
fagi profiles remove NAME
npm uninstall -g @future-agi/cli

Settings stay in ~/.config/fi (or $XDG_CONFIG_HOME/fi): config.toml, the profile list profiles.json, and a credentials folder for profiles saved with --insecure-file-store. Delete ~/.config/fi to remove them all. Project config files (.fi/config.toml in your repositories, see Where settings come from) stay where they are.

Sign in

The CLI signs in with an existing personal key pair. It never creates keys or changes their permissions.

fagi auth login
fagi auth status

fagi auth login asks for both keys with input hidden and saves the pair in your OS keychain under the active profile. It does not contact the server, so check the pair with fagi auth status.

CommandWhat it does
fagi auth loginSave a key pair in the OS keychain for this profile and base URL. Takes --api-key and --secret-key, or reads FI_API_KEY and FI_SECRET_KEY
fagi auth statusCheck the pair against the server; prints the profile, the base URL, the first six characters of the key and, in table output, who you are signed in as
fagi auth logoutRemove this profile’s stored credentials. The key stays valid on the platform, and environment variables are not changed
fagi auth deviceBrowser sign-in is not available yet; it exits 2. Use fagi auth login or the environment variables

Keys passed as flags can end up in your shell history and process list, so prefer the prompt or the environment variables. Without a terminal, or with --no-input, a missing or half-set pair exits 2 and names the missing variable instead of prompting.

Sign in with environment variables

Set FI_API_KEY and FI_SECRET_KEY; every command uses them directly, with no login and nothing stored. This is how CI jobs and coding agents sign in. Check them with fagi auth status --no-input --json (exit 0 = signed in, 3 = missing or rejected keys).

To save the pair to the keychain without a prompt instead, pass it through the environment once:

FI_API_KEY=YOUR_API_KEY FI_SECRET_KEY=YOUR_SECRET_KEY fagi auth login --no-input
fagi auth status --json

No OS keychain

A locked or missing keychain is an error, never a silent fallback. If no OS keychain is available (for example a headless Linux box), fagi auth login --insecure-file-store saves the pair to a file under ~/.config/fi/credentials/ that only you can read. Later commands use it automatically and print a warning. Not supported on Windows; use the environment variables there.

Self-hosted

Create the key pair in your self-hosted dashboard and pass its API URL when you log in. The profile remembers the URL, so later commands need no flag.

fagi auth login --profile self-hosted --base-url https://futureagi.example.com
fagi doctor --profile self-hosted

FI_BASE_URL does the same as --base-url; in CI, set it next to FI_API_KEY and FI_SECRET_KEY. Without a base URL the CLI talks to Future AGI Cloud.

A few commands behave differently on a self-hosted install:

  • fagi skills (CLI 0.3.0 or later): pass your platform URL to fagi skills init --origin and set FI_CONTEXT_ORIGIN to it (see Skills)
  • fagi api usage works on Future AGI Cloud only; on a self-hosted install it exits 4
  • fagi epoch run (CLI 0.3.0 or later) needs a platform with Epoch support (see Errors and exit codes)

Profiles

A profile is one named sign-in: a base URL and a key pair. Use one per deployment or per account. Profile names are 1-64 lowercase letters, digits, ., _ and -, starting with a letter or digit. A name with uppercase letters exits 2 and suggests the lowercase form.

fagi auth login --profile staging --base-url https://staging.futureagi.example.com
fagi profiles list
fagi profiles use staging
fagi profiles remove staging
CommandWhat it does
fagi profiles listList saved profiles with their base URL and credential store. The active one is marked *
fagi profiles use NAMEMake NAME the default profile. A name that was never saved exits 4
fagi profiles remove NAMERemove the profile and its stored credentials; safe to repeat

Where settings come from says which profile a command uses.

Choose a workspace

Most commands act in one workspace. List the ones your key can use; the ID column (or id in --json output) is the value to pass:

fagi api context workspaces list
fagi api context workspaces list --json
fagi api context whoami --workspace WORKSPACE_ID

Pass --workspace for one command, set FI_WORKSPACE_ID, or save workspace_id under your profile in a config file.

Turn on shell completion

fagi completion SHELL prints a completion script for bash, zsh, fish or powershell. To turn it on for every new zsh session:

echo 'source <(fagi completion zsh)' >> ~/.zshrc

For the other shells, fagi completion SHELL --help says where to put the script. --no-descriptions leaves the help text out of the suggestions. Completion runs locally, with no credentials or network. On fagi api commands, Tab lists a flag’s allowed values (for example --eval-type offers llm, code, agent).

Check your setup

fagi doctor
fagi doctor --json

fagi doctor prints the profile, the base URL and where it came from, the start of the API key, the languages it detected in this folder and the content capture setting. It then runs these checks. When every check passes it ends with the next step; a failing check exits with an error line that says what to do.

CheckWhat it looks at
ConfigYour configuration is valid and workspace_id is a UUID
CredentialsA complete key pair is set or saved for this profile
PlatformThe server is reachable and is a Future AGI server
Signed inThe server accepts the key pair, and as whom
CollectorThe trace collector accepts a test export with your key
Tracing keyShown only if the key used for tracing differs and has a problem
AgentsWhich automatic tracing integrations are available (see Tracing)

--offline skips the platform and collector checks. Missing credentials then show as a warning in the Credentials row, and doctor exits 0 and prints the sign-in step; a credential error, such as a half-set key pair, still exits 3. --json adds a checks[] list with a name, status and detail for each. An invalid base URL exits 2 before any network check, and missing or rejected credentials exit 3; Exit codes lists the rest.

Troubleshooting

SymptomFix
A command typed as fi gives a shell syntax errorfi is a shell keyword. Use fagi, or type \fi (see Command name and aliases)
fagi fails to start after an install with --omit=optionalReinstall without --omit=optional or --no-optional, so npm adds the platform package
fagi exits 1 with a Node upgrade messageOn Linux and macOS, older Node exits 1. Install Node.js 22.15 or later on the 22 line, or 23.11 or later
fagi auth login fails because the keychain is locked or missingUnlock the keychain, or see No OS keychain
Exit 3 after you point a profile at another URLSaved keys are bound to the URL they were saved with. Log in again for that URL
fagi doctor fails the Platform checkExit 6 means the server is unreachable. Exit 4 means the URL isn’t a Future AGI server; check --base-url
fagi doctor fails the Collector checkRead the check’s detail in fagi doctor --json; --offline skips the check

Dive deeper

Was this page helpful?

Questions & Discussion