#!/bin/sh set -eu # Configurable through env vars: # AGENTSTACK_VERSION = latest (default, latest stable version) | pre (latest version including prereleases) | (specific version) # These get updated by `mise release`: LATEST_STABLE_AGENTSTACK_VERSION=0.4.3 LATEST_AGENTSTACK_VERSION=0.4.3 error() { printf "\nšŸ’„ \033[31mERROR:\033[0m: Agent Stack installation has failed. Please report the above error: https://github.com/i-am-bee/agentstack/issues\n" >&2 exit 1 } echo "Starting the Agent Stack installer..." # Check if this is WSL (not supported) if [ -n "${WSL_DISTRO_NAME-}" ] || (uname -r | grep -q -i "microsoft"); then printf "\nšŸ’„ \033[31mERROR:\033[0m: Agent Stack CLI is not supported on WSL. Please follow the Windows installation instructions to install in PowerShell instead.\n" >&2 exit 1 fi #Ā Ensure that we have uv on PATH export PATH="${XDG_BIN_HOME:+${XDG_BIN_HOME}:}${XDG_DATA_HOME:+$(realpath -m ${XDG_DATA_HOME}/../bin):}${HOME:+${HOME}/.local/bin:}$PATH" # Always install uv to ensure we have the latest version for consistency echo "Installing uv..." curl -LsSf https://astral.sh/uv/install.sh | UV_PRINT_QUIET=1 sh || error # Install a uv-managed Python version (uv should do that automatically but better be explicit) # --no-bin to avoid putting it in PATH (not necessary) echo "Installing Python..." uv python install --quiet --python-preference=only-managed --no-bin 3.13 || error #Ā Separately uninstall potential old version of agentstack-cli (old name beeai-cli) to remove envs created with wrong Python versions # Also remove obsolete version from Homebrew and any local executables potentially left behind by Homebrew or old uv versions echo "Removing old versions..." uv tool uninstall --quiet agentstack-cli >/dev/null 2>&1 || true uv tool uninstall --quiet beeai-cli >/dev/null 2>&1 || true brew uninstall beeai >/dev/null 2>&1 || true while command -v beeai >/dev/null && rm $(command -v beeai); do true; done # Install agentstack-cli using a uv-managed Python version # We set the versions of agentstack-cli and agentstack-sdk to error out on platforms incompatible with the latest version # It also avoids accidentally installing prereleases of dependencies by only allowing explicitly set ones echo "Installing Agent Stack CLI..." case "${AGENTSTACK_VERSION:-latest}" in "latest") AGENTSTACK_VERSION=$LATEST_STABLE_AGENTSTACK_VERSION ;; "pre") AGENTSTACK_VERSION=$LATEST_AGENTSTACK_VERSION ;; esac uv tool install --quiet --python-preference=only-managed --python=3.13 --refresh --prerelease if-necessary-or-explicit --with "agentstack-sdk==$AGENTSTACK_VERSION" "agentstack-cli==$AGENTSTACK_VERSION" --force || error # Finish set up using CLI (install QEMU on Linux, start platform, set up API keys, run UI, ...) agentstack self install