Skip to main content

Install & Sign In

Up and running in about a minute: install SageCode, approve the sign-in in your browser, and run your first sagex command.

Install​

macOS / Linux

curl -LsSf https://sagecode.web.app/install.sh | sh

Windows (PowerShell)

irm https://sagecode.web.app/install.ps1 | iex

The installer uses uv to install SageCode as an isolated tool (installing uv first if needed), downloads Python 3.11+ if you don't have it, and puts the sagex command on your PATH. Open a new terminal and check it:

❯ sagex --version
sagex 2.0.0

Other ways to install​

SageCode is on PyPI as sagex-cli; the command it installs is sagex. Any Python tool manager works, with Python 3.11 or newer:

ToolCommand
uvuv tool install sagex-cli
pipxpipx install sagex-cli
pippip install sagex-cli (into a virtual environment)
A pinned versionuv tool install sagex-cli==2.0.0, or set SAGEX_VERSION=2.0.0 before running the installer

Sign in​

SageCode signs in with your AutoSage account. There's no key to copy: you approve the sign-in in your browser.

  1. Run sagex auth login. SageCode shows a one-time code and opens AutoSage in your browser:

    ❯ sagex auth login
    Your one-time code: WDJB-MJHT
    Approve the sign-in at: https://autosagex.web.app/cli-auth?code=WDJB-MJHT
    Opened your browser. Check the code matches, then approve.
    ✻ Waiting for approval… (4s · ctrl+c to cancel)
  2. Sign in to AutoSage if you aren't already. You land on the Authorize SageCode? page, which shows the code and the device asking to sign in: its name, system, SageCode version, IP address, and when it asked.

    The Authorize SageCode? page: the one-time code WDJB-MJHT, the device's name, system, SageCode version, IP address and request time, and Deny and Approve buttonsThe Authorize SageCode? page: the one-time code WDJB-MJHT, the device's name, system, SageCode version, IP address and request time, and Deny and Approve buttons
  3. Check the code matches the one in your terminal, then click Approve.

  4. Back in your terminal, SageCode finishes on its own:

    ✓ Logged in to Autosage as you@example.com on my-laptop.

Your session is saved to your OS keychain, and it appears on your profile. See Sessions & Access Tokens.

Only approve a code you just started

Approving gives that device access to your account: it can manage your workflows, scripts, vault, triggers and runs as you. If you didn't just run sagex auth login, or the code doesn't match your terminal, click Deny.

A sign-in request is valid for 10 minutes. If it expires or is denied, run sagex auth login again for a new code.

On a server or over SSH​

On a machine with no browser, SageCode prints the link instead of opening it. It does this automatically over SSH and on Linux with no display, or whenever you pass --no-browser:

sagex auth login --no-browser

Open the link on any device, such as your laptop or phone, and approve it there. You can also go to autosagex.web.app/cli-auth and type the code in.

In CI and scripts​

Pipelines can't approve anything in a browser. Create an access token on your profile and give it to SageCode through the SAGEX_API_KEY environment variable, or save it to a machine's keychain with sagex auth login --with-token. See Access tokens for CI and the CI/CD guide.

Check who you're signed in as​

❯ sagex auth status
✓ Logged in to Autosage as you@example.com
Device session: my-laptop · sgx_…VphY
Activity: 12 commands · 3 runs started
Manage your sessions: https://autosagex.web.app/profile#sagecode

auth status checks the session with AutoSage each time, so it also tells you if the session has expired or been revoked.

Sign out​

sagex auth logout

This signs the machine's session out on the AutoSage side and removes it from your keychain. If the saved credential is an access token, logout only removes it from the keychain: the token keeps working (a CI job may share it) until you revoke it on your profile.

Next: open the terminal app​

Run sagex on its own to open the terminal app, and type a question without ! to ask Sage, the AutoSage assistant.

Update or uninstall​

Upgrade with the same tool you installed with:

uv tool upgrade sagex-cli # or: pipx upgrade sagex-cli · pip install -U sagex-cli

To uninstall, sign out first so the session is ended and removed from your keychain, then remove the tool:

sagex auth logout
uv tool uninstall sagex-cli