Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Script to Automate Setup in Windows #209

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions setup.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
@echo off
REM Clear the screen for a fresh start
cls

REM Display welcome message
echo =============================================
echo Agent Zero Setup and Execution
echo =============================================

:: Check if Python is installed
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo Python is not installed. Downloading Python...
curl -o python-installer.exe https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe
start /wait python-installer.exe /quiet InstallAllUsers=1 PrependPath=1
if %errorlevel% neq 0 (
echo Python installation failed. Exiting.
exit /b 1
)
)

:: Docker Installation
:check_docker_installed
where docker >nul 2>&1
if %errorlevel%==0 (
echo Docker is already installed.
goto end
) else (
where choco >nul 2>&1
if %errorlevel%==0 (
echo Installing Docker using Chocolatey...
choco install docker-desktop -y
) else (
echo Installing Chocolatey...
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
echo Installing Docker using Chocolatey...
choco install docker-desktop -y
)
echo Docker installed
)

:end
echo Done!

REM Set up Python virtual environment
echo Creating Python virtual environment...
python -m venv .venv
IF %ERRORLEVEL% NEQ 0 (
echo Failed to create virtual environment. Exiting...
exit /b
)

REM Activate Python virtual environment
echo Activating Python virtual environment...
call .venv\Scripts\activate
IF %ERRORLEVEL% NEQ 0 (
echo Failed to activate virtual environment. Exiting...
exit /b
)

REM Install required Python packages
echo Installing required Python packages...
pip install -r requirements.txt
IF %ERRORLEVEL% NEQ 0 (
echo Failed to install Python packages. Please check your setup.
exit /b
)

REM Navigate to bundle directory
echo Setting up bundle environment...
cd bundle
REM Check for platform and run respective bundle script
IF "%OS%"=="Windows_NT" (
echo Running Windows bundle script...
call windows_bundle.bat
) ELSE (
echo Running MacOS bundle script...
sh macos_bundle.sh
)

REM Return to main directory
cd..

REM Display success message for setup
echo Setup complete.
REM Provide user options to run either CLI or UI mode
echo.
echo =============================================
echo Choose an option to run Agent Zero:
echo 1. Run CLI
echo 2. Run UI
echo =============================================
set /p option="Enter 1 or 2: "
IF "%option%"=="1" (
echo Running Agent Zero in CLI mode...
echo Configure API Keys by: Duplicating example.env, renaming it to .env, and adding your API keys. Then run again by executing setup.bat or by using the command: python run_cli.py.
python run_cli.py
exit /b
) ELSE IF "%option%"=="2" (
echo Running Agent Zero in UI mode...
python run_ui.py
exit /b
) ELSE (
echo Invalid option selected. Exiting...
exit /b
)