Skip to content

Agent Zero AI framework

x86 build fix + build cleanup

frdel8edcb957b930
diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile
index 14febd005..7e94ed80a 100644
--- a/docker/base/Dockerfile
+++ b/docker/base/Dockerfile
@@ -33,5 +33,8 @@ RUN bash /ins/install_searxng.sh
# configure ssh
RUN bash /ins/configure_ssh.sh
+# after install
+RUN bash /ins/after_install.sh
+
# Keep container running infinitely
CMD ["tail", "-f", "/dev/null"]
diff --git a/docker/base/fs/ins/after_install.sh b/docker/base/fs/ins/after_install.sh
new file mode 100644
index 000000000..ca2028add
--- /dev/null
+++ b/docker/base/fs/ins/after_install.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+set -e
+
+# clean up apt cache
+sudo apt-get clean
diff --git a/docker/base/fs/ins/configure_ssh.sh b/docker/base/fs/ins/configure_ssh.sh
index 972531910..da89272e6 100644
--- a/docker/base/fs/ins/configure_ssh.sh
+++ b/docker/base/fs/ins/configure_ssh.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
# Set up SSH
mkdir -p /var/run/sshd && \
diff --git a/docker/base/fs/ins/install_python.sh b/docker/base/fs/ins/install_python.sh
index 94bc6d995..5a2c6f54b 100644
--- a/docker/base/fs/ins/install_python.sh
+++ b/docker/base/fs/ins/install_python.sh
@@ -44,13 +44,19 @@ python3.12 -m venv /opt/venv
source /opt/venv/bin/activate
# upgrade pip and install static packages
-pip install --upgrade pip ipython requests
+pip install --no-cache-dir --upgrade pip ipython requests
# Install some packages in specific variants
-pip install torch --index-url https://download.pytorch.org/whl/cpu
-
+pip install --no-cache-dir \
+ torch==2.4.0+cpu \
+ torchvision==0.19.0+cpu \
+ torchaudio==2.4.0+cpu \
+ --index-url https://download.pytorch.org/whl/cpu
echo "====================PYTHON UV ===================="
curl -Ls https://astral.sh/uv/install.sh | UV_INSTALL_DIR=/usr/local/bin sh
+# clean up pip cache
+pip cache purge
+
echo "====================PYTHON END===================="
diff --git a/docker/base/fs/ins/install_searxng.sh b/docker/base/fs/ins/install_searxng.sh
index f107b9191..a20f113de 100644
--- a/docker/base/fs/ins/install_searxng.sh
+++ b/docker/base/fs/ins/install_searxng.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
echo "====================SEARXNG1 START===================="
diff --git a/docker/base/fs/ins/install_searxng2.sh b/docker/base/fs/ins/install_searxng2.sh
index 09d54e545..5af4f2c9c 100644
--- a/docker/base/fs/ins/install_searxng2.sh
+++ b/docker/base/fs/ins/install_searxng2.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
echo "====================SEARXNG2 START===================="
@@ -22,14 +23,11 @@ source "/usr/local/searxng/searx-pyenv/bin/activate"
echo "====================SEARXNG2 INST===================="
# update pip's boilerplate
-pip install -U pip
-pip install -U setuptools
-pip install -U wheel
-pip install -U pyyaml
+pip install --no-cache-dir -U pip setuptools wheel pyyaml
# jump to SearXNG's working tree and install SearXNG into virtualenv
cd "/usr/local/searxng/searxng-src"
-pip install --use-pep517 --no-build-isolation -e .
+pip install --no-cache-dir --use-pep517 --no-build-isolation -e .
# cleanup cache
pip cache purge
diff --git a/docker/run/Dockerfile.cuda b/docker/run/Dockerfile.cuda
deleted file mode 100644
index 5823c6359..000000000
--- a/docker/run/Dockerfile.cuda
+++ /dev/null
@@ -1,159 +0,0 @@
-# Use the NVIDIA CUDA base image with Ubuntu
-FROM nvidia/cuda:12.8.1-base-ubuntu22.04
-
-# Set non-interactive installation and timezone
-ENV DEBIAN_FRONTEND=noninteractive
-ENV TZ=UTC
-
-# Check if the argument is provided, else throw an error
-ARG BRANCH
-RUN if [ -z "$BRANCH" ]; then echo "ERROR: BRANCH is not set!" >&2; exit 1; fi
-ENV BRANCH=$BRANCH
-
-# Set locale to en_US.UTF-8 and timezone to UTC (matching main Dockerfile)
-RUN apt-get update && apt-get install -y locales tzdata
-RUN sed -i -e 's/# \(en_US\.UTF-8 .*\)/\1/' /etc/locale.gen && \
- dpkg-reconfigure --frontend=noninteractive locales && \
- update-locale LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
-RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime
-RUN echo "UTC" > /etc/timezone
-RUN dpkg-reconfigure -f noninteractive tzdata
-ENV LANG=en_US.UTF-8
-ENV LANGUAGE=en_US:en
-ENV LC_ALL=en_US.UTF-8
-ENV TZ=UTC
-
-# Copy contents of the project to root directory
-COPY ./fs/ /
-
-# Fix permissions for cron files from pre_install.sh
-RUN chmod 0644 /etc/cron.d/*
-
-# Install essential packages (from pre_install.sh but avoiding supervisor from apt)
-# Node.js and npm will be installed separately using NodeSource for a specific version
-RUN apt-get update && apt-get upgrade -y && apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -y \
- python3 \
- python3-venv \
- python3-pip \
- openssh-server \
- sudo \
- curl \
- wget \
- git \
- ffmpeg \
- cron
-
-# Install Node.js 20.x (LTS) and a compatible npm
-RUN apt-get update && apt-get install -y ca-certificates curl gnupg
-RUN mkdir -p /etc/apt/keyrings
-RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
-RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
-RUN apt-get update && apt-get install -y nodejs || { echo "CRITICAL ERROR: Failed to install Node.js from NodeSource." ; exit 1; }
-
-# Prepare SSH daemon (from pre_install.sh)
-RUN bash /ins/setup_ssh.sh $BRANCH
-
-# Configure Python 3.12 (specific to Ubuntu-based CUDA image)
-RUN apt-get update && apt-get install -y \
- software-properties-common && \
- add-apt-repository -y ppa:deadsnakes/ppa && \
- apt-get update && \
- apt-get install -y python3.12 python3.12-venv python3.12-dev && \
- update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 && \
- update-alternatives --set python3 /usr/bin/python3.12
-
-# Bootstrap pip for Python 3.12 and install supervisor
-RUN python3 -m ensurepip --upgrade && \
- python3 -m pip install --upgrade pip setuptools wheel && \
- python3 -m pip install supervisor
-
-# Create supervisor directories
-RUN mkdir -p /var/log/supervisor /etc/supervisor/conf.d
-
-# Create root dotfiles with appropriate permissions
-RUN touch /root/.bashrc /root/.profile && \
- chmod 644 /root/.bashrc /root/.profile
-
-# Create a symlink for supervisord to the expected location
-RUN ln -sf $(which supervisord) /usr/bin/supervisord
-
-# Install additional software
-RUN bash /ins/install_additional.sh $BRANCH
-
-# Install core CUDA dependencies (minimized to essentials)
-RUN apt-get update && apt-get install -y --no-install-recommends \
- cuda-cudart-dev-12-8 \
- libcublas-dev-12-8 \
- libcudnn8 \
- && apt-get clean \
- && rm -rf /var/lib/apt/lists/*
-
-# Set CUDA environment variables
-ENV PATH=/usr/local/cuda/bin:${PATH}
-ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
-ENV CUDA_HOME=/usr/local/cuda
-ENV CUDA_VERSION=12.8.1
-
-# Install A0
-RUN bash /ins/install_A0.sh $BRANCH
-
-# Create and set up the shared instruments virtual environment
-ENV INSTRUMENTS_VENV_PATH=/opt/instruments_venv
-RUN python3 -m venv $INSTRUMENTS_VENV_PATH
-
-# Switch to bash for the next RUN step (required for set -o pipefail)
-SHELL ["/bin/bash", "-c"]
-
-# Install all heavy dependencies into the instruments venv, with explicit checks
-RUN set -euxo pipefail; \
- . $INSTRUMENTS_VENV_PATH/bin/activate; \
- echo "=== Upgrading pip, setuptools, wheel ==="; \
- pip install --upgrade pip setuptools wheel; \
- echo "=== Installing PyTorch with CUDA ==="; \
- pip install --no-cache-dir torch==2.6.0+cu124 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124; \
- echo "=== Installing other heavy dependencies ==="; \
- pip install --no-cache-dir \
- huggingface-hub==0.20.3 \
- safetensors==0.4.1 \
- accelerate==0.21.0 \
- diffusers==0.25.0 \
- transformers==4.38.2 \
- scipy==1.15.2 \
- xformers==0.0.29.post3; \
- echo "=== Checking all critical imports ==="; \
- python -c "import torch; print(f'PyTorch {torch.__version__} imported successfully. CUDA: {getattr(torch, 'cuda', None) and torch.cuda.is_available()}')" || (echo 'PyTorch import failed!' && exit 1); \
- python -c "import torchvision; print(f'Torchvision {torchvision.__version__} imported successfully.')" || (echo 'Torchvision import failed!' && exit 1); \
- python -c "import torchaudio; print(f'Torchaudio {torchaudio.__version__} imported successfully.')" || (echo 'Torchaudio import failed!' && exit 1); \
- python -c "import diffusers; print(f'Diffusers {diffusers.__version__} imported successfully.')" || (echo 'Diffusers import failed!' && exit 1); \
- python -c "import transformers; print(f'Transformers {transformers.__version__} imported successfully.')" || (echo 'Transformers import failed!' && exit 1); \
- python -c "import xformers; print(f'Xformers {xformers.__version__} imported successfully.')" || (echo 'Xformers import failed!' && exit 1); \
- python -c "import accelerate; print(f'Accelerate {accelerate.__version__} imported successfully.')" || (echo 'Accelerate import failed!' && exit 1); \
- python -c "import safetensors; print(f'Safetensors {safetensors.__version__} imported successfully.')" || (echo 'Safetensors import failed!' && exit 1); \
- python -c "import scipy; print(f'Scipy {scipy.__version__} imported successfully.')" || (echo 'Scipy import failed!' && exit 1); \
- python -c "import huggingface_hub; print(f'Huggingface_hub {huggingface_hub.__version__} imported successfully.')" || (echo 'Huggingface_hub import failed!' && exit 1); \
- echo "=== All critical imports succeeded ==="
-
-# Optionally revert to sh for subsequent steps if needed
-SHELL ["/bin/sh", "-c"]
-
-# The existing global PyTorch install for /opt/venv (A0's main venv) is below.
-# It might be used by other core A0 components, so we keep it.
-# Our instruments will use the dedicated $INSTRUMENTS_VENV_PATH.
-RUN . /opt/venv/bin/activate && \
- pip uninstall -y torch torchvision && \
- pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cu124
-
-# Cleanup repo and install A0 without caching, this speeds up builds
-ARG CACHE_DATE=none
-RUN echo "cache buster $CACHE_DATE" && bash /ins/install_A02.sh $BRANCH
-
-# Post installation steps
-RUN bash /ins/post_install.sh $BRANCH
-
-# Expose ports
-EXPOSE 22 80
-
-RUN chmod +x /exe/initialize.sh /exe/run_A0.sh /exe/run_searxng.sh
-
-# Initialize runtime
-CMD ["/exe/initialize.sh", "$BRANCH"]
diff --git a/docker/run/docker-compose.cuda.yml b/docker/run/docker-compose.cuda.yml
deleted file mode 100644
index 2f3d7754b..000000000
--- a/docker/run/docker-compose.cuda.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-services:
- agent-zero-cuda:
- container_name: agent-zero-cuda
- image: frdel/agent-zero-run-cuda:testing
- volumes:
- - ./agent-zero:/a0
- - ./agent-zero/work_dir:/root
- ports:
- - "50080:80"
- environment:
- - NVIDIA_VISIBLE_DEVICES=all
- - NVIDIA_DRIVER_CAPABILITIES=compute,utility
- - PYTHONUNBUFFERED=1
- deploy:
- resources:
- reservations:
- devices:
- - driver: nvidia
- count: all
- capabilities: [gpu]
\ No newline at end of file
diff --git a/docker/run/fs/etc/searxng/settings.yml b/docker/run/fs/etc/searxng/settings.yml
index 61ddae77f..7e6eb506b 100644
--- a/docker/run/fs/etc/searxng/settings.yml
+++ b/docker/run/fs/etc/searxng/settings.yml
@@ -58,6 +58,10 @@ enabled_plugins:
# - '(.*\.)?wikipedia.org$'
engines:
+ - name: radio_browser
+ disabled: true
+# TODO enable radio_browser when it works again
+# currently it crashes on x86 on gethostbyaddr
# - name: fdroid
# disabled: false
diff --git a/docker/run/fs/ins/copy_A0.sh b/docker/run/fs/ins/copy_A0.sh
index cbdc5c750..0e5a36321 100644
--- a/docker/run/fs/ins/copy_A0.sh
+++ b/docker/run/fs/ins/copy_A0.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
# Paths
SOURCE_DIR="/git/agent-zero"
diff --git a/docker/run/fs/ins/install_A0.sh b/docker/run/fs/ins/install_A0.sh
index a2e8a0f67..d1bc1f41d 100644
--- a/docker/run/fs/ins/install_A0.sh
+++ b/docker/run/fs/ins/install_A0.sh
@@ -24,22 +24,9 @@ git clone -b "$BRANCH" "https://github.com/frdel/agent-zero" "/git/agent-zero" |
# # Install some packages in specific variants
# pip install torch --index-url https://download.pytorch.org/whl/cpu
-uv pip install -v mcp==1.3.0 || {
- echo "ERROR: Failed during separate attempt to install mcp==1.3.0. Will proceed to full requirements.txt install anyway."
-}
-python -c "import mcp; from mcp import ClientSession; print(f'DEBUG: mcp and mcp.ClientSession imported successfully after separate install. mcp path: {mcp.__file__}')" || {
- echo "ERROR: mcp package or mcp.ClientSession NOT importable after separate mcp==1.3.0 installation attempt. Full requirements.txt will run next."
-}
-
# Install remaining A0 python packages
uv pip install -r /git/agent-zero/requirements.txt
-uv pip install langchain-anthropic==0.3.15 # TODO: remove after browser-use update
-
-python -c "import mcp; from mcp import ClientSession; print(f'DEBUG: mcp and mcp.ClientSession imported successfully after requirements.txt. mcp path: {mcp.__file__}')" || {
- echo "CRITICAL ERROR: mcp package or mcp.ClientSession not found or failed to import after requirements.txt processing."
-}
-
# install playwright
bash /ins/install_playwright.sh "$@"
diff --git a/docker/run/fs/ins/install_A02.sh b/docker/run/fs/ins/install_A02.sh
index a04f796b3..66147ac17 100644
--- a/docker/run/fs/ins/install_A02.sh
+++ b/docker/run/fs/ins/install_A02.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
# cachebuster script, this helps speed up docker builds
diff --git a/docker/run/fs/ins/install_additional.sh b/docker/run/fs/ins/install_additional.sh
index 53e78c43e..2f9a98221 100644
--- a/docker/run/fs/ins/install_additional.sh
+++ b/docker/run/fs/ins/install_additional.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
# install playwright - moved to install A0
# bash /ins/install_playwright.sh "$@"
diff --git a/docker/run/fs/ins/install_playwright.sh b/docker/run/fs/ins/install_playwright.sh
index 3c9b9eb1d..43a2b3bfe 100644
--- a/docker/run/fs/ins/install_playwright.sh
+++ b/docker/run/fs/ins/install_playwright.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
# activate venv
. "/ins/setup_venv.sh" "$@"
@@ -10,11 +11,5 @@ uv pip install playwright
export PLAYWRIGHT_BROWSERS_PATH=/a0/tmp/playwright
# install chromium with dependencies
-# for kali-based
-# if [ "$@" = "hacking" ]; then
- apt-get install -y fonts-unifont libnss3 libnspr4 libatk1.0-0 libatspi2.0-0 libxcomposite1 libxdamage1 libatk-bridge2.0-0 libcups2
- playwright install chromium --only-shell
-# else
-# # for debian based
-# playwright install --with-deps chromium
-# fi
+apt-get install -y fonts-unifont libnss3 libnspr4 libatk1.0-0 libatspi2.0-0 libxcomposite1 libxdamage1 libatk-bridge2.0-0 libcups2
+playwright install chromium --only-shell
diff --git a/docker/run/fs/ins/post_install.sh b/docker/run/fs/ins/post_install.sh
index 410ff19a7..2e3cad46a 100644
--- a/docker/run/fs/ins/post_install.sh
+++ b/docker/run/fs/ins/post_install.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
# Cleanup package list
rm -rf /var/lib/apt/lists/*
diff --git a/docker/run/fs/ins/pre_install.sh b/docker/run/fs/ins/pre_install.sh
index 3ba865e55..f1644c986 100644
--- a/docker/run/fs/ins/pre_install.sh
+++ b/docker/run/fs/ins/pre_install.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
# fix permissions for cron files
chmod 0644 /etc/cron.d/*
diff --git a/docker/run/fs/ins/setup_ssh.sh b/docker/run/fs/ins/setup_ssh.sh
index 331e905fc..a55719a67 100644
--- a/docker/run/fs/ins/setup_ssh.sh
+++ b/docker/run/fs/ins/setup_ssh.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
# Set up SSH
mkdir -p /var/run/sshd && \
diff --git a/docker/run/fs/ins/setup_venv.sh b/docker/run/fs/ins/setup_venv.sh
index bbeeb0fd2..a0fdb8727 100644
--- a/docker/run/fs/ins/setup_venv.sh
+++ b/docker/run/fs/ins/setup_venv.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+set -e
# this has to be ready from base image
# if [ ! -d /opt/venv ]; then