forked from i-am-bee/agentstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
52 lines (41 loc) · 2.75 KB
/
install.sh
File metadata and controls
52 lines (41 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
set -eu
# Configurable through env vars:
# AGENTSTACK_VERSION = latest (default, latest stable version) | pre (latest version including prereleases) | <version> (specific version)
# These get updated by `mise release`:
LATEST_STABLE_AGENTSTACK_VERSION=0.4.1
LATEST_AGENTSTACK_VERSION=0.4.1
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" || error
# Finish set up using CLI (install QEMU on Linux, start platform, set up API keys, run UI, ...)
agentstack self install