AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(platform): self-host from the Docker Hub image, with a Windows installer (#14553)
Nicholas Tindle71de2f010470
diff --git a/.github/workflows/platform-installer-ci.yml b/.github/workflows/platform-installer-ci.ymlindex 07e0986c13..aad100cd49 100644--- a/.github/workflows/platform-installer-ci.yml+++ b/.github/workflows/platform-installer-ci.yml@@ -90,3 +90,27 @@ jobs:- name: Test macOS installer paths, ACLs, and mocked Docker handoff with system Bashrun: /bin/bash autogpt_platform/installer/test-single-container-handoff.sh++ windows:+ name: PowerShell installer (Windows)+ runs-on: windows-2025+ steps:+ - name: Check out repository+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ with:+ persist-credentials: false++ - name: Check that install.ps1 is ASCII+ shell: pwsh+ run: |+ # Windows PowerShell reads a script without a byte-order mark as ANSI.+ $bytes = [IO.File]::ReadAllBytes('autogpt_platform/installer/install.ps1')+ if (@($bytes | Where-Object { $_ -gt 127 }).Count -gt 0) { throw 'install.ps1 must be ASCII' }++ - name: Test paths, ACLs, bootstrap, and mocked Docker handoff with Windows PowerShell 5.1+ shell: cmd+ run: powershell.exe -NoProfile -ExecutionPolicy Bypass -File autogpt_platform\installer\test-windows-installer.ps1++ - name: Test paths, ACLs, bootstrap, and mocked Docker handoff with PowerShell 7+ shell: cmd+ run: pwsh.exe -NoProfile -File autogpt_platform\installer\test-windows-installer.ps1diff --git a/README.md b/README.mdindex 916c0d8b9e..fc81ac9f5c 100644--- a/README.md+++ b/README.md@@ -29,6 +29,9 @@<a href="https://discord.gg/autogpt"><img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fdiscord.com%2Fapi%2Fv10%2Finvites%2Fautogpt%3Fwith_counts%3Dtrue&query=%24.approximate_member_count&label=Discord&suffix=%20members&logo=discord&logoColor=white&color=5865F2" alt="Join the AutoGPT Discord community — member count" /></a>+ <a href="https://hub.docker.com/r/significantgravitas/autogpt">+ <img src="https://img.shields.io/docker/v/significantgravitas/autogpt?sort=semver&label=Docker%20Hub&color=2496ED&logo=docker&logoColor=white" alt="AutoGPT image on Docker Hub" />+ </a></p>## One conversation. The right expertise.@@ -80,14 +83,47 @@ The hosted Platform is a paid service. See [current plans, trial terms, and usagRun AutoGPT on your own infrastructure. You provide model credentials, configure the deployment, and manage its updates and operation.-Follow the [self-hosting guide](https://agpt.co/docs/platform/self-hosting/getting-started) for current requirements and supported installation paths. The [installer reference](docs/platform/installer.md) tracks appliance release availability; use the manual setup while its release gates are pending.+The quickest way to self-host is the single-container image on+Docker Hub, [`significantgravitas/autogpt`](https://hub.docker.com/r/significantgravitas/autogpt):++```bash+docker run -d \+ --name autogpt \+ --restart unless-stopped \+ --shm-size 2g \+ --ulimit nofile=65536:65536 \+ --log-driver json-file \+ --log-opt max-size=50m \+ --log-opt max-file=5 \+ -p 127.0.0.1:3000:3000 \+ -e AUTOGPT_PUBLIC_URL=http://localhost:3000 \+ -v autogpt-data:/data \+ significantgravitas/autogpt:latest+```++Give the first boot a few minutes, then open+[http://localhost:3000](http://localhost:3000), create your account, and make it+the administrator:++```bash+docker exec autogpt autogpt-admin promote [email protected]+```++Requirements, closing signup, ports, model providers, backups, and upgrades are+covered in the guide:++[Read the single-container guide →](https://agpt.co/docs/platform/self-hosting/single-container)++On Linux, macOS, and Windows, the [installer](https://agpt.co/docs/platform/self-hosting/installer#install)+sets up the same image with one command.-[Read the self-hosting guide →](https://agpt.co/docs/platform/self-hosting/getting-started)+To run each service in its own container with Docker Compose, or to develop from+source, use the [manual self-hosting guide](https://agpt.co/docs/platform/self-hosting/getting-started#manual-setup).| | Hosted Platform | Self-hosted || --- | --- | --- || Setup and operations | Managed by AutoGPT | Managed by you |-| Model access | Built in | Bring your own model credentials |+| Model access | Built in | Bring your own model credentials or a local model || Cost | Paid plan and usage | Your infrastructure and model usage || Data and infrastructure | Hosted by AutoGPT | Runs on your infrastructure |diff --git a/autogpt_platform/README.md b/autogpt_platform/README.mdindex 1b24a432ed..de43f207c8 100644--- a/autogpt_platform/README.md+++ b/autogpt_platform/README.md@@ -2,12 +2,15 @@Welcome to the AutoGPT Platform - a powerful system for creating and running AI agents to solve business problems. This platform enables you to harness the power of artificial intelligence to automate tasks, analyze data, and generate insights for your organization.+> **Just want to run AutoGPT?** The quickest way is the single-container image on Docker Hub, [`significantgravitas/autogpt`](https://hub.docker.com/r/significantgravitas/autogpt). See the [self-hosting guide](https://agpt.co/docs/platform/self-hosting/getting-started). The steps below build and run every service from this checkout with Docker Compose.+## Getting Started### Prerequisites- Docker- Docker Compose V2 (comes with Docker Desktop, or can be installed separately)+- `make` and Python 3 (used to generate your local secrets)### Running the System@@ -23,10 +26,12 @@ To run the AutoGPT Platform, follow these steps:2. Run the following command:```- cp .env.default .env+ make init-env```- This command will copy the `.env.default` file to `.env`. You can modify the `.env` file to add your own environment variables.+ This command copies each `.env.default` file to `.env` (in `autogpt_platform`, `backend` and `frontend`) where no `.env` exists yet, and generates the secrets those files leave blank: `ENCRYPTION_KEY`, `UNSUBSCRIBE_SECRET_KEY` and `BETTER_AUTH_SECRET`. The backend refuses to start without `ENCRYPTION_KEY`. It never overwrites an existing file or value, so it is safe to re-run. You can then modify the `.env` files to add your own environment variables.++ Without `make`, run `installer/setup-autogpt.sh` (Linux/macOS) or `installer\setup-autogpt.bat` (Windows) instead. They do the same and then start the services.3. Run the following command:@@ -46,10 +51,10 @@ You can now run the following to enable just the core services.# For helpmake help-# Run just Postgres + Redis + RabbitMQ+# Run the services the backend needs (Postgres, Redis, RabbitMQ, ClamAV, FalkorDB) and apply migrationsmake start-core-# Stop core services+# Stop every running service in the stackmake stop-core# View logs from core services@@ -77,7 +82,7 @@ Here are some useful Docker Compose commands for managing your AutoGPT Platform:- `docker compose stop`: Stop the running services without removing them.- `docker compose rm`: Remove stopped service containers.- `docker compose build`: Build or rebuild services.-- `docker compose down`: Stop and remove containers, networks, and volumes.+- `docker compose down`: Stop and remove containers and networks. Add `-v` to also delete the named volumes (workspace files, marketplace media, FalkorDB memory, and the ClamAV database); the database in `data/db/data` survives both.- `docker compose watch`: Watch for changes in your services and automatically update them.### Sample Scenarios@@ -87,29 +92,21 @@ Here are some common scenarios where you might use multiple Docker Compose comma1. Updating and restarting a specific service:```- docker compose build api_srv- docker compose up -d --no-deps api_srv+ docker compose build rest_server+ docker compose up -d --no-deps rest_server```- This rebuilds the `api_srv` service and restarts it without affecting other services.+ This rebuilds the `rest_server` service and restarts it without affecting other services.2. Viewing logs for troubleshooting:```- docker compose logs -f api_srv ws_srv- ```-- This shows and follows the logs for both `api_srv` and `ws_srv` services.--3. Scaling a service for increased load:-- ```- docker compose up -d --scale executor=3+ docker compose logs -f rest_server websocket_server```- This scales the `executor` service to 3 instances to handle increased load.+ This shows and follows the logs for both `rest_server` and `websocket_server` services.-4. Stopping the entire system for maintenance:+3. Stopping the entire system for maintenance:```docker compose stop@@ -123,7 +120,7 @@ Here are some common scenarios where you might use multiple Docker Compose commabuilds from source; without it `pull` tries to fetch them from a registrythey were never published to and fails.-5. Developing with live updates:+4. Developing with live updates:```docker compose watch@@ -131,7 +128,7 @@ Here are some common scenarios where you might use multiple Docker Compose commaThis watches for changes in your code and automatically updates the relevant services.-6. Checking the status of services:+5. Checking the status of services:```docker compose ps```@@ -141,31 +138,13 @@ These scenarios demonstrate how to use Docker Compose commands in combination to### Persisting Data-To persist data for PostgreSQL and Redis, you can modify the `docker-compose.yml` file to add volumes. Here's how:--1. Open the `docker-compose.yml` file in a text editor.-2. Add volume configurations for PostgreSQL and Redis services:-- ```yaml- services:- postgres:- # ... other configurations ...- volumes:- - postgres_data:/var/lib/postgresql/data-- redis:- # ... other configurations ...- volumes:- - redis_data:/data-- volumes:- postgres_data:- redis_data:- ```+Your data already persists across restarts:-3. Save the file and run `docker compose up -d` to apply the changes.+- PostgreSQL keeps its data in `autogpt_platform/data/db/data` on the host.+- Workspace files, marketplace media, and FalkorDB memory use the named volumes `workspace-data`, `store-media-data`, and `falkordb_data`.+- The three Redis nodes are a cache and are not persisted; do not add volumes to them.-This configuration will create named volumes for PostgreSQL and Redis, ensuring that your data persists across container restarts.+Back up `data/db/data` (with the stack stopped) together with your `.env` files: `backend/.env` holds the `ENCRYPTION_KEY` your stored integration credentials are encrypted with.### API Client Generationdiff --git a/autogpt_platform/db/docker/README.md b/autogpt_platform/db/docker/README.mdindex e4d43f75f5..dd8441b5ca 100644--- a/autogpt_platform/db/docker/README.md+++ b/autogpt_platform/db/docker/README.md@@ -1,8 +1,10 @@-# Retired Supabase stack+# Local database data-The platform uses PostgreSQL with pgvector and Better Auth. The bundled-Supabase Compose stack has been removed.--Existing database and storage directories remain ignored by Git. Follow the+Nothing in the platform reads this folder. Its `.gitignore` keeps database and+storage data under `volumes/` out of Git. If you have data there, follow the[upgrade instructions](../../../docs/platform/getting-started.md#upgrading-an-existing-supabase-based-installation)-before moving or deleting historical data.+before moving or deleting it.++The platform's database is the `db` service in+[`docker-compose.yml`](../../docker-compose.yml), set up by+[`db/init/00-init.sql`](../init/00-init.sql).diff --git a/autogpt_platform/installer/install.bat b/autogpt_platform/installer/install.batnew file mode 100644index 0000000000..4008a938b2--- /dev/null+++ b/autogpt_platform/installer/install.bat@@ -0,0 +1,12 @@+@echo off+setlocal+set "AUTOGPT_INSTALLER=%TEMP%\autogpt-install-%RANDOM%%RANDOM%%RANDOM%.ps1"+curl.exe --proto =https --proto-redir =https --tlsv1.2 -fsSL -o "%AUTOGPT_INSTALLER%" https://setup.agpt.co/install.ps1+if errorlevel 1 (+ del /f /q "%AUTOGPT_INSTALLER%" >nul 2>&1+ exit /b 1+)+powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%AUTOGPT_INSTALLER%" %*+set "AUTOGPT_INSTALLER_EXIT=%ERRORLEVEL%"+del /f /q "%AUTOGPT_INSTALLER%" >nul 2>&1+exit /b %AUTOGPT_INSTALLER_EXIT%diff --git a/autogpt_platform/installer/install.ps1 b/autogpt_platform/installer/install.ps1new file mode 100644index 0000000000..dab91010ef--- /dev/null+++ b/autogpt_platform/installer/install.ps1@@ -0,0 +1,811 @@+# AutoGPT Platform release installer for Windows.+#+# Docker Desktop must already be installed, running, and using Linux containers.+# Download to a unique temporary file and execute only after a successful fetch:+# & { $installer = Join-Path ([IO.Path]::GetTempPath()) "autogpt-install-$([guid]::NewGuid().ToString('N')).ps1"+# try { curl.exe --proto '=https' --proto-redir '=https' --tlsv1.2 -fsSL -o $installer https://setup.agpt.co/install.ps1+# if ($LASTEXITCODE -eq 0) { powershell.exe -NoProfile -ExecutionPolicy Bypass -File $installer } }+# finally { Remove-Item -LiteralPath $installer -Force -ErrorAction SilentlyContinue } }+#+# Runs on Windows PowerShell 5.1 and PowerShell 7. Keep this file ASCII:+# Windows PowerShell reads a script without a byte-order mark as ANSI.+Set-StrictMode -Version 2.0+$ErrorActionPreference = 'Stop'+$ScriptArgs = @($args)++$DeployImage = 'docker.io/significantgravitas/autogpt'+$ContainerName = 'autogpt'+$DataVolume = 'autogpt-platform-data'+$OwnerLabelKey = 'com.agpt.installer.owner'+$OwnerLabelValue = 'autogpt-platform-installer'+$ContractLabelKey = 'com.agpt.installer.contract'+$ContractLabelValue = '1'+$InstallIdLabelKey = 'com.agpt.installer.install-id'+$EnvHashLabelKey = 'com.agpt.installer.env-sha256'+$ExpectedTitle = 'AutoGPT Platform single-container'+$ExpectedSource = 'https://github.com/Significant-Gravitas/AutoGPT'+$MinRamGb = 8+$MinDiskGb = 25++$UserSid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value+$SystemSid = 'S-1-5-18'+$AdministratorsSid = 'S-1-5-32-544'+$TrustedInstallerSid = 'S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464'+$OwnerRightsSid = 'S-1-3-4'+# SYSTEM and Administrators play root's part: they can always reach the state.+$PrivateSids = @($UserSid, $SystemSid, $AdministratorsSid)+$TrustedSids = @($UserSid, $SystemSid, $AdministratorsSid, $TrustedInstallerSid, $OwnerRightsSid)+$OwnerSids = @($UserSid)+# What an elevated administrator creates can belong to the Administrators group+# instead (the default on Windows Server).+if (([System.Security.Principal.WindowsPrincipal][System.Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) {+ $OwnerSids += $AdministratorsSid+}+# Rights that let another principal delete, rename, re-permission, or take over+# an entry on the path. Rights that only create new entries are like a sticky+# directory's: they cannot replace what is already there.+$TamperRights = 0x40 -bor 0x10000 -bor 0x40000 -bor 0x80000 -bor 0x10000000++$CheckDirOnly = $false+$Release = ''+$SkipPreflight = $false+$PreflightOnly = $false+$ResolveOnly = $false+$VerRef = ''+$Image = ''+$ImageDigest = ''+$DaemonArch = ''+$DockerExe = ''+$InstallId = ''+$EnvFile = ''+$EnvHash = ''+$VolumeEstablished = $false++function Say([string]$Text) { Write-Host $Text }+function Info([string]$Text) { Write-Host " $Text" }+function Ok([string]$Text) {+ Write-Host ' ' -NoNewline+ Write-Host '[ OK ]' -ForegroundColor Green -NoNewline+ Write-Host " $Text"+}+function Warn([string]$Text) {+ Write-Host ' ' -NoNewline+ Write-Host '[WARN]' -ForegroundColor Yellow -NoNewline+ Write-Host " $Text"+}+function Step([string]$Text) {+ Write-Host ''+ Write-Host "==> $Text" -ForegroundColor Cyan+}+function Die([string]$Text) {+ [Console]::Error.WriteLine('')+ $color = -not [Console]::IsErrorRedirected+ if ($color) {+ $previous = [Console]::ForegroundColor+ [Console]::ForegroundColor = [ConsoleColor]::Red+ }+ [Console]::Error.WriteLine("Error: $Text")+ if ($color) { [Console]::ForegroundColor = $previous }+ exit 1+}++trap {+ [Console]::Error.WriteLine('')+ [Console]::Error.WriteLine("Error: $($_.Exception.Message)")+ exit 1+}++function Show-Help {+ Write-Host @'+AutoGPT Platform Installer (Windows)++Installs the published single-container appliance. Docker Desktop must be+running locally and configured for Linux containers.++Safe download and execution:+ & { $installer = Join-Path ([IO.Path]::GetTempPath()) "autogpt-install-$([guid]::NewGuid().ToString('N')).ps1"+ try { curl.exe --proto '=https' --proto-redir '=https' --tlsv1.2 -fsSL -o $installer https://setup.agpt.co/install.ps1+ if ($LASTEXITCODE -eq 0) { powershell.exe -NoProfile -ExecutionPolicy Bypass -File $installer } }+ finally { Remove-Item -LiteralPath $installer -Force -ErrorAction SilentlyContinue } }++Flags:+ -Release <tag> published vX.Y.Z image (default: latest)+ -Dir <path> private state directory (default: %LOCALAPPDATA%\AutoGPT)+ -SkipPreflight skip RAM and disk checks; Docker checks remain mandatory+ -PreflightOnly validate the machine and install nothing+ -ResolveOnly print the selected image and install nothing+ -Help+'@+ exit 0+}++function Get-FlagValue([string]$Flag, [object[]]$Values, [int]$Index) {+ if ($Index -ge $Values.Count -or [string]::IsNullOrEmpty([string]$Values[$Index])) {+ Die "$Flag needs a value (try -Help)"+ }+ $value = [string]$Values[$Index]+ if ($value.StartsWith('-')) { Die "$Flag needs a value, not another option: $value" }+ $value+}++$Dir = $env:LOCALAPPDATA+if ([string]::IsNullOrEmpty($Dir)) { $Dir = [Environment]::GetFolderPath('LocalApplicationData') }+$Dir = $Dir.TrimEnd('\') + '\AutoGPT'++for ($index = 0; $index -lt $ScriptArgs.Count; $index++) {+ $argument = [string]$ScriptArgs[$index]+ $flag = $argument.ToLowerInvariant()+ # Run inside a PowerShell session, -Name:value arrives as '-Name:' and 'value'.+ if ($flag -match '^-[a-z]+:$') { $flag = $flag.TrimEnd(':') }+ $inline = $null+ if ($argument -match '^(--[A-Za-z-]+)=(.*)$') {+ $flag = $Matches[1].ToLowerInvariant()+ $inline = $Matches[2]+ }+ if ($flag -eq '-release' -or $flag -eq '--release') {+ if ($null -eq $inline) {+ $Release = Get-FlagValue $argument $ScriptArgs ($index + 1)+ $index+++ } elseif ($inline -eq '') {+ Die '--release needs a non-empty value (try -Help)'+ } else {+ $Release = $inline+ }+ } elseif ($flag -eq '-dir' -or $flag -eq '--dir') {+ if ($null -eq $inline) {+ $Dir = Get-FlagValue $argument $ScriptArgs ($index + 1)+ $index+++ } else {+ $Dir = $inline+ }+ } elseif ($flag -eq '-skippreflight' -or $flag -eq '--skip-preflight') {+ $SkipPreflight = $true+ } elseif ($flag -eq '-preflightonly' -or $flag -eq '--preflight-only') {+ $PreflightOnly = $true+ } elseif ($flag -eq '-resolveonly' -or $flag -eq '--resolve-only') {+ $ResolveOnly = $true+ } elseif ($flag -eq '-checkdironly' -or $flag -eq '--check-dir-only') {+ $CheckDirOnly = $true+ } elseif ($flag -eq '-help' -or $flag -eq '--help' -or $flag -eq '-h') {+ Show-Help+ } else {+ Die "Unknown flag: $argument (try -Help)"+ }+}++if ([Environment]::OSVersion.Platform -ne [PlatformID]::Win32NT) {+ Die "Unsupported OS: $([Environment]::OSVersion.Platform). This release installer is for Windows; on Linux and macOS use https://setup.agpt.co/install.sh."+}+if ($PSVersionTable.PSVersion.Major -lt 5) {+ Die "Windows PowerShell 5.1 or PowerShell 7 is required; this is PowerShell $($PSVersionTable.PSVersion)."+}+$Arch = $env:PROCESSOR_ARCHITECTURE+if ($env:PROCESSOR_ARCHITEW6432) { $Arch = $env:PROCESSOR_ARCHITEW6432 }++function Get-ReleaseImage([string]$Tag) {+ if ($Tag -cmatch '^autogpt-platform-beta-v([0-9]+\.[0-9]+\.[0-9]+)$' -or $Tag -cmatch '^v([0-9]+\.[0-9]+\.[0-9]+)$') {+ return "${DeployImage}:v$($Matches[1])"+ }+ Die "Unsupported release tag: ${Tag}. Expected autogpt-platform-beta-vX.Y.Z or vX.Y.Z."+}++function Resolve-Release {+ if ($Release) {+ $script:VerRef = $Release+ $script:Image = Get-ReleaseImage $Release+ } else {+ $script:VerRef = 'latest'+ $script:Image = "${DeployImage}:latest"+ }+}++function Test-PathEntry([string]$Path) {+ try {+ [void][System.IO.File]::GetAttributes($Path)+ return $true+ } catch [System.IO.FileNotFoundException], [System.IO.DirectoryNotFoundException] {+ return $false+ }+}++function Test-ReparsePoint([string]$Path) {+ ([System.IO.File]::GetAttributes($Path) -band [System.IO.FileAttributes]::ReparsePoint) -ne 0+}++function Test-Directory([string]$Path) {+ ([System.IO.File]::GetAttributes($Path) -band [System.IO.FileAttributes]::Directory) -ne 0+}++# Owner and allow rules that apply to the entry itself, by SID.+function Get-PathSecurity([string]$Path) {+ try {+ $acl = Get-Acl -LiteralPath $Path+ } catch {+ Die "Could not read the permissions of ${Path}: $($_.Exception.Message)"+ }+ $owner = $acl.GetOwner([System.Security.Principal.SecurityIdentifier])+ $rules = @()+ foreach ($rule in $acl.GetAccessRules($true, $true, [System.Security.Principal.SecurityIdentifier])) {+ if ($rule.AccessControlType -ne [System.Security.AccessControl.AccessControlType]::Allow) { continue }+ if (($rule.PropagationFlags -band [System.Security.AccessControl.PropagationFlags]::InheritOnly) -ne 0) { continue }+ $rules += [pscustomobject]@{ Sid = $rule.IdentityReference.Value; Rights = [int]$rule.FileSystemRights }+ }+ [pscustomobject]@{+ Owner = $(if ($owner) { $owner.Value } else { '' })+ NullDacl = ($acl.GetSecurityDescriptorSddlForm('Access') -match 'D:NO_ACCESS_CONTROL')+ Rules = $rules+ }+}++function Assert-ExistingPath([string[]]$Paths) {+ foreach ($current in $Paths) {+ if (-not (Test-PathEntry $current)) { return }+ if (Test-ReparsePoint $current) { Die "Install directory contains a symlink or junction component: $current" }+ if (-not (Test-Directory $current)) { Die "Install directory component is not a directory: $current" }+ $security = Get-PathSecurity $current+ if ($TrustedSids -notcontains $security.Owner) { Die "Install directory ancestor is owned by an untrusted user: $current" }+ if ($security.NullDacl) { Die "Install directory ancestor grants everyone full access: $current" }+ foreach ($rule in $security.Rules) {+ if ($TrustedSids -notcontains $rule.Sid -and ($rule.Rights -band $TamperRights) -ne 0) {+ Die "Install directory ancestor is writable by another user or group: $current ($($rule.Sid))"+ }+ }+ }+}++function Assert-InstallDirectory {+ if ([string]::IsNullOrEmpty($script:Dir)) { Die 'Install directory cannot be empty.' }+ $requested = $script:Dir.Replace('/', '\')+ if (-not [System.IO.Path]::IsPathRooted($requested)) {+ $requested = (Get-Location -PSProvider FileSystem).ProviderPath.TrimEnd('\') + '\' + $requested+ }+ if ($requested.StartsWith('\\')) { Die "Refusing a network or device path for the install directory: $($script:Dir)" }+ if ($requested -notmatch '^[A-Za-z]:\\') {+ Die "Install directory must be a full path such as C:\AutoGPT, or relative to the current folder: $($script:Dir)"+ }+ if ($requested.Substring(2).Contains('\\')) { Die "Install directory contains redundant path separators: $($script:Dir)" }+ $rest = $requested.Substring(3)+ if ($rest.EndsWith('\')) { $rest = $rest.Substring(0, $rest.Length - 1) }+ $drive = $requested.Substring(0, 1).ToUpperInvariant() + ':\'+ $driveType = (New-Object System.IO.DriveInfo ($drive.Substring(0, 1))).DriveType+ if ($driveType -eq [System.IO.DriveType]::Network) { Die "Refusing a network or device path for the install directory: $($script:Dir)" }+ if ($driveType -eq [System.IO.DriveType]::NoRootDirectory) { Die "Install directory drive does not exist: $drive" }+ $components = @()+ if ($rest) { $components = @($rest.Split([char]'\')) }+ foreach ($component in $components) {+ if ($component -eq '.') { Die "Install directory contains an unsafe '.' component: $($script:Dir)" }+ if ($component -eq '..') { Die "Install directory contains an unsafe '..' component: $($script:Dir)" }+ # Windows drops a trailing dot or space, a colon names a stream, and NAME~1+ # can be a short alias of another folder.+ if ($component -match '[<>:"|?*\x00-\x1f]' -or $component -match '[ .]$' -or $component -match '~[0-9]') {+ Die "Install directory contains an unsupported component: $component"+ }+ }+ $requested = $drive + ($components -join '\')++ $paths = @($drive)+ $current = $drive.TrimEnd('\')+ foreach ($component in $components) {+ $current = "$current\$component"+ $paths += $current+ }+ Assert-ExistingPath $paths++ $broad = @($drive)+ foreach ($name in 'SystemRoot', 'ProgramFiles', 'ProgramFiles(x86)', 'ProgramW6432', 'ProgramData', 'PUBLIC', 'USERPROFILE', 'APPDATA', 'LOCALAPPDATA', 'TEMP', 'TMP') {+ $value = [Environment]::GetEnvironmentVariable($name)+ if ($value) { $broad += $value }+ }+ if ($env:USERPROFILE) { $broad += (Split-Path -Parent $env:USERPROFILE) }+ foreach ($candidate in $broad) {+ if ([string]::Equals($requested.TrimEnd('\'), $candidate.Replace('/', '\').TrimEnd('\'), [StringComparison]::OrdinalIgnoreCase)) {+ Die "Refusing broad or system install directory: $requested"+ }+ }++ if (Test-PathEntry $requested) {+ if (Test-ReparsePoint $requested) { Die "Install directory is a symlink or junction: $requested" }+ if (-not (Test-Directory $requested)) { Die "Install directory is not a directory: $requested" }+ $security = Get-PathSecurity $requested+ if ($OwnerSids -notcontains $security.Owner) { Die "Install directory is not owned by the current user: $requested" }+ if ($security.NullDacl) { Die "Install directory grants everyone full access: $requested" }+ foreach ($rule in $security.Rules) {+ if ($PrivateSids -notcontains $rule.Sid) {+ Die "Install directory is accessible by another user or group: $requested ($($rule.Sid))"+ }+ }+ }+ $script:Dir = $requested+}++function New-PrivateSecurity([switch]$Directory) {+ if ($Directory) {+ $security = New-Object System.Security.AccessControl.DirectorySecurity+ $inheritance = [System.Security.AccessControl.InheritanceFlags]'ContainerInherit, ObjectInherit'+ } else {+ $security = New-Object System.Security.AccessControl.FileSecurity+ $inheritance = [System.Security.AccessControl.InheritanceFlags]::None+ }+ $security.SetAccessRuleProtection($true, $false)+ $identity = New-Object System.Security.Principal.SecurityIdentifier $UserSid+ # An elevated run would otherwise leave Administrators as the owner on+ # Windows Server, and a later standard-user rerun would refuse the state.+ $security.SetOwner($identity)+ $rule = New-Object System.Security.AccessControl.FileSystemAccessRule(+ $identity,+ [System.Security.AccessControl.FileSystemRights]::FullControl,+ $inheritance,+ [System.Security.AccessControl.PropagationFlags]::None,+ [System.Security.AccessControl.AccessControlType]::Allow)+ $security.AddAccessRule($rule)+ $security+}++# Equivalent of chmod 0600/0700: a protected ACL that grants only this user.+function Set-PrivateAcl([string]$Path, [switch]$Directory) {+ $security = New-PrivateSecurity -Directory:$Directory+ if ($Directory) { $info = New-Object System.IO.DirectoryInfo $Path } else { $info = New-Object System.IO.FileInfo $Path }+ if ($info.PSObject.Methods['SetAccessControl']) {+ $info.SetAccessControl($security)+ } else {+ [System.IO.FileSystemAclExtensions]::SetAccessControl($info, $security)+ }+}++# Creates the directory with its private ACL in one step, like mkdir under umask 077.+function New-PrivateDirectory([string]$Path) {+ $security = New-PrivateSecurity -Directory+ if ([System.IO.Directory].GetMethod('CreateDirectory', [type[]]@([string], [System.Security.AccessControl.DirectorySecurity]))) {+ [void][System.IO.Directory]::CreateDirectory($Path, $security)+ } else {+ [void][System.IO.FileSystemAclExtensions]::Create((New-Object System.IO.DirectoryInfo $Path), $security)+ }+}++function Initialize-InstallDirectory {+ Assert-InstallDirectory+ if (Test-PathEntry $script:Dir) { return }+ $current = ''+ $created = $false+ foreach ($component in $script:Dir.Split([char]'\')) {+ if ($current) { $current = "$current\$component" } else { $current = $component }+ if ($current.Length -le 2) { continue }+ if (Test-PathEntry $current) {+ if ((Test-ReparsePoint $current) -or -not (Test-Directory $current)) {+ Die "Install directory changed during setup: $current"+ }+ continue+ }+ try {+ New-PrivateDirectory $current+ } catch {+ if (Test-PathEntry $current) { Die "Install directory changed during setup; refusing to reuse it: $current" }+ Die "Could not create the install directory ${current}: $($_.Exception.Message)"+ }+ $created = $true+ }+ if (-not $created) { Die "Install directory was not created safely: $($script:Dir)" }+ Assert-InstallDirectory+ Set-PrivateAcl $script:Dir -Directory+}++function Assert-PrivateFile([string]$File, [string]$Description) {+ if (-not (Test-PathEntry $File)) { Die "$Description is not a regular file: $File" }+ if (Test-ReparsePoint $File) { Die "Refusing symlink for ${Description}: $File" }+ if (Test-Directory $File) { Die "$Description is not a regular file: $File" }+ if ($OwnerSids -notcontains (Get-PathSecurity $File).Owner) { Die "$Description is not owned by the current user: $File" }+ if ((Get-Item -LiteralPath $File -Force).LinkType -eq 'HardLink') { Die "$Description has multiple hard links: $File" }+ Set-PrivateAcl $File+}++function Write-NewFile([string]$Path, [string]$Content) {+ $bytes = (New-Object System.Text.UTF8Encoding $false).GetBytes($Content)+ $stream = [System.IO.File]::Open($Path, [System.IO.FileMode]::CreateNew, [System.IO.FileAccess]::Write, [System.IO.FileShare]::None)+ try { $stream.Write($bytes, 0, $bytes.Length) } finally { $stream.Dispose() }+}++function Read-FileText([string]$Path) {+ [System.IO.File]::ReadAllText($Path).TrimEnd([char[]]@([char]13, [char]10))+}++function Initialize-State {+ $idFile = Join-Path $script:Dir 'install-id'+ $stateFile = Join-Path $script:Dir 'install-state'+ if (-not (Test-PathEntry $idFile)) {+ $bytes = New-Object byte[] 16+ $random = [System.Security.Cryptography.RandomNumberGenerator]::Create()+ try { $random.GetBytes($bytes) } finally { $random.Dispose() }+ try {+ Write-NewFile $idFile (($bytes | ForEach-Object { $_.ToString('x2') }) -join '')+ } catch {+ Die 'Could not create a private installer identity.'+ }+ }+ Assert-PrivateFile $idFile 'Installer identity'+ $script:InstallId = Read-FileText $idFile+ if ($script:InstallId -cnotmatch '^[0-9a-f]{32}$') { Die "Installer identity has invalid contents: $idFile" }+ if (Test-PathEntry $stateFile) {+ Assert-PrivateFile $stateFile 'Installer lifecycle state'+ if ((Read-FileText $stateFile) -cne "contract=1 lifecycle=established volume=$DataVolume install-id=$($script:InstallId)") {+ Die "Installer lifecycle state has invalid contents: $stateFile"+ }+ $script:VolumeEstablished = $true+ }+}++function Set-InstallEstablished {+ if ($script:VolumeEstablished) { return }+ $stateFile = Join-Path $script:Dir 'install-state'+ $tempFile = Join-Path $script:Dir ('.install-state.' + [guid]::NewGuid().ToString('N'))+ try {+ Write-NewFile $tempFile "contract=1 lifecycle=established volume=$DataVolume install-id=$($script:InstallId)`n"+ } catch {+ Remove-Item -LiteralPath $tempFile -Force -ErrorAction SilentlyContinue+ Die 'Could not write installer lifecycle state.'+ }+ if (Test-PathEntry $stateFile) {+ Remove-Item -LiteralPath $tempFile -Force -ErrorAction SilentlyContinue+ Die "Installer lifecycle state appeared during setup: $stateFile"+ }+ try {+ [System.IO.File]::Move($tempFile, $stateFile)+ } catch {+ Remove-Item -LiteralPath $tempFile -Force -ErrorAction SilentlyContinue+ Die 'Could not commit installer lifecycle state.'+ }+ Assert-PrivateFile $stateFile 'Installer lifecycle state'+ $script:VolumeEstablished = $true+}++function Initialize-Environment {+ $script:EnvFile = Join-Path $script:Dir 'autogpt.env'+ if (-not (Test-PathEntry $script:EnvFile)) {+ Write-NewFile $script:EnvFile "# Private runtime configuration for the AutoGPT appliance.`nAUTOGPT_PUBLIC_URL=http://localhost:3000`n"+ }+ Assert-PrivateFile $script:EnvFile 'Runtime configuration'+ $script:EnvHash = (Get-FileHash -LiteralPath $script:EnvFile -Algorithm SHA256).Hash.ToLowerInvariant()+ if ($script:EnvHash -cnotmatch '^[0-9a-f]{64}$') { Die 'Could not hash the runtime configuration.' }+ Ok "Private runtime configuration: $($script:EnvFile)"+}++function Invoke-Preflight {+ Step 'Hardware pre-flight checks'+ Info "Host OS: windows ($Arch); the selected Docker daemon is validated separately."+ $ramGb = 0+ try {+ $ramGb = [int][math]::Floor((Get-CimInstance -ClassName Win32_ComputerSystem).TotalPhysicalMemory / 1GB)+ } catch {+ $ramGb = 0+ }+ if ($ramGb -eq 0) { Warn 'Could not determine installed RAM.' }+ elseif ($ramGb -lt $MinRamGb) { Warn "Only $ramGb GB RAM; $MinRamGb GB or more is recommended." }+ else { Ok "$ramGb GB RAM" }++ $target = $script:Dir+ while ($target.Length -gt 3 -and -not (Test-PathEntry $target)) { $target = Split-Path -Parent $target }+ $freeGb = 0+ try {+ $freeGb = [int][math]::Floor((New-Object System.IO.DriveInfo ($target.Substring(0, 1))).AvailableFreeSpace / 1GB)+ } catch {+ $freeGb = 0+ }+ if ($freeGb -lt $MinDiskGb) {+ Warn "Only $freeGb GB free on the state filesystem. Docker may use another storage root; verify at least $MinDiskGb GB there."+ } else {+ Ok "$freeGb GB free on the state filesystem (Docker storage is validated by the image pull)"+ }+}++function ConvertTo-ApplianceArch([string]$Value) {+ if ($Value -ceq 'amd64' -or $Value -ceq 'x86_64') { return 'amd64' }+ if ($Value -ceq 'arm64' -or $Value -ceq 'aarch64') { return 'arm64' }+ ''+}++# Windows PowerShell 5.1 strips the double quotes inside arguments it passes to+# native programs, which breaks Go templates such as {{index .Config.Labels "x"}}.+# Quote each argument with the standard Windows rules instead.+function ConvertTo-NativeArgument([string]$Value) {+ if ($Value.Length -gt 0 -and $Value -notmatch '[\s"]') { return $Value }+ $builder = New-Object System.Text.StringBuilder+ [void]$builder.Append('"')+ $slashes = 0+ foreach ($char in $Value.ToCharArray()) {+ if ($char -eq [char]'\') {+ $slashes+++ continue+ }+ if ($char -eq [char]'"') {+ [void]$builder.Append([char]'\', 2 * $slashes + 1)+ } elseif ($slashes -gt 0) {+ [void]$builder.Append([char]'\', $slashes)+ }+ $slashes = 0+ [void]$builder.Append($char)+ }+ [void]$builder.Append([char]'\', 2 * $slashes)+ [void]$builder.Append('"')+ $builder.ToString()+}++function Invoke-DockerCapture([string[]]$Arguments) {+ $startInfo = New-Object System.Diagnostics.ProcessStartInfo+ $startInfo.FileName = $script:DockerExe+ $startInfo.Arguments = @($Arguments | ForEach-Object { ConvertTo-NativeArgument $_ }) -join ' '+ $startInfo.UseShellExecute = $false+ $startInfo.CreateNoWindow = $true+ $startInfo.RedirectStandardOutput = $true+ $startInfo.RedirectStandardError = $true+ $startInfo.StandardOutputEncoding = New-Object System.Text.UTF8Encoding $false+ $startInfo.StandardErrorEncoding = New-Object System.Text.UTF8Encoding $false+ $process = [System.Diagnostics.Process]::Start($startInfo)+ $output = $process.StandardOutput.ReadToEndAsync()+ $errors = $process.StandardError.ReadToEndAsync()+ $process.WaitForExit()+ [pscustomobject]@{+ ExitCode = $process.ExitCode+ Output = $output.Result.TrimEnd([char[]]@([char]13, [char]10))+ Errors = $errors.Result+ }+}++function Get-DockerValue([string[]]$Arguments, [string]$Failure) {+ $result = Invoke-DockerCapture $Arguments+ if ($result.ExitCode -ne 0) { Die $Failure }+ $result.Output+}++function Test-LocalPipeEndpoint([string]$Endpoint) {+ if (-not $Endpoint.StartsWith('npipe://', [StringComparison]::Ordinal)) { return $false }+ $Endpoint.Substring(8).Replace('/', '\') -cmatch '^\\\\\.\\pipe\\[^\\]+$'+}++function Assert-Docker {+ Step 'Validating the local Docker daemon'+ $command = Get-Command -Name docker -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1+ if (-not $command) {+ Die 'Docker is required. Install Docker Desktop from https://docs.docker.com/desktop/setup/install/windows-install/, start it, then retry.'+ }+ if ([System.IO.Path]::GetExtension($command.Source) -ne '.exe') {+ Die "The docker command must be docker.exe; found $($command.Source)."+ }+ $script:DockerExe = $command.Source+ if ($env:DOCKER_HOST) {+ $endpoint = $env:DOCKER_HOST+ } else {+ $context = Get-DockerValue @('context', 'show') 'Could not read the selected Docker context.'+ $endpoint = Get-DockerValue @('context', 'inspect', $context, '--format', '{{(index .Endpoints "docker").Host}}') 'Could not inspect the selected Docker context.'+ }+ if (-not (Test-LocalPipeEndpoint $endpoint)) {+ Die "Refusing non-local Docker endpoint: ${endpoint}. Select a local npipe:// context, such as Docker Desktop's desktop-linux."+ }+ if ((Invoke-DockerCapture @('info')).ExitCode -ne 0) {+ Die 'The local Docker daemon is not running or is not accessible. Start Docker Desktop and retry.'+ }+ $platform = @((Get-DockerValue @('info', '--format', '{{.OSType}} {{.Architecture}}') 'Could not inspect the Docker daemon platform.').Trim() -split '\s+')+ $daemonOs = $platform[0]+ $rawArch = ''+ if ($platform.Count -gt 1) { $rawArch = $platform[1] }+ if ($daemonOs -cne 'linux') {+ $mode = $daemonOs+ if (-not $mode) { $mode = 'an unknown mode' }+ Die "Docker is using $mode; switch Docker Desktop to Linux containers and retry."+ }+ $script:DaemonArch = ConvertTo-ApplianceArch $rawArch+ if (-not $script:DaemonArch) {+ if (-not $rawArch) { $rawArch = 'unknown' }+ Die "Unsupported Docker daemon architecture: ${rawArch}. Use amd64 or arm64."+ }+ Ok "Local Docker Linux daemon ($($script:DaemonArch))"+}++function Assert-Image {+ $title = Get-DockerValue @('image', 'inspect', '--format', '{{index .Config.Labels "org.opencontainers.image.title"}}', $script:Image) 'Could not inspect appliance image title.'+ $source = Get-DockerValue @('image', 'inspect', '--format', '{{index .Config.Labels "org.opencontainers.image.source"}}', $script:Image) 'Could not inspect appliance image source.'+ $revision = Get-DockerValue @('image', 'inspect', '--format', '{{index .Config.Labels "org.opencontainers.image.revision"}}', $script:Image) 'Could not inspect appliance image revision.'+ if ($title -cne $ExpectedTitle) { Die "Image $($script:Image) is not the AutoGPT appliance (unexpected OCI title)." }+ if ($source -cne $ExpectedSource) { Die "Image $($script:Image) is not from the expected AutoGPT source repository." }+ if ($revision -cnotmatch '^[0-9a-f]{40}$') { Die "Image $($script:Image) has an invalid source revision label." }+ $platform = @((Get-DockerValue @('image', 'inspect', '--format', '{{.Os}} {{.Architecture}}', $script:Image) 'Could not inspect appliance image platform.').Trim() -split '\s+')+ $imageOs = $platform[0]+ $rawArch = ''+ if ($platform.Count -gt 1) { $rawArch = $platform[1] }+ if ($imageOs -cne 'linux') { Die "Image $($script:Image) is not a Linux appliance image." }+ $imageArch = ConvertTo-ApplianceArch $rawArch+ if (-not $imageArch) {+ if (-not $rawArch) { $rawArch = 'unknown' }+ Die "Image $($script:Image) has unsupported architecture: ${rawArch}."+ }+ if ($imageArch -cne $script:DaemonArch) {+ Die "Image architecture $imageArch does not match Docker daemon architecture $($script:DaemonArch)."+ }++ $digestOutput = Get-DockerValue @('image', 'inspect', '--format', '{{range .RepoDigests}}{{println .}}{{end}}', $script:Image) 'Could not resolve the appliance repository digest.'+ $digests = @()+ foreach ($line in ($digestOutput -split "`n")) {+ $line = $line.TrimEnd([char]13)+ if (-not $line) { continue }+ if (-not ($line.StartsWith('docker.io/significantgravitas/autogpt@', [StringComparison]::Ordinal) -or $line.StartsWith('significantgravitas/autogpt@', [StringComparison]::Ordinal))) {+ Die "Image $($script:Image) resolved to an unexpected repository digest: $line"+ }+ $digest = $line.Substring($line.LastIndexOf('@') + 1)+ if ($digest -cnotmatch '^sha256:[0-9a-f]{64}$') { Die "Image $($script:Image) has an invalid repository digest." }+ $digests += $digest+ }+ $unique = @($digests | Sort-Object -Unique -CaseSensitive)+ if ($unique.Count -ne 1) {+ Die "Image $($script:Image) must resolve to exactly one native repository digest; found $($unique.Count)."+ }+ $script:ImageDigest = "$DeployImage@$($unique[0])"+ Ok "Appliance identity: $($script:ImageDigest)"+}++function Initialize-Image {+ Step "Pulling published appliance image: $($script:Image)"+ & $script:DockerExe pull $script:Image | Out-Host+ if ($LASTEXITCODE -ne 0) {+ Die "Published appliance image $($script:Image) is unavailable. Retry after publication completes or choose an existing -Release vX.Y.Z."+ }+ Assert-Image+}++function Assert-Volume {+ $format = "{{.Driver}} {{index .Labels `"$OwnerLabelKey`"}} {{index .Labels `"$ContractLabelKey`"}} {{index .Labels `"$InstallIdLabelKey`"}}"+ $expected = "local $OwnerLabelValue $ContractLabelValue $($script:InstallId)"+ if ((Invoke-DockerCapture @('volume', 'inspect', $DataVolume)).ExitCode -eq 0) {+ $metadata = Get-DockerValue @('volume', 'inspect', '--format', $format, $DataVolume) 'Could not inspect the persistent volume.'+ if ($metadata -cne $expected) { Die "Refusing existing unowned or incompatible volume: $DataVolume" }+ return+ }+ if ($script:VolumeEstablished) {+ Die "Installer state already exists but persistent volume $DataVolume is missing. Refusing to create an empty replacement; restore the volume or use a new -Dir."+ }+ $create = Invoke-DockerCapture @('volume', 'create', '--driver', 'local',+ '--label', "$OwnerLabelKey=$OwnerLabelValue",+ '--label', "$ContractLabelKey=$ContractLabelValue",+ '--label', "$InstallIdLabelKey=$($script:InstallId)",+ $DataVolume)+ if ($create.ExitCode -ne 0) { Die 'Could not create the persistent volume.' }+ $metadata = Get-DockerValue @('volume', 'inspect', '--format', $format, $DataVolume) 'Could not verify the persistent volume.'+ if ($metadata -cne $expected) { Die "Persistent volume ownership verification failed: $DataVolume" }+}++function Get-ContainerValue([string]$Format, [string]$Failure) {+ Get-DockerValue @('container', 'inspect', '--format', $Format, $ContainerName) $Failure+}++function Use-ExistingContainer {+ $labels = Get-ContainerValue "{{index .Config.Labels `"$OwnerLabelKey`"}} {{index .Config.Labels `"$ContractLabelKey`"}} {{index .Config.Labels `"$InstallIdLabelKey`"}} {{index .Config.Labels `"$EnvHashLabelKey`"}}" "Could not inspect existing container $ContainerName."+ if ($labels -cne "$OwnerLabelValue $ContractLabelValue $($script:InstallId) $($script:EnvHash)") {+ Die "Refusing existing container ${ContainerName}: installer ownership or configuration identity does not match."+ }++ $containerImage = Get-ContainerValue '{{.Config.Image}}' 'Could not inspect existing container image.'+ if ($containerImage -cne $script:ImageDigest) {+ Die "Refusing existing container ${ContainerName}: immutable appliance digest does not match $($script:ImageDigest)."+ }++ $runtime = Get-ContainerValue '{{.HostConfig.Privileged}}|{{.HostConfig.NetworkMode}}|{{.HostConfig.RestartPolicy.Name}}|{{.Config.StopTimeout}}|{{.HostConfig.ShmSize}}|{{.HostConfig.LogConfig.Type}}|{{index .HostConfig.LogConfig.Config "max-size"}}|{{index .HostConfig.LogConfig.Config "max-file"}}|{{len .HostConfig.Ulimits}}|{{range .HostConfig.Ulimits}}{{.Name}}:{{.Soft}}:{{.Hard}}{{end}}|{{len .Mounts}}|{{range .Mounts}}{{.Type}}:{{.Name}}:{{.Destination}}:{{.RW}}{{end}}|{{len .HostConfig.PortBindings}}|{{range $key, $bindings := .HostConfig.PortBindings}}{{$key}}={{range $bindings}}{{.HostIp}}:{{.HostPort}}{{end}}{{end}}' 'Could not inspect existing container runtime contract.'+ if ($runtime -cne 'false|bridge|unless-stopped|360|2147483648|json-file|50m|5|1|nofile:65536:65536|1|volume:autogpt-platform-data:/data:true|1|3000/tcp=127.0.0.1:3000') {+ Die "Refusing existing container ${ContainerName}: critical runtime contract has drifted."+ }++ $process = Get-ContainerValue '{{json .Config.Entrypoint}}|{{json .Config.Cmd}}' 'Could not inspect existing container process contract.'+ if ($process -cne '["/usr/bin/tini","--","/opt/autogpt/single-container/entrypoint.sh"]|["/usr/bin/supervisord","-n","-c","/opt/autogpt/single-container/supervisor/supervisord.conf"]') {+ Die "Refusing existing container ${ContainerName}: entrypoint or command was overridden."+ }++ $state = Get-ContainerValue '{{.State.Status}}' 'Could not inspect existing container state.'+ if ($state -ceq 'running') {+ $health = Get-ContainerValue '{{if .State.Health}}{{.State.Health.Status}}{{end}}' 'Could not inspect existing container health.'+ if ($health -ceq 'healthy') {+ Ok 'Existing installer-owned appliance already matches the requested immutable contract.'+ } elseif ($health -ceq 'starting') {+ Info 'Existing installer-owned appliance is still starting; continuing to the health wait.'+ } else {+ if (-not $health) { $health = 'none' }+ Die "Existing installer-owned container is running but not healthy (health=$health)."+ }+ } elseif ($state -ceq 'created' -or $state -ceq 'exited') {+ Step 'Starting the existing installer-owned appliance'+ & $script:DockerExe start $ContainerName | Out-Null+ if ($LASTEXITCODE -ne 0) { Die 'Could not start the existing installer-owned appliance.' }+ } else {+ Die "Existing installer-owned container is in unsupported state: $state"+ }+}++function Start-Appliance {+ Assert-Volume+ Set-InstallEstablished+ if ((Invoke-DockerCapture @('container', 'inspect', $ContainerName)).ExitCode -eq 0) {+ Use-ExistingContainer+ return+ }+ Step 'Starting the AutoGPT appliance'+ & $script:DockerExe run --detach `+ --name $ContainerName `+ --label "$OwnerLabelKey=$OwnerLabelValue" `+ --label "$ContractLabelKey=$ContractLabelValue" `+ --label "$InstallIdLabelKey=$($script:InstallId)" `+ --label "$EnvHashLabelKey=$($script:EnvHash)" `+ --restart unless-stopped `+ --stop-timeout 360 `+ --shm-size 2g `+ --ulimit nofile=65536:65536 `+ --log-driver json-file `+ --log-opt max-size=50m `+ --log-opt max-file=5 `+ --env-file $script:EnvFile `+ --publish 127.0.0.1:3000:3000 `+ --volume "${DataVolume}:/data" `+ $script:ImageDigest | Out-Null+ if ($LASTEXITCODE -ne 0) { Die 'Could not start the appliance. The persistent volume was not removed.' }+}++function Wait-Healthy {+ Step 'Waiting for the appliance to become healthy'+ for ($attempt = 1; $attempt -le 180; $attempt++) {+ $status = Invoke-DockerCapture @('inspect', '--format', '{{.State.Status}} {{if .State.Health}}{{.State.Health.Status}}{{end}}', $ContainerName)+ if ($status.ExitCode -ne 0) { Die "Could not inspect appliance container ${ContainerName}; it may have been removed." }+ $parts = @($status.Output.Trim() -split '\s+', 2)+ $state = $parts[0]+ $health = ''+ if ($parts.Count -gt 1) { $health = $parts[1] }+ if ($state -ceq 'running' -and $health -ceq 'healthy') {+ Ok 'AutoGPT is healthy'+ return+ }+ if ($state -ceq 'exited' -or $state -ceq 'dead' -or $state -ceq 'removing' -or $health -ceq 'unhealthy') {+ & $script:DockerExe logs --tail 100 $ContainerName | Out-Host+ if (-not $health) { $health = 'none' }+ Die "The appliance failed while starting (state=$state, health=$health)."+ }+ Start-Sleep -Seconds 5+ }+ & $script:DockerExe logs --tail 100 $ContainerName | Out-Host+ Die 'The appliance did not become healthy within 15 minutes.'+}++Say ''+Say '============================================='+Say ' AutoGPT Platform Installer'+Say '============================================='++if ($CheckDirOnly) {+ Assert-InstallDirectory+ Info "Validated install directory: $Dir"+ exit 0+}++Resolve-Release+if ($ResolveOnly) {+ Info "Selected release -> $VerRef -> $Image"+ exit 0+}++Assert-InstallDirectory+if ($SkipPreflight) { Warn 'Hardware pre-flight skipped; Docker locality and appliance identity checks remain mandatory.' } else { Invoke-Preflight }+Assert-Docker+if ($PreflightOnly) {+ Say ''+ Say '(-PreflightOnly: nothing was installed.)'+ exit 0+}++Initialize-InstallDirectory+Initialize-State+Initialize-Environment+Initialize-Image+Info "Selected release -> $VerRef -> $ImageDigest"+Start-Appliance+Wait-Healthy++Say ''+Say '============================================='+Say ' AutoGPT is ready at http://localhost:3000'+Say '============================================='+Say "Configuration: $EnvFile"+Say "Persistent data: Docker volume $DataVolume"+Say "Immutable appliance: $ImageDigest"+Say 'Registration starts open. Create the intended account, promote it, then close signup as documented.'diff --git a/autogpt_platform/installer/test-single-container-handoff.sh b/autogpt_platform/installer/test-single-container-handoff.shindex 7a89beb7eb..35430d5c78 100755--- a/autogpt_platform/installer/test-single-container-handoff.sh+++ b/autogpt_platform/installer/test-single-container-handoff.sh@@ -79,12 +79,20 @@ fiexit 1}-bootstrap_docs=(docs/platform/installer.md autogpt_platform/installer/install.sh)-if grep -En 'curl[^`]*\|[^`]*bash|install\.(bat|ps1)|Invoke-WebRequest' "${bootstrap_docs[@]}"; then+bootstrap_docs=(+ docs/platform/installer.md+ autogpt_platform/installer/install.sh+ autogpt_platform/installer/install.ps1+ autogpt_platform/installer/install.bat+)+if grep -En 'curl[^`]*\|[^`]*bash|Invoke-WebRequest|Invoke-RestMethod|Invoke-Expression|(^|[[:space:];("])(iwr|irm|iex)[[:space:]]|\|[[:space:]]*iex' "${bootstrap_docs[@]}"; thenprintf 'unsafe or stale installer bootstrap remains in public docs\n' >&2exit 1fi-grep -Fq -- "--proto '=https' --proto-redir '=https' --tlsv1.2" autogpt_platform/installer/install.sh+for bootstrap in docs/platform/installer.md autogpt_platform/installer/install.sh autogpt_platform/installer/install.ps1; do+ grep -Fq -- "--proto '=https' --proto-redir '=https' --tlsv1.2" "$bootstrap"+done+grep -Fq -- '--proto =https --proto-redir =https --tlsv1.2' autogpt_platform/installer/install.batlatest_output="$(bash "$installer" --resolve-only)"assert_contains 'Selected release -> latest -> docker.io/significantgravitas/autogpt:latest' "$latest_output"diff --git a/autogpt_platform/installer/test-windows-installer.ps1 b/autogpt_platform/installer/test-windows-installer.ps1new file mode 100644index 0000000000..a400f60b93--- /dev/null+++ b/autogpt_platform/installer/test-windows-installer.ps1@@ -0,0 +1,780 @@+# Tests for the Windows release installer (install.ps1), its install.bat shim,+# and the documented bootstrap command, using fake docker.exe, curl.exe and+# powershell.exe programs. The cases follow test-single-container-handoff.sh.+# Run it with both PowerShell editions:+# powershell.exe -NoProfile -ExecutionPolicy Bypass -File autogpt_platform/installer/test-windows-installer.ps1+# pwsh -NoProfile -File autogpt_platform/installer/test-windows-installer.ps1+Set-StrictMode -Version 2.0+$ErrorActionPreference = 'Stop'++$installerDir = $PSScriptRoot+$repoRoot = (Resolve-Path (Join-Path $installerDir '..\..')).Path+$installer = Join-Path $installerDir 'install.ps1'+$shim = Join-Path $installerDir 'install.bat'+$powerShellExe = (Get-Process -Id $PID).Path+$userSid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value+$everyoneSid = 'S-1-1-0'+$systemPath = "$env:SystemRoot\System32;$env:SystemRoot"+$junctions = New-Object System.Collections.Generic.List[string]++$fakeSource = @'+using System;+using System.IO;+using System.Reflection;+using System.Security.Cryptography;+using System.Text;++public static class FakeTool+{+ static string Env(string name, string fallback)+ {+ string value = Environment.GetEnvironmentVariable(name);+ return value == null ? fallback : value;+ }++ static bool Enabled(string name) { return Env(name, "false") == "true"; }++ static string Json(string[] values)+ {+ StringBuilder builder = new StringBuilder("[");+ for (int i = 0; i < values.Length; i++)+ {+ if (i > 0) builder.Append(',');+ builder.Append('"');+ foreach (char c in values[i])+ {+ if (c == '\\' || c == '"') builder.Append('\\').Append(c);+ else if (c < ' ') builder.Append("\\u").Append(((int)c).ToString("x4"));+ else builder.Append(c);+ }+ builder.Append('"');+ }+ return builder.Append(']').ToString();+ }++ static void Record(string variable, string line)+ {+ string path = Environment.GetEnvironmentVariable(variable);+ if (!string.IsNullOrEmpty(path)) File.AppendAllText(path, line + "\n");+ }++ static string ValueAfter(string[] args, string flag)+ {+ int index = Array.IndexOf(args, flag);+ return index >= 0 && index + 1 < args.Length ? args[index + 1] : null;+ }++ static int Fail(string message, int code)+ {+ Console.Error.WriteLine(message);+ return code;+ }++ static string ConfigLabel(string key) { return "{{index .Config.Labels \"" + key + "\"}}"; }++ static string VolumeLabel(string key) { return "{{index .Labels \"" + key + "\"}}"; }++ static string InstallFile(string name) { return Path.Combine(Env("FAKE_INSTALL_DIR", ""), name); }++ static string Sha256(string path)+ {+ using (SHA256 sha = SHA256.Create())+ {+ StringBuilder builder = new StringBuilder();+ foreach (byte b in sha.ComputeHash(File.ReadAllBytes(path))) builder.Append(b.ToString("x2"));+ return builder.ToString();+ }+ }++ public static int Main(string[] args)+ {+ string name = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location).ToLowerInvariant();+ if (name == "curl") return Curl(args);+ if (name == "powershell") return PowerShell(args);+ return Docker(args);+ }++ static int Curl(string[] args)+ {+ Record("FAKE_CURL_LOG", Json(args));+ string output = ValueAfter(args, "-o");+ if (output == null) return Fail("fake curl: no -o", 2);+ if (Env("FAKE_CURL_MODE", "ok") == "fail")+ {+ File.WriteAllText(output, "partial installer\n");+ return 22;+ }+ File.WriteAllText(output, "Write-Host 'fake installer'\n");+ return 0;+ }++ static int PowerShell(string[] args)+ {+ Record("FAKE_POWERSHELL_LOG", Json(args));+ string file = ValueAfter(args, "-File");+ if (file != null && File.Exists(file)) Record("FAKE_POWERSHELL_LOG", "target-existed");+ return int.Parse(Env("FAKE_POWERSHELL_EXIT", "0"));+ }++ static int Docker(string[] args)+ {+ Record("FAKE_DOCKER_LOG", Json(args));+ string a0 = args.Length > 0 ? args[0] : "";+ string a1 = args.Length > 1 ? args[1] : "";+ string format = ValueAfter(args, "--format");+ if (a0 == "context" && a1 == "show")+ {+ Console.WriteLine("default");+ return 0;+ }+ if (a0 == "context" && a1 == "inspect")+ {+ if (format != "{{(index .Endpoints \"docker\").Host}}") return Fail("unexpected context inspect format: " + format, 73);+ Console.WriteLine(Env("FAKE_DOCKER_ENDPOINT", "npipe:////./pipe/dockerDesktopLinuxEngine"));+ return 0;+ }+ if (a0 == "info")+ {+ if (Enabled("FAKE_DOCKER_INFO_FAIL")) return 1;+ if (format == null) return 0;+ if (format != "{{.OSType}} {{.Architecture}}") return Fail("unexpected info format: " + format, 74);+ Console.WriteLine(Env("FAKE_DOCKER_OS", "linux") + " " + Env("FAKE_DOCKER_ARCH", "x86_64"));+ return 0;+ }+ if (a0 == "pull") return Enabled("FAKE_DOCKER_PULL_FAIL") ? 1 : 0;+ if (a0 == "image" && a1 == "inspect")+ {+ if (format == ConfigLabel("org.opencontainers.image.title"))+ {+ Console.WriteLine(Env("FAKE_IMAGE_TITLE", "AutoGPT Platform single-container"));+ return 0;+ }+ if (format == ConfigLabel("org.opencontainers.image.source"))+ {+ Console.WriteLine(Env("FAKE_IMAGE_SOURCE", "https://github.com/Significant-Gravitas/AutoGPT"));+ return 0;+ }+ if (format == ConfigLabel("org.opencontainers.image.revision"))+ {+ Console.WriteLine(Env("FAKE_IMAGE_REVISION", new string('a', 40)));+ return 0;+ }+ if (format == "{{.Os}} {{.Architecture}}")+ {+ Console.WriteLine(Env("FAKE_IMAGE_OS", "linux") + " " + Env("FAKE_IMAGE_ARCH", "amd64"));+ return 0;+ }+ if (format == "{{range .RepoDigests}}{{println .}}{{end}}")+ {+ string digests = Env("FAKE_IMAGE_DIGESTS", "significantgravitas/autogpt@sha256:" + new string('b', 64) + "\\n");+ if (digests != "none") Console.Write(digests.Replace("\\n", "\n"));+ return 0;+ }+ return Fail("unexpected image inspect format: " + format, 71);+ }+ if (a0 == "container" && a1 == "inspect")+ {+ if (!Enabled("FAKE_CONTAINER_EXISTS")) return 1;+ if (format == null) return 0;+ if (format == ConfigLabel("com.agpt.installer.owner") + " " + ConfigLabel("com.agpt.installer.contract") + " " + ConfigLabel("com.agpt.installer.install-id") + " " + ConfigLabel("com.agpt.installer.env-sha256"))+ {+ string labels = Env("FAKE_CONTAINER_LABELS", null);+ if (labels == null) labels = "autogpt-platform-installer 1 " + File.ReadAllText(InstallFile("install-id")).Trim() + " " + Sha256(InstallFile("autogpt.env"));+ Console.WriteLine(labels);+ return 0;+ }+ if (format == "{{.Config.Image}}")+ {+ Console.WriteLine(Env("FAKE_CONTAINER_IMAGE", "docker.io/significantgravitas/autogpt@sha256:" + new string('b', 64)));+ return 0;+ }+ if (format.StartsWith("{{.HostConfig.Privileged}}|") && format.Contains("{{index .HostConfig.LogConfig.Config \"max-size\"}}") && format.Contains("{{range $key, $bindings := .HostConfig.PortBindings}}"))+ {+ Console.WriteLine(Env("FAKE_CONTAINER_RUNTIME", "false|bridge|unless-stopped|360|2147483648|json-file|50m|5|1|nofile:65536:65536|1|volume:autogpt-platform-data:/data:true|1|3000/tcp=127.0.0.1:3000"));+ return 0;+ }+ if (format == "{{json .Config.Entrypoint}}|{{json .Config.Cmd}}")+ {+ Console.WriteLine(Env("FAKE_CONTAINER_PROCESS", "[\"/usr/bin/tini\",\"--\",\"/opt/autogpt/single-container/entrypoint.sh\"]|[\"/usr/bin/supervisord\",\"-n\",\"-c\",\"/opt/autogpt/single-container/supervisor/supervisord.conf\"]"));+ return 0;+ }+ if (format == "{{.State.Status}}")+ {+ Console.WriteLine(Env("FAKE_CONTAINER_STATE", "running"));+ return 0;+ }+ if (format == "{{if .State.Health}}{{.State.Health.Status}}{{end}}")+ {+ Console.WriteLine(Env("FAKE_CONTAINER_HEALTH", "healthy"));+ return 0;+ }+ return Fail("unexpected container inspect format: " + format, 72);+ }+ if (a0 == "volume" && a1 == "inspect")+ {+ string statePath = Env("FAKE_VOLUME_STATE", "");+ string state = File.Exists(statePath) ? File.ReadAllText(statePath).Trim() : "";+ if (state == "") return 1;+ if (format == null) return 0;+ if (format != "{{.Driver}} " + VolumeLabel("com.agpt.installer.owner") + " " + VolumeLabel("com.agpt.installer.contract") + " " + VolumeLabel("com.agpt.installer.install-id")) return Fail("unexpected volume inspect format: " + format, 75);+ if (state == "unowned") Console.WriteLine("local <no value> <no value> <no value>");+ else Console.WriteLine("local autogpt-platform-installer 1 " + File.ReadAllText(InstallFile("install-id")).Trim());+ return 0;+ }+ if (a0 == "volume" && a1 == "create")+ {+ File.WriteAllText(Env("FAKE_VOLUME_STATE", ""), "owned\n");+ Console.WriteLine("autogpt-platform-data");+ return 0;+ }+ if (a0 == "run")+ {+ if (Enabled("FAKE_DOCKER_RUN_FAIL")) return 1;+ string envFile = ValueAfter(args, "--env-file");+ if (envFile != InstallFile("autogpt.env")) return Fail("unexpected --env-file: " + envFile, 76);+ Console.WriteLine("fake-container-id");+ return 0;+ }+ if (a0 == "start")+ {+ Console.WriteLine(a1);+ return 0;+ }+ if (a0 == "inspect")+ {+ if (Enabled("FAKE_HEALTH_INSPECT_FAIL")) return 1;+ if (format != "{{.State.Status}} {{if .State.Health}}{{.State.Health.Status}}{{end}}") return Fail("unexpected inspect format: " + format, 77);+ Console.WriteLine(Env("FAKE_HEALTH_STATUS", "running healthy"));+ return 0;+ }+ if (a0 == "logs") return 0;+ return Fail("unexpected fake docker invocation: " + string.Join(" ", args), 70);+ }+}+'@++function ConvertTo-NativeArgument([string]$Value) {+ if ($Value.Length -gt 0 -and $Value -notmatch '[\s"]') { return $Value }+ $builder = New-Object System.Text.StringBuilder+ [void]$builder.Append('"')+ $slashes = 0+ foreach ($char in $Value.ToCharArray()) {+ if ($char -eq [char]'\') {+ $slashes+++ continue+ }+ if ($char -eq [char]'"') {+ [void]$builder.Append([char]'\', 2 * $slashes + 1)+ } elseif ($slashes -gt 0) {+ [void]$builder.Append([char]'\', $slashes)+ }+ $slashes = 0+ [void]$builder.Append($char)+ }+ [void]$builder.Append([char]'\', 2 * $slashes)+ [void]$builder.Append('"')+ $builder.ToString()+}++function Invoke-Program([string]$FilePath, [string[]]$Arguments, [hashtable]$Environment) {+ $startInfo = New-Object System.Diagnostics.ProcessStartInfo+ $startInfo.FileName = $FilePath+ $startInfo.Arguments = @($Arguments | ForEach-Object { ConvertTo-NativeArgument $_ }) -join ' '+ $startInfo.UseShellExecute = $false+ $startInfo.CreateNoWindow = $true+ $startInfo.RedirectStandardOutput = $true+ $startInfo.RedirectStandardError = $true+ foreach ($key in @($Environment.Keys)) {+ if ($null -eq $Environment[$key]) {+ [void]$startInfo.EnvironmentVariables.Remove($key)+ } else {+ $startInfo.EnvironmentVariables[$key] = [string]$Environment[$key]+ }+ }+ $process = [System.Diagnostics.Process]::Start($startInfo)+ $stdout = $process.StandardOutput.ReadToEndAsync()+ $stderr = $process.StandardError.ReadToEndAsync()+ $process.WaitForExit()+ [pscustomobject]@{ ExitCode = $process.ExitCode; Output = $stdout.Result + $stderr.Result }+}++function Assert-Contains([string]$Expected, [string]$Actual) {+ if (-not $Actual.Contains($Expected)) { throw "missing expected text: $Expected`nactual output:`n$Actual" }+}++function Assert-NotContains([string]$Unexpected, [string]$Actual) {+ if ($Actual.Contains($Unexpected)) { throw "unexpected text: $Unexpected`nactual output:`n$Actual" }+}++function Assert-Succeeded($Result, [string]$What) {+ if ($Result.ExitCode -ne 0) { throw "$What failed with exit code $($Result.ExitCode):`n$($Result.Output)" }+}++function Assert-FailsWith([string]$Expected, $Result) {+ if ($Result.ExitCode -eq 0) { throw "command unexpectedly succeeded; expected: $Expected`n$($Result.Output)" }+ Assert-Contains $Expected $Result.Output+}++function Invoke-Installer([hashtable]$Environment = @{}, [string[]]$Arguments = @()) {+ $merged = @{+ PATH = "$fakeBin;$systemPath"+ FAKE_DOCKER_LOG = $dockerLog+ FAKE_VOLUME_STATE = $volumeState+ DOCKER_HOST = $null+ DOCKER_CONTEXT = $null+ }+ foreach ($key in @($Environment.Keys)) { $merged[$key] = $Environment[$key] }+ Invoke-Program $powerShellExe (@('-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', $installer) + $Arguments) $merged+}++function Invoke-FakeInstall([string]$InstallDir, [hashtable]$Environment = @{}, [string[]]$Arguments = @()) {+ $merged = @{ FAKE_INSTALL_DIR = $InstallDir }+ foreach ($key in @($Environment.Keys)) { $merged[$key] = $Environment[$key] }+ Invoke-Installer $merged (@('-SkipPreflight', '-Dir', $InstallDir) + $Arguments)+}++# Windows PowerShell 5.1 returns a JSON array as one object; piping unrolls it.+function ConvertFrom-ArgumentLog([string]$Line) {+ @(ConvertFrom-Json $Line | ForEach-Object { $_ })+}++function Get-DockerLog {+ if (-not (Test-Path -LiteralPath $dockerLog)) { return '' }+ $calls = foreach ($line in [System.IO.File]::ReadAllLines($dockerLog)) { (ConvertFrom-ArgumentLog $line) -join ' ' }+ @($calls) -join "`n"+}++function Get-RunCall {+ @((Get-DockerLog) -split "`n" | Where-Object { $_.StartsWith('run ') }) -join "`n"+}++function Clear-File([string]$Path, [string]$Content = '') {+ [System.IO.File]::WriteAllText($Path, $Content)+}++function New-PrivateSecurity {+ $security = New-Object System.Security.AccessControl.DirectorySecurity+ $security.SetAccessRuleProtection($true, $false)+ $security.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule(+ (New-Object System.Security.Principal.SecurityIdentifier $userSid),+ [System.Security.AccessControl.FileSystemRights]::FullControl,+ [System.Security.AccessControl.InheritanceFlags]'ContainerInherit, ObjectInherit',+ [System.Security.AccessControl.PropagationFlags]::None,+ [System.Security.AccessControl.AccessControlType]::Allow)))+ $security+}++function New-PrivateDirectory([string]$Path) {+ if ([System.IO.Directory].GetMethod('CreateDirectory', [type[]]@([string], [System.Security.AccessControl.DirectorySecurity]))) {+ [void][System.IO.Directory]::CreateDirectory($Path, (New-PrivateSecurity))+ } else {+ [void][System.IO.FileSystemAclExtensions]::Create((New-Object System.IO.DirectoryInfo $Path), (New-PrivateSecurity))+ }+}++function Get-DirectorySecurity([string]$Path) {+ $info = New-Object System.IO.DirectoryInfo $Path+ if ($info.PSObject.Methods['GetAccessControl']) { return $info.GetAccessControl() }+ [System.IO.FileSystemAclExtensions]::GetAccessControl($info)+}++function Add-AllowRule([string]$Path, [string]$Sid, [string]$Rights) {+ $info = New-Object System.IO.DirectoryInfo $Path+ $security = Get-DirectorySecurity $Path+ $security.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule(+ (New-Object System.Security.Principal.SecurityIdentifier $Sid),+ [System.Security.AccessControl.FileSystemRights]$Rights,+ [System.Security.AccessControl.AccessControlType]::Allow)))+ if ($info.PSObject.Methods['SetAccessControl']) { $info.SetAccessControl($security) } else { [System.IO.FileSystemAclExtensions]::SetAccessControl($info, $security) }+}++function New-Junction([string]$Link, [string]$Target) {+ New-Item -ItemType Junction -Path $Link -Target $Target | Out-Null+ $junctions.Add($Link)+}++function New-FileSymlink([string]$Link, [string]$Target) {+ try {+ New-Item -ItemType SymbolicLink -Path $Link -Target $Target -ErrorAction Stop | Out-Null+ } catch {+ & "$env:SystemRoot\System32\cmd.exe" /d /c mklink $Link $Target 2>&1 | Out-Null+ }+ Test-Path -LiteralPath $Link+}++function Assert-PrivateAcl([string]$Path) {+ $acl = Get-Acl -LiteralPath $Path+ $rules = @($acl.GetAccessRules($true, $true, [System.Security.Principal.SecurityIdentifier]))+ if (-not $acl.AreAccessRulesProtected -or $rules.Count -ne 1 -or $rules[0].IdentityReference.Value -ne $userSid -or $rules[0].AccessControlType -ne 'Allow') {+ throw "$Path is not private to the current user: $($acl.GetSecurityDescriptorSddlForm('Access'))"+ }+}++# A test root must pass the installer's own ancestor checks. Try the places a+# standard user can usually create a private folder.+function Select-TestRoot {+ $name = 'agpt-installer-test-' + [guid]::NewGuid().ToString('N').Substring(0, 12)+ $candidates = @()+ foreach ($base in @("$env:SystemDrive\", $env:TEMP, $env:LOCALAPPDATA, $env:RUNNER_TEMP)) {+ if ($base -and (Test-Path -LiteralPath $base)) { $candidates += (Join-Path $base $name) }+ }+ $reasons = @()+ foreach ($candidate in $candidates) {+ $probe = Invoke-Program $powerShellExe @('-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', $installer, '-CheckDirOnly', '-Dir', $candidate) @{}+ if ($probe.ExitCode -eq 0) { return $candidate }+ $reasons += "${candidate}: $($probe.Output.Trim())"+ }+ throw "no folder on this machine passes the installer's ancestor checks:`n$($reasons -join "`n")"+}++$root = Select-TestRoot+New-PrivateDirectory $root+Write-Host "test root: $root"+try {+ $fakeBin = Join-Path $root 'fake-bin'+ New-Item -ItemType Directory -Path $fakeBin | Out-Null+ $csc = "$env:SystemRoot\Microsoft.NET\Framework64\v4.0.30319\csc.exe"+ if (-not (Test-Path -LiteralPath $csc)) { $csc = "$env:SystemRoot\Microsoft.NET\Framework\v4.0.30319\csc.exe" }+ $sourceFile = Join-Path $root 'FakeTool.cs'+ [System.IO.File]::WriteAllText($sourceFile, $fakeSource)+ $compiled = Join-Path $root 'FakeTool.exe'+ $compile = Invoke-Program $csc @('/nologo', '/target:exe', "/out:$compiled", $sourceFile) @{}+ Assert-Succeeded $compile 'compiling the fake tools'+ foreach ($tool in 'docker', 'curl', 'powershell') { Copy-Item -LiteralPath $compiled -Destination (Join-Path $fakeBin "$tool.exe") }+ $dockerLog = Join-Path $root 'docker.log'+ $volumeState = Join-Path $root 'volume.state'++ # Default and explicit directories.+ $defaultLocal = Join-Path $root 'default-local'+ $result = Invoke-Installer @{ LOCALAPPDATA = $defaultLocal } @('-CheckDirOnly')+ Assert-Succeeded $result 'default directory check'+ Assert-Contains "Validated install directory: $defaultLocal\AutoGPT" $result.Output+ $result = Invoke-Installer @{ LOCALAPPDATA = "$defaultLocal\" } @('-CheckDirOnly')+ Assert-Contains "Validated install directory: $defaultLocal\AutoGPT" $result.Output++ # Release selection and flags.+ $result = Invoke-Installer @{} @('-ResolveOnly')+ Assert-Contains 'Selected release -> latest -> docker.io/significantgravitas/autogpt:latest' $result.Output+ $result = Invoke-Installer @{} @('-ResolveOnly', '-Release', 'autogpt-platform-beta-v1.2.3')+ Assert-Contains 'Selected release -> autogpt-platform-beta-v1.2.3 -> docker.io/significantgravitas/autogpt:v1.2.3' $result.Output+ $result = Invoke-Installer @{} @('--resolve-only', '--release=v2.3.4')+ Assert-Contains 'Selected release -> v2.3.4 -> docker.io/significantgravitas/autogpt:v2.3.4' $result.Output+ $result = Invoke-Installer @{} @('-ResolveOnly', '-Release:v3.4.5')+ Assert-Contains 'Selected release -> v3.4.5 -> docker.io/significantgravitas/autogpt:v3.4.5' $result.Output+ # Run inside a session instead of with -File, PowerShell splits -Name:value differently.+ $inSession = "& '$installer' -ResolveOnly -Release:v4.5.6"+ $result = Invoke-Program $powerShellExe @('-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', $inSession) @{}+ Assert-Contains 'Selected release -> v4.5.6 -> docker.io/significantgravitas/autogpt:v4.5.6' $result.Output+ $sessionDir = Join-Path $root 'session-dir'+ $result = Invoke-Program $powerShellExe @('-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', "& '$installer' -CheckDirOnly -Dir:$sessionDir") @{}+ Assert-Contains "Validated install directory: $sessionDir" $result.Output+ Assert-FailsWith 'Expected autogpt-platform-beta-vX.Y.Z or vX.Y.Z' (Invoke-Installer @{} @('-ResolveOnly', '-Release', 'latest'))+ Assert-FailsWith 'Expected autogpt-platform-beta-vX.Y.Z or vX.Y.Z' (Invoke-Installer @{} @('-ResolveOnly', '-Release', 'V1.2.3'))+ Assert-FailsWith 'needs a non-empty value' (Invoke-Installer @{} @('-ResolveOnly', '--release='))+ Assert-FailsWith 'Unknown flag: -Dev' (Invoke-Installer @{} @('-ResolveOnly', '-Dev'))+ Assert-FailsWith 'Unknown flag: --branch' (Invoke-Installer @{} @('-ResolveOnly', '--branch', 'dev'))+ Assert-FailsWith 'needs a value, not another option' (Invoke-Installer @{} @('-Release', '-ResolveOnly'))+ Assert-FailsWith 'needs a value, not another option' (Invoke-Installer @{} @('-Dir', '-ResolveOnly'))+ Assert-FailsWith '-Release needs a value' (Invoke-Installer @{} @('-ResolveOnly', '-Release'))+ $result = Invoke-Installer @{} @('-Help')+ Assert-Succeeded $result '-Help'+ Assert-Contains "curl.exe --proto '=https' --proto-redir '=https' --tlsv1.2 -fsSL" $result.Output++ # Unsafe or unsupported locations.+ Assert-FailsWith "Refusing broad or system install directory: $env:SystemDrive\" (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$env:SystemDrive\"))+ $fakeLocal = Join-Path $root 'fake-local'+ Assert-FailsWith 'Refusing broad or system install directory' (Invoke-Installer @{ LOCALAPPDATA = $fakeLocal } @('-CheckDirOnly', '-Dir', $fakeLocal))+ $fakeTemp = Join-Path $root 'fake-temp'+ Assert-FailsWith 'Refusing broad or system install directory' (Invoke-Installer @{ TEMP = $fakeTemp; TMP = $fakeTemp } @('-CheckDirOnly', '-Dir', "$fakeTemp\"))+ Assert-FailsWith "contains an unsafe '.' component" (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$root\."))+ Assert-FailsWith "contains an unsafe '..' component" (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$root\..\x"))+ Assert-FailsWith 'contains redundant path separators' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$root\\x"))+ Assert-FailsWith 'contains redundant path separators' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$($env:SystemDrive)\\Windows"))+ Assert-FailsWith 'unsupported component: x.' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$root\x."))+ Assert-FailsWith 'unsupported component: a:b' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$root\a:b"))+ Assert-FailsWith 'unsupported component: PROGRA~1' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$root\PROGRA~1"))+ Assert-FailsWith 'Refusing a network or device path' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', '\\server\share\autogpt'))+ $unusedDrive = [char[]](90..68) | Where-Object { -not (Test-Path -LiteralPath "${_}:\") } | Select-Object -First 1+ if ($unusedDrive) {+ Assert-FailsWith "Install directory drive does not exist: ${unusedDrive}:\" (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "${unusedDrive}:\autogpt"))+ }+ Assert-FailsWith 'must be a full path' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$($env:SystemDrive)autogpt"))+ Assert-FailsWith 'Install directory cannot be empty' (Invoke-Installer @{} @('-CheckDirOnly', '--dir='))++ $existingDir = Join-Path $root 'existing-install'+ New-Item -ItemType Directory -Path $existingDir | Out-Null+ Assert-Succeeded (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', $existingDir)) 'existing private directory'++ $readableDir = Join-Path $root 'readable-install'+ New-Item -ItemType Directory -Path $readableDir | Out-Null+ Add-AllowRule $readableDir $everyoneSid 'ReadAndExecute'+ Assert-FailsWith 'is accessible by another user or group' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', $readableDir))++ $sharedDir = Join-Path $root 'shared-install'+ New-Item -ItemType Directory -Path $sharedDir | Out-Null+ Add-AllowRule $sharedDir $everyoneSid 'Modify'+ Assert-FailsWith 'writable by another user or group' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', $sharedDir))+ Assert-FailsWith 'writable by another user or group' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$sharedDir\private-state"))++ # Creating new entries only is the sticky-directory case: it cannot replace+ # a folder the installer creates.+ $stickyParent = Join-Path $root 'sticky-parent'+ New-Item -ItemType Directory -Path $stickyParent | Out-Null+ Add-AllowRule $stickyParent $everyoneSid 'CreateFiles, CreateDirectories, ReadAndExecute'+ Assert-Succeeded (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$stickyParent\private-state")) 'create-only parent'++ $junctionTarget = Join-Path $root 'junction-target'+ New-Item -ItemType Directory -Path $junctionTarget | Out-Null+ $junctionDir = Join-Path $root 'junction-install'+ New-Junction $junctionDir $junctionTarget+ Assert-FailsWith 'symlink or junction' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', $junctionDir))+ Assert-FailsWith 'symlink or junction component' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$junctionDir\child"))++ $fileInPath = Join-Path $root 'not-a-directory'+ Clear-File $fileInPath 'x'+ Assert-FailsWith 'component is not a directory' (Invoke-Installer @{} @('-CheckDirOnly', '-Dir', "$fileInPath\child"))++ # Docker locality, platform and identity checks, with the fake docker.exe.+ Clear-File $dockerLog+ Clear-File $volumeState+ $defaultDir = Join-Path $root 'default install'+ Assert-Succeeded (Invoke-FakeInstall $defaultDir) 'default fake install'+ $log = Get-DockerLog+ Assert-Contains 'pull docker.io/significantgravitas/autogpt:latest' $log+ Assert-Contains 'run --detach' $log+ Assert-Contains ('docker.io/significantgravitas/autogpt@sha256:' + ('b' * 64)) (Get-RunCall)+ Assert-NotContains 'docker.io/significantgravitas/autogpt:latest' (Get-RunCall)+ Assert-Contains '--publish 127.0.0.1:3000:3000' $log+ Assert-Contains '--restart unless-stopped' $log+ Assert-Contains '--stop-timeout 360' $log+ Assert-Contains '--shm-size 2g' $log+ Assert-Contains '--ulimit nofile=65536:65536' $log+ Assert-Contains '--volume autogpt-platform-data:/data' $log+ Assert-Contains '--label com.agpt.installer.owner=autogpt-platform-installer' $log+ Assert-Contains '--label com.agpt.installer.contract=1' $log+ if ((Get-RunCall) -cnotmatch '--label com\.agpt\.installer\.env-sha256=[0-9a-f]{64}') { throw "run call has no env-sha256 label:`n$(Get-RunCall)" }+ Assert-PrivateAcl $defaultDir+ foreach ($name in 'autogpt.env', 'install-id', 'install-state') { Assert-PrivateAcl (Join-Path $defaultDir $name) }+ # The user owns the state even after an elevated run, so a standard-user rerun accepts it.+ foreach ($path in @($defaultDir) + @('autogpt.env', 'install-id', 'install-state' | ForEach-Object { Join-Path $defaultDir $_ })) {+ $owner = (Get-Acl -LiteralPath $path).GetOwner([System.Security.Principal.SecurityIdentifier]).Value+ if ($owner -ne $userSid) { throw "$path is owned by $owner, not the current user" }+ }+ if ([System.IO.File]::ReadAllText((Join-Path $defaultDir 'autogpt.env')) -cne "# Private runtime configuration for the AutoGPT appliance.`nAUTOGPT_PUBLIC_URL=http://localhost:3000`n") {+ throw 'autogpt.env does not have the expected LF-terminated contents'+ }++ Clear-File $dockerLog+ Clear-File $volumeState+ $explicitDir = Join-Path $root 'explicit-install'+ Assert-Succeeded (Invoke-FakeInstall $explicitDir @{} @('-Release', 'v1.2.3')) 'explicit release'+ Assert-Contains 'pull docker.io/significantgravitas/autogpt:v1.2.3' (Get-DockerLog)++ $probeDir = Join-Path $root 'endpoint-probe'+ Assert-FailsWith 'Refusing non-local Docker endpoint: tcp://' (Invoke-FakeInstall $probeDir @{ DOCKER_HOST = 'tcp://localhost:2375' })+ Assert-FailsWith 'Refusing non-local Docker endpoint: ssh://' (Invoke-FakeInstall $probeDir @{ FAKE_DOCKER_ENDPOINT = 'ssh://example.invalid' })+ Assert-FailsWith 'Refusing non-local Docker endpoint: npipe:////remote-host/pipe/docker_engine' (Invoke-FakeInstall $probeDir @{ FAKE_DOCKER_ENDPOINT = 'npipe:////remote-host/pipe/docker_engine' })+ Assert-FailsWith 'Refusing non-local Docker endpoint: unix://' (Invoke-FakeInstall $probeDir @{ FAKE_DOCKER_ENDPOINT = 'unix:///var/run/docker.sock' })+ $result = Invoke-FakeInstall $probeDir @{ FAKE_DOCKER_ENDPOINT = 'npipe:////./pipe/docker_engine' } @('-PreflightOnly')+ Assert-Succeeded $result 'default Docker Desktop pipe'+ Assert-Contains 'nothing was installed' $result.Output+ Assert-Succeeded (Invoke-FakeInstall $probeDir @{ DOCKER_HOST = 'npipe:////./pipe/dockerDesktopLinuxEngine' } @('-PreflightOnly')) 'DOCKER_HOST named pipe'+ Assert-FailsWith 'switch Docker Desktop to Linux containers' (Invoke-FakeInstall $probeDir @{ FAKE_DOCKER_OS = 'windows' })+ Assert-FailsWith 'Unsupported Docker daemon architecture' (Invoke-FakeInstall $probeDir @{ FAKE_DOCKER_ARCH = 'riscv64' })+ Assert-FailsWith 'not running or is not accessible' (Invoke-FakeInstall $probeDir @{ FAKE_DOCKER_INFO_FAIL = 'true' })+ # CI images can ship a docker.exe in System32, so search only an empty folder.+ $emptyBin = Join-Path $root 'empty-bin'+ New-Item -ItemType Directory -Path $emptyBin | Out-Null+ Assert-FailsWith 'Docker is required' (Invoke-FakeInstall $probeDir @{ PATH = $emptyBin })+ $cmdBin = Join-Path $root 'cmd-bin'+ New-Item -ItemType Directory -Path $cmdBin | Out-Null+ Clear-File (Join-Path $cmdBin 'docker.cmd') '@exit /b 0'+ Assert-FailsWith 'must be docker.exe' (Invoke-FakeInstall $probeDir @{ PATH = "$cmdBin;$systemPath" })++ Assert-FailsWith 'unexpected OCI title' (Invoke-FakeInstall (Join-Path $root 'wrong-title') @{ FAKE_IMAGE_TITLE = 'Not AutoGPT' })+ Assert-FailsWith 'invalid source revision label' (Invoke-FakeInstall (Join-Path $root 'wrong-revision') @{ FAKE_IMAGE_REVISION = 'not-a-revision' })+ Assert-FailsWith 'exactly one native repository digest; found 0' (Invoke-FakeInstall (Join-Path $root 'missing-digest') @{ FAKE_IMAGE_DIGESTS = 'none' })+ $two = 'significantgravitas/autogpt@sha256:' + ('b' * 64) + '\nsignificantgravitas/autogpt@sha256:' + ('c' * 64) + '\n'+ Assert-FailsWith 'exactly one native repository digest; found 2' (Invoke-FakeInstall (Join-Path $root 'multiple-digest') @{ FAKE_IMAGE_DIGESTS = $two })+ Assert-FailsWith 'unexpected repository digest' (Invoke-FakeInstall (Join-Path $root 'foreign-digest') @{ FAKE_IMAGE_DIGESTS = ('example/other@sha256:' + ('b' * 64) + '\n') })++ Clear-File $volumeState+ $aliasedDir = Join-Path $root 'aliased-digest'+ $aliased = 'significantgravitas/autogpt@sha256:' + ('b' * 64) + '\ndocker.io/significantgravitas/autogpt@sha256:' + ('b' * 64) + '\n'+ Assert-Succeeded (Invoke-FakeInstall $aliasedDir @{ FAKE_IMAGE_DIGESTS = $aliased }) 'aliased digests'+ $installId = [System.IO.File]::ReadAllText((Join-Path $aliasedDir 'install-id'))+ if ([System.IO.File]::ReadAllText((Join-Path $aliasedDir 'install-state')) -cne "contract=1 lifecycle=established volume=autogpt-platform-data install-id=$installId`n") {+ throw 'install-state does not record the established volume'+ }++ Assert-FailsWith 'does not match Docker daemon architecture' (Invoke-FakeInstall (Join-Path $root 'wrong-image-arch') @{ FAKE_IMAGE_ARCH = 'arm64' })+ Assert-FailsWith 'installer ownership or configuration identity does not match' (Invoke-FakeInstall (Join-Path $root 'container-collision') @{ FAKE_CONTAINER_EXISTS = 'true'; FAKE_CONTAINER_LABELS = 'unowned 0 wrong wrong' })++ # Reruns against the default install.+ Clear-File $dockerLog+ Clear-File $volumeState "owned`n"+ $result = Invoke-FakeInstall $defaultDir @{ FAKE_CONTAINER_EXISTS = 'true' }+ Assert-Succeeded $result 'exact-contract rerun'+ Assert-Contains 'already matches the requested immutable contract' $result.Output+ Assert-NotContains 'run --detach' (Get-DockerLog)+ Assert-Contains 'container inspect --format' (Get-DockerLog)++ Clear-File $dockerLog+ Assert-Succeeded (Invoke-FakeInstall $defaultDir @{ FAKE_CONTAINER_EXISTS = 'true'; FAKE_CONTAINER_STATE = 'exited' }) 'start an exited container'+ Assert-Contains 'start autogpt' (Get-DockerLog)++ Clear-File $dockerLog+ Assert-Succeeded (Invoke-FakeInstall $defaultDir @{ FAKE_CONTAINER_EXISTS = 'true'; FAKE_CONTAINER_HEALTH = 'starting' }) 'container still starting'+ Assert-NotContains 'run --detach' (Get-DockerLog)+ Assert-Contains 'inspect --format' (Get-DockerLog)++ Assert-FailsWith 'running but not healthy (health=unhealthy)' (Invoke-FakeInstall $defaultDir @{ FAKE_CONTAINER_EXISTS = 'true'; FAKE_CONTAINER_HEALTH = 'unhealthy' })+ Assert-FailsWith 'immutable appliance digest does not match' (Invoke-FakeInstall $defaultDir @{ FAKE_CONTAINER_EXISTS = 'true'; FAKE_CONTAINER_IMAGE = 'docker.io/significantgravitas/autogpt:latest' })+ Assert-FailsWith 'entrypoint or command was overridden' (Invoke-FakeInstall $defaultDir @{ FAKE_CONTAINER_EXISTS = 'true'; FAKE_CONTAINER_PROCESS = '["/bin/sh"]|null' })++ Clear-File $volumeState+ Assert-FailsWith 'Could not inspect appliance container autogpt; it may have been removed' (Invoke-FakeInstall (Join-Path $root 'health-inspect-failure') @{ FAKE_HEALTH_INSPECT_FAIL = 'true' })+ Clear-File $volumeState+ Assert-FailsWith 'failed while starting (state=running, health=unhealthy)' (Invoke-FakeInstall (Join-Path $root 'health-unhealthy') @{ FAKE_HEALTH_STATUS = 'running unhealthy' })+ Clear-File $volumeState+ Assert-FailsWith 'failed while starting (state=exited, health=none)' (Invoke-FakeInstall (Join-Path $root 'health-exited') @{ FAKE_HEALTH_STATUS = 'exited' })++ $driftDir = Join-Path $root 'runtime-drift'+ New-Item -ItemType Directory -Path $driftDir | Out-Null+ Clear-File (Join-Path $driftDir 'install-id') ('a' * 32)+ Clear-File (Join-Path $driftDir 'autogpt.env') "AUTOGPT_PUBLIC_URL=http://localhost:3000`n"+ Assert-FailsWith 'critical runtime contract has drifted' (Invoke-FakeInstall $driftDir @{ FAKE_CONTAINER_EXISTS = 'true'; FAKE_CONTAINER_RUNTIME = 'true|host|no|0|0|none||||0||0||0|' })++ $missingVolumeDir = Join-Path $root 'missing-prior-volume'+ New-Item -ItemType Directory -Path $missingVolumeDir | Out-Null+ Clear-File (Join-Path $missingVolumeDir 'install-id') ('a' * 32)+ Clear-File (Join-Path $missingVolumeDir 'autogpt.env') "AUTOGPT_PUBLIC_URL=http://localhost:3000`n"+ Clear-File (Join-Path $missingVolumeDir 'install-state') ('contract=1 lifecycle=established volume=autogpt-platform-data install-id=' + ('a' * 32) + "`n")+ Clear-File $volumeState+ Assert-FailsWith 'Installer state already exists but persistent volume autogpt-platform-data is missing' (Invoke-FakeInstall $missingVolumeDir)++ $retryDir = Join-Path $root 'retry-after-pull'+ Clear-File $volumeState+ Assert-FailsWith 'Published appliance image' (Invoke-FakeInstall $retryDir @{ FAKE_DOCKER_PULL_FAIL = 'true' })+ if (Test-Path -LiteralPath (Join-Path $retryDir 'install-state')) { throw 'a failed pull recorded an established install' }+ Assert-Succeeded (Invoke-FakeInstall $retryDir) 'retry after a failed pull'+ if (-not (Test-Path -LiteralPath (Join-Path $retryDir 'install-state'))) { throw 'the retried install did not record its volume' }+ Clear-File $volumeState+ Assert-FailsWith 'Installer state already exists but persistent volume autogpt-platform-data is missing' (Invoke-FakeInstall $retryDir)++ $runFailureDir = Join-Path $root 'run-failure'+ Clear-File $volumeState+ Assert-FailsWith 'Could not start the appliance' (Invoke-FakeInstall $runFailureDir @{ FAKE_DOCKER_RUN_FAIL = 'true' })+ if (-not (Test-Path -LiteralPath (Join-Path $runFailureDir 'install-state'))) { throw 'a failed run lost the established volume record' }+ Clear-File $volumeState+ Assert-FailsWith 'Installer state already exists but persistent volume autogpt-platform-data is missing' (Invoke-FakeInstall $runFailureDir)++ Clear-File $volumeState "unowned`n"+ Assert-FailsWith 'Refusing existing unowned or incompatible volume' (Invoke-FakeInstall (Join-Path $root 'unowned-volume'))++ Clear-File $volumeState+ $symlinkEnvDir = Join-Path $root 'symlink-env'+ New-Item -ItemType Directory -Path $symlinkEnvDir | Out-Null+ $outsideEnv = Join-Path $root 'outside.env'+ Clear-File $outsideEnv "AUTOGPT_PUBLIC_URL=http://localhost:3000`n"+ if (New-FileSymlink (Join-Path $symlinkEnvDir 'autogpt.env') $outsideEnv) {+ Assert-FailsWith 'Refusing symlink for Runtime configuration' (Invoke-FakeInstall $symlinkEnvDir)+ } else {+ Write-Host 'skipped: this account cannot create file symlinks (needs Developer Mode or administrator)'+ }++ $hardlinkEnvDir = Join-Path $root 'hardlink-env'+ New-Item -ItemType Directory -Path $hardlinkEnvDir | Out-Null+ Clear-File (Join-Path $hardlinkEnvDir 'autogpt.env') "AUTOGPT_PUBLIC_URL=http://localhost:3000`n"+ New-Item -ItemType HardLink -Path (Join-Path $root 'env-copy') -Target (Join-Path $hardlinkEnvDir 'autogpt.env') | Out-Null+ Assert-FailsWith 'Runtime configuration has multiple hard links' (Invoke-FakeInstall $hardlinkEnvDir)++ $hardlinkStateDir = Join-Path $root 'hardlink-state'+ New-Item -ItemType Directory -Path $hardlinkStateDir | Out-Null+ Clear-File (Join-Path $hardlinkStateDir 'install-id') ('a' * 32)+ New-Item -ItemType HardLink -Path (Join-Path $root 'state-copy') -Target (Join-Path $hardlinkStateDir 'install-id') | Out-Null+ Assert-FailsWith 'Installer identity has multiple hard links' (Invoke-FakeInstall $hardlinkStateDir)++ $badIdDir = Join-Path $root 'bad-install-id'+ New-Item -ItemType Directory -Path $badIdDir | Out-Null+ Clear-File (Join-Path $badIdDir 'install-id') 'not-an-id'+ Assert-FailsWith 'Installer identity has invalid contents' (Invoke-FakeInstall $badIdDir)++ # The bootstrap command from docs/platform/installer.md must not run a+ # failed download, and must run a successful one from a unique temp file.+ $doc = [System.IO.File]::ReadAllText((Join-Path $repoRoot 'docs\platform\installer.md'))+ $section = [regex]::Match($doc, '(?ms)^### Windows\r?\n.*?^```powershell\r?\n(.*?)^```')+ if (-not $section.Success) { throw 'docs/platform/installer.md has no "### Windows" section with a powershell block' }+ $bootstrapFile = Join-Path $root 'bootstrap.ps1'+ [System.IO.File]::WriteAllText($bootstrapFile, $section.Groups[1].Value)+ $bootstrapTemp = Join-Path $root 'bootstrap-temp'+ New-Item -ItemType Directory -Path $bootstrapTemp | Out-Null+ $curlLog = Join-Path $root 'curl.log'+ $powerShellLog = Join-Path $root 'powershell.log'+ $bootstrapEnvironment = @{+ PATH = "$fakeBin;$systemPath"+ TEMP = $bootstrapTemp+ TMP = $bootstrapTemp+ FAKE_CURL_LOG = $curlLog+ FAKE_POWERSHELL_LOG = $powerShellLog+ FAKE_CURL_MODE = 'fail'+ }+ [void](Invoke-Program $powerShellExe @('-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', $bootstrapFile) $bootstrapEnvironment)+ if (Test-Path -LiteralPath $powerShellLog) { throw 'the documented bootstrap ran a partial download' }+ if (@(Get-ChildItem -LiteralPath $bootstrapTemp -Force).Count -ne 0) { throw 'the documented bootstrap left its partial download behind' }+ $curlArgs = ConvertFrom-ArgumentLog ([System.IO.File]::ReadAllLines($curlLog)[0])+ $installerPath = $curlArgs[7]+ if (($curlArgs[0..6] -join ' ') -cne '--proto =https --proto-redir =https --tlsv1.2 -fsSL -o' -or $curlArgs[8] -cne 'https://setup.agpt.co/install.ps1' -or $curlArgs.Count -ne 9) {+ throw "unexpected bootstrap curl arguments: $($curlArgs -join ' ')"+ }+ if ($installerPath -notmatch ('^' + [regex]::Escape($bootstrapTemp) + '\\autogpt-install-[0-9a-f]{32}\.ps1$')) { throw "unexpected bootstrap temp file: $installerPath" }++ $bootstrapEnvironment['FAKE_CURL_MODE'] = 'ok'+ [void](Invoke-Program $powerShellExe @('-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', $bootstrapFile) $bootstrapEnvironment)+ $ran = [System.IO.File]::ReadAllLines($powerShellLog)+ $ranArgs = ConvertFrom-ArgumentLog $ran[0]+ if (($ranArgs[0..3] -join ' ') -cne '-NoProfile -ExecutionPolicy Bypass -File' -or $ranArgs.Count -ne 5 -or $ran[1] -cne 'target-existed') {+ throw "the documented bootstrap did not run the downloaded installer as expected: $($ran -join ' | ')"+ }+ if (@(Get-ChildItem -LiteralPath $bootstrapTemp -Force).Count -ne 0) { throw 'the documented bootstrap left the installer behind' }++ # install.bat runs install.ps1 the same way and passes its arguments on.+ $shimCopy = Join-Path $root 'install.bat'+ Copy-Item -LiteralPath $shim -Destination $shimCopy+ $shimTemp = Join-Path $root 'shim-temp'+ New-Item -ItemType Directory -Path $shimTemp | Out-Null+ Remove-Item -LiteralPath $curlLog, $powerShellLog -Force+ $shimEnvironment = @{+ PATH = "$fakeBin;$systemPath"+ TEMP = $shimTemp+ TMP = $shimTemp+ FAKE_CURL_LOG = $curlLog+ FAKE_POWERSHELL_LOG = $powerShellLog+ FAKE_CURL_MODE = 'fail'+ }+ $result = Invoke-Program "$env:SystemRoot\System32\cmd.exe" @('/d', '/c', $shimCopy, '-Release', 'v1.2.3') $shimEnvironment+ if ($result.ExitCode -ne 1) { throw "install.bat returned $($result.ExitCode) after a failed download" }+ if (Test-Path -LiteralPath $powerShellLog) { throw 'install.bat ran a partial download' }+ if (@(Get-ChildItem -LiteralPath $shimTemp -Force).Count -ne 0) { throw 'install.bat left its partial download behind' }+ $curlArgs = ConvertFrom-ArgumentLog ([System.IO.File]::ReadAllLines($curlLog)[0])+ if (($curlArgs[0..6] -join ' ') -cne '--proto =https --proto-redir =https --tlsv1.2 -fsSL -o' -or $curlArgs[8] -cne 'https://setup.agpt.co/install.ps1' -or $curlArgs.Count -ne 9) {+ throw "unexpected install.bat curl arguments: $($curlArgs -join ' ')"+ }++ $shimEnvironment['FAKE_CURL_MODE'] = 'ok'+ $shimEnvironment['FAKE_POWERSHELL_EXIT'] = '3'+ $result = Invoke-Program "$env:SystemRoot\System32\cmd.exe" @('/d', '/c', $shimCopy, '-Release', 'v1.2.3') $shimEnvironment+ if ($result.ExitCode -ne 3) { throw "install.bat did not pass on the installer's exit code: $($result.ExitCode)" }+ $ran = [System.IO.File]::ReadAllLines($powerShellLog)+ $ranArgs = ConvertFrom-ArgumentLog $ran[0]+ if (($ranArgs[0..3] -join ' ') -cne '-NoProfile -ExecutionPolicy Bypass -File' -or ($ranArgs[5..6] -join ' ') -cne '-Release v1.2.3' -or $ranArgs.Count -ne 7 -or $ran[1] -cne 'target-existed') {+ throw "install.bat did not run the downloaded installer as expected: $($ran -join ' | ')"+ }+ if ($ranArgs[4] -notmatch ('^' + [regex]::Escape($shimTemp) + '\\autogpt-install-[0-9]+\.ps1$')) { throw "unexpected install.bat temp file: $($ranArgs[4])" }+ if (@(Get-ChildItem -LiteralPath $shimTemp -Force).Count -ne 0) { throw 'install.bat left the installer behind' }++ Write-Host "installer PowerShell tests passed ($($PSVersionTable.PSEdition) $($PSVersionTable.PSVersion))"+} finally {+ foreach ($junction in $junctions) { [System.IO.Directory]::Delete($junction) }+ Remove-Item -LiteralPath $root -Recurse -Force -ErrorAction SilentlyContinue+}diff --git a/autogpt_platform/single-container/Dockerfile b/autogpt_platform/single-container/Dockerfileindex 145760f87a..780bf0090e 100644--- a/autogpt_platform/single-container/Dockerfile+++ b/autogpt_platform/single-container/Dockerfile@@ -268,7 +268,7 @@ ARG IMAGE_VERSION=devARG VCS_REF=unknownLABEL org.opencontainers.image.title="AutoGPT Platform single-container" \- org.opencontainers.image.description="Experimental single-node AutoGPT Platform distribution" \+ org.opencontainers.image.description="Single-node AutoGPT Platform distribution" \org.opencontainers.image.source="https://github.com/Significant-Gravitas/AutoGPT" \org.opencontainers.image.licenses="LicenseRef-PolyForm-Shield-1.0.0 AND SSPL-1.0" \org.opencontainers.image.version="${IMAGE_VERSION}" \diff --git a/autogpt_platform/single-container/README.md b/autogpt_platform/single-container/README.mdindex 1861c980ac..f4fada9e48 100644--- a/autogpt_platform/single-container/README.md+++ b/autogpt_platform/single-container/README.md@@ -4,7 +4,7 @@ Run the AutoGPT Platform in one container. The image bundles the web app, APIs,workers, PostgreSQL, RabbitMQ, a three-node Valkey cluster, and FalkorDB-backedmemory while persisting runtime data under `/data`.-> This single-node distribution is experimental. It is intended for local and+> This single-node distribution is intended for local and> small self-hosted installations, not high-availability deployments.## Quick start@@ -40,9 +40,13 @@ After creating your account, promote it to administrator:docker exec autogpt autogpt-admin promote [email protected]```-Then recreate the container with `AUTH_ALLOW_NEW_ACCOUNTS=false` to close-registration. Keep the same `autogpt-data` volume so accounts, agents, memory,-and generated application secrets survive container replacement.+Sign out and back in so your session picks up the administrator role.++Then close registration: stop and remove the container+(`docker stop autogpt && docker rm autogpt`) and repeat the quick-start command+with `-e AUTH_ALLOW_NEW_ACCOUNTS=false` added. Keep the same `autogpt-data`+volume so accounts, agents, memory, and generated application secrets survive+container replacement.## Stopping@@ -54,9 +58,16 @@ state may therefore require normal crash recovery on the next boot.Agent runs that are still executing are abandoned and may remain displayed as`RUNNING`. They are not resumed on the next boot, so start a new run.-Supervisor's process names are group-qualified inside the container — use-`supervisorctl status` to see them (`runtime:rest`, `state:postgres`, and so-on) rather than assuming a bare name.+Supervisor's process names are group-qualified inside the container+(`runtime:rest`, `state:postgres`, and so on). List them with the appliance's+own Supervisor configuration rather than assuming a bare name:++```bash+docker exec autogpt supervisorctl \+ -c /opt/autogpt/single-container/supervisor/supervisord.conf status+```++The one-shot `runtime:bootstrap` shows `EXITED` after a successful start.## Configuration@@ -64,30 +75,56 @@ on) rather than assuming a bare name.example, publishing host port `8080` requires`AUTOGPT_PUBLIC_URL=http://localhost:8080` and `-p 127.0.0.1:8080:3000`.+For LAN or remote access, keep the loopback binding, put a TLS reverse proxy in+front of it, and set `AUTOGPT_PUBLIC_URL` to the proxy's `https://` origin.+Close signup before you expose the app.+Configure model providers and optional integrations with environment variables.-The FalkorDB service always runs, while Graphiti memory is enabled by the-image's default feature configuration; memory extraction also needs a-configured chat model and embedding provider.+AutoPilot's default remote profile uses `OPEN_ROUTER_API_KEY` for chat and+memory extraction and `OPENAI_API_KEY` for embeddings; the canonical guide+below also covers direct Anthropic and local-model profiles. The+[environment template](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/single-container/.env.example)+lists common settings for `--env-file`. The FalkorDB service always runs, while+Graphiti memory is enabled by the image's default feature configuration; memory+extraction also needs a configured chat model and embedding provider.The image supports `linux/amd64` and `linux/arm64`. Test installations usedabout 5–6 GiB of memory during startup and steady-state health checks, though-actual usage depends on enabled services and workloads.+actual usage depends on enabled services and workloads. On Docker Desktop, give+its VM more memory than that (Settings → Resources, or `.wslconfig` with the+Windows WSL 2 backend).-ChatGPT/Codex temporary auth homes use `/dev/shm/autogpt-codex` automatically.-The quick-start command's `--shm-size 2g` keeps that credential material in-memory rather than the container's writable layer.+The quick-start command's `--shm-size 2g` raises the container's `/dev/shm`+above Docker's 64 MB default; the bundled PostgreSQL and browser tooling both+use shared memory.## Tags- `latest` — most recent fully verified AutoGPT Platform release.-- `vX.Y.Z` — immutable AutoGPT Platform release.-- `sha-<git-sha>` — immutable build for an exact source revision.+- `vX.Y.Z` — immutable image for GitHub release `autogpt-platform-beta-vX.Y.Z`.+- `sha-<git-sha>` — immutable build for the exact source revision of a release.`canary-sha-*` tags are unsupported pre-release validation artifacts.+## Upgrading++Pin a `vX.Y.Z` tag instead of `latest` to choose when you upgrade, and read that+release's notes on the+[releases page](https://github.com/Significant-Gravitas/AutoGPT/releases)+first.++Follow the canonical guide's upgrade steps: pull the new image while the old one+runs, take a cold backup, remove the stopped container, and repeat the+quick-start command with the new tag and the same `autogpt-data` volume. The+first boot of a new version applies database migrations, so let it reach+`healthy` before stopping it. To roll back, restore the pre-upgrade backup into+a new volume and run the previous image. Never start an older image on a volume+that a newer one has migrated.+## More information- [Canonical single-container operations guide](https://docs.agpt.co/platform/self-hosting/single-container)+- [Release notes](https://github.com/Significant-Gravitas/AutoGPT/releases)- [AutoGPT repository](https://github.com/Significant-Gravitas/AutoGPT)- [Security policy](https://github.com/Significant-Gravitas/AutoGPT/security/policy)- [License](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/LICENSE.md)diff --git a/docs/home/README.md b/docs/home/README.mdindex 66d96c7e02..8c3d4a0eca 100644--- a/docs/home/README.md+++ b/docs/home/README.md@@ -29,7 +29,7 @@ layout:-<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><h4><i class="fa-leaf">:leaf:</i></h4></td><td><strong>AutoGPT Platform</strong></td><td>Get started with the developer platform in 5 minutes.</td><td><a href="https://app.gitbook.com/o/ouZP6hgdu8LtbWil2Hvb/s/iMDOYkb9SC1mijdHzvKF/">AutoGPT Platform</a></td><td><a href=".gitbook/assets/AGPT_Platform.png">AGPT_Platform.png</a></td></tr><tr><td><h4><i class="fa-server">:server:</i></h4></td><td><strong>Integrations</strong></td><td>Learn more about hosting the developer platform.</td><td><a href="https://app.gitbook.com/o/ouZP6hgdu8LtbWil2Hvb/s/InwWrtMw9tc0NCzvPVK4/">Integrations</a></td><td><a href=".gitbook/assets/Integrations.png">Integrations.png</a></td></tr><tr><td><h4><i class="fa-terminal">:terminal:</i></h4></td><td><strong>Contribute</strong></td><td>Browse, test, and implement APIs.</td><td><a href="https://app.gitbook.com/s/x9A8W5T9IXYWENaFbHqO/">Contributing to the Docs</a></td><td><a href=".gitbook/assets/Contribute.png">Contribute.png</a></td></tr></tbody></table>+<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><h4><i class="fa-leaf">:leaf:</i></h4></td><td><strong>AutoGPT Platform</strong></td><td>Get started with the developer platform in 5 minutes.</td><td><a href="https://app.gitbook.com/o/ouZP6hgdu8LtbWil2Hvb/s/iMDOYkb9SC1mijdHzvKF/">AutoGPT Platform</a></td><td><a href=".gitbook/assets/AGPT_Platform.png">AGPT_Platform.png</a></td></tr><tr><td><h4><i class="fa-server">:server:</i></h4></td><td><strong>Integrations</strong></td><td>Browse the blocks and integrations your agents can use.</td><td><a href="https://app.gitbook.com/o/ouZP6hgdu8LtbWil2Hvb/s/InwWrtMw9tc0NCzvPVK4/">Integrations</a></td><td><a href=".gitbook/assets/Integrations.png">Integrations.png</a></td></tr><tr><td><h4><i class="fa-terminal">:terminal:</i></h4></td><td><strong>Contribute</strong></td><td>Browse, test, and implement APIs.</td><td><a href="https://app.gitbook.com/s/x9A8W5T9IXYWENaFbHqO/">Contributing to the Docs</a></td><td><a href=".gitbook/assets/Contribute.png">Contribute.png</a></td></tr></tbody></table>{% columns %}{% column valign="middle" %}@@ -37,7 +37,11 @@ layout:{% endcolumn %}{% column %}-<p align="center"><a href="https://app.gitbook.com/s/dDGesk9atyMLUMMo4QuI/autogpt-classic/introduction">AutoGPT Classic (Local Installation)</a></p>+<p align="center"><a href="https://agpt.co/docs/platform/self-hosting/single-container">Self-Host with Docker</a></p>+{% endcolumn %}++{% column %}+<p align="center"><a href="https://app.gitbook.com/s/dDGesk9atyMLUMMo4QuI/autogpt-classic/introduction">AutoGPT Classic (unsupported)</a></p>{% endcolumn %}{% endcolumns %}diff --git a/docs/platform/SUMMARY.md b/docs/platform/SUMMARY.mdindex fe16b8bdf1..904fd8a6ff 100644--- a/docs/platform/SUMMARY.md+++ b/docs/platform/SUMMARY.md@@ -19,8 +19,8 @@## Self-Hosting* [Setting Up AutoGPT (Self-Host)](getting-started.md)+* [Run AutoGPT in One Docker Container](single-container.md)* [AutoGPT Platform Installer](installer.md)-* [Run AutoGPT in One Docker Container (Experimental)](single-container.md)* [Advanced Setup](advanced_setup.md)## Tutorialsdiff --git a/docs/platform/advanced_setup.md b/docs/platform/advanced_setup.mdindex 2c68a2cd2c..bf0658bd9d 100644--- a/docs/platform/advanced_setup.md+++ b/docs/platform/advanced_setup.md@@ -4,66 +4,42 @@ The advanced steps below are intended for people with sysadmin experience. If yo## Introduction-For the advanced setup, first follow the [basic setup guide](../platform/getting-started.md) to get the server up and running. Once you have the server running, you can follow the steps below to configure the server for your specific needs.+For the advanced setup, first follow the [manual setup](getting-started.md#manual-setup) to get the server up and running. Once you have the server running, you can follow the steps below to configure the server for your specific needs. These steps apply to the Docker Compose setup; the [single-container image](single-container.md) is configured with the environment variables you pass to `docker run`.## Configuration### Setting config via environment variables-The server uses environment variables to store configs. You can set these environment variables in a `.env` file in the root of the project. The `.env` file should look like this:+The server uses environment variables to store configs. Each part of the platform reads its own `.env` file inside `autogpt_platform/`:-```bash-# .env-KEY1=value1-KEY2=value2-```--The server will automatically load the `.env` file when it starts. You can also set the environment variables directly in your shell. Refer to your operating system's documentation on how to set environment variables in the current session.+- `backend/.env` for the backend services+- `frontend/.env` for the frontend+- `.env` for Docker Compose itself-The valid options are listed in `.env.default` in the root of the builder and server directories. You can copy the `.env.default` file to `.env` and modify the values as needed.+The valid options are listed, with a comment for each, in the `.env.default` file next to each `.env`. `make init-env` creates any missing `.env` from its `.env.default` and generates the secrets that `.env.default` leaves blank:```bash-# Copy the .env.default file to .env-cp .env.default .env+cd autogpt_platform+make init-env```-### Secrets directory--The secret directory is located at `./secrets`. You can store any secrets you need in this directory. The server will automatically load the secrets when it starts.--An example for a secret called `my_secret` would look like this:+Then edit the `.env` files to change what you need. Do not copy `.env.default` over an existing `.env`: that erases your generated `ENCRYPTION_KEY`, and the integration credentials stored under it can no longer be read.-```bash-# ./secrets/my_secret-my_secret_value-```--This is useful when running on docker so you can copy the secrets into the container without exposing them in the Dockerfile.+With Docker Compose, the `environment:` entries in `docker-compose.platform.yml` take precedence over the `.env` files. They connect the services to each other by their Compose names and set the database URLs, so change those settings in `docker-compose.platform.yml`. When you run the backend outside Docker, you can also set the environment variables directly in your shell. Refer to your operating system's documentation on how to set environment variables in the current session.## Database selection-### PostgreSQL-We use PostgreSQL (with the pgvector extension) as the database. You will swap the commands you use to generate and run prisma to the following+We use PostgreSQL 15 with the pgvector extension as the database. Docker Compose runs it as the `db` service, keeps its data in `autogpt_platform/data/db/data`, and applies the Prisma migrations through the `migrate` service every time you run `docker compose up`.-```bash-poetry run prisma generate --schema postgres/schema.prisma-```+To use your own PostgreSQL server instead:-This will generate the Prisma client for PostgreSQL. You will also need to run the PostgreSQL database in a separate container. You can use the `docker-compose.yml` file in the `rnd` directory to run the PostgreSQL database.+1. Make sure the `vector` and `pg_trgm` extensions are available on it; the migrations create them.+2. Run `autogpt_platform/db/init/00-init.sql` against the database once. It creates the `platform` schema and an empty `auth.users` table that older migrations reference.+3. Point `DATABASE_URL` and `DIRECT_URL` at it, keeping `schema=platform` (in `docker-compose.platform.yml` under Docker, or in `backend/.env` when you run the backend directly), and point the frontend's `DATABASE_URL` at the same database.-```bash-cd autogpt_platform/-docker compose up -d --build-```--You can then run the migrations from the `backend` directory.--```bash-cd ../backend-prisma migrate dev --schema postgres/schema.prisma-```+The `migrate` service, or `make migrate` outside Docker, then applies the migrations.## Redis@@ -87,75 +63,4 @@ In the Compose stack, `REDIS_HOST`, `REDIS_PORT` and `REDIS_USE_ANNOUNCED_ADDRES## AutoGPT Agent Server Advanced set up-This guide walks you through a dockerized set up, with an external DB (postgres)--### Setup--We use the Poetry to manage the dependencies. To set up the project, follow these steps inside this directory:--0. Install Poetry- ```sh- pip install poetry- ```--1. Configure Poetry to use .venv in your project directory- ```sh- poetry config virtualenvs.in-project true- ```--2. Enter the poetry shell-- ```sh- poetry shell- ```--3. Install dependencies-- ```sh- poetry install- ```--4. Copy .env.default to .env-- ```sh- cp .env.default .env- ```--5. Generate the Prisma client-- ```sh- poetry run prisma generate- ```-- > In case Prisma generates the client for the global Python installation instead of the virtual environment, the current mitigation is to just uninstall the global Prisma package:- >- > ```sh- > pip uninstall prisma- > ```- >- > Then run the generation again. The path _should_ look something like this:- > `<some path>/pypoetry/virtualenvs/backend-TQIRSwR6-py3.12/bin/prisma`--6. Run the postgres database from the /rnd folder-- ```sh- cd autogpt_platform/- docker compose up -d- ```--7. Run the migrations (from the backend folder)-- ```sh- cd ../backend- prisma migrate deploy- ```--### Running The Server--#### Starting the server directly--Run the following command:--```sh-poetry run app-```+To run the backend server outside Docker with Poetry, follow [Backend Development](getting-started.md#backend-development).diff --git a/docs/platform/copilot-local-llm.md b/docs/platform/copilot-local-llm.mdindex 81a4e75f0a..fc690d8cb7 100644--- a/docs/platform/copilot-local-llm.md+++ b/docs/platform/copilot-local-llm.md@@ -65,7 +65,9 @@ the pre-catalog behavior; your env vars stay authoritative. See## Required environment variables-In `autogpt_platform/backend/.env`:+In `autogpt_platform/backend/.env` (for the single-container image, the same+lines go in its `--env-file`; see+[Run AutoGPT in One Docker Container](single-container.md#ollama-or-another-local-openai-compatible-server)):```bash# Turn on the local transport@@ -338,7 +340,7 @@ copilot_executor log for the upstream error. Common causes:→ free RAM (stop ClamAV, raise VM memory) or pick a smaller model- `model "..." not found` → `ollama pull <slug>` first- `connection refused` → containers can't reach the host on `:11434`;- see "Container → host networking" above+ see "Networking — same host, different host, or remote" above**`api_key` is `None` even though I set `OPENAI_API_KEY`** — by design.The local transport requires an explicit `CHAT_API_KEY` so a stray clouddiff --git a/docs/platform/create-basic-agent.md b/docs/platform/create-basic-agent.mdindex ffe654ba99..d6be2072d1 100644--- a/docs/platform/create-basic-agent.md+++ b/docs/platform/create-basic-agent.md@@ -10,20 +10,32 @@ This guide walks through creating a simple question-answer AI agent using AutoGPIf you're using the cloud-hosted version at [agpt.co](https://agpt.co), you're ready to go! AI blocks come with **built-in credits** — no API keys required to get started. If you'd prefer to use your own API keys, you can add them via **Profile → Integrations**.### **Self-Hosted (Docker)**-If you're running AutoGPT locally with Docker, you'll need to add your own API keys to `autogpt_platform/backend/.env`:+If you're running AutoGPT yourself, you'll need to add your own API keys. Where they go depends on how you installed it.++**Docker Hub image** (`significantgravitas/autogpt`): the backend reads these keys from the container's environment. Put them in an environment file, for example `autogpt.env` (or pass each one with `-e`):```bash-# Create or edit backend/.env+# autogpt.envOPENAI_API_KEY=sk-your-key-hereANTHROPIC_API_KEY=sk-ant-your-key-here# Add other provider keys as needed```-After adding keys, restart the services:+Then replace the container so it starts with those keys, keeping the same `autogpt-data` volume:+```bash+docker stop autogpt && docker rm autogpt+# then rerun your original docker run command with --env-file autogpt.env added+```++**Appliance installer**: add the keys to the installer's private `autogpt.env`, then recreate the container as described in [Runtime Configuration](installer.md#runtime-configuration).++**Docker Compose from source**: add the same keys to `autogpt_platform/backend/.env`, then restart the services from `autogpt_platform/`:```bashdocker compose down && docker compose up -d```+AutoPilot has its own provider settings; see [Models and memory](single-container.md#models-and-memory).+**Note:** The Calculator example below doesn't require any API credentials — it's a good way to test your setup before adding AI blocks.## **Example Agent: Q&A (with AI)**diff --git a/docs/platform/download-agent-from-marketplace-local.md b/docs/platform/download-agent-from-marketplace-local.mdindex 22e2122620..ee6fd480cc 100644--- a/docs/platform/download-agent-from-marketplace-local.md+++ b/docs/platform/download-agent-from-marketplace-local.md@@ -6,36 +6,27 @@ This guide explains how to download an agent from the AutoGPT marketplace and im<center><iframe width="560" height="315" src="https://www.youtube.com/embed/eTg2kbJdBIw?si=v1npcr8HDiInvUPw" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></center>## **Prerequisites**-* A local installation of AutoGPT-* Access to the marketplace for local hosters+* A running self-hosted AutoGPT instance+* Access to the public marketplace at [platform.agpt.co/marketplace](https://platform.agpt.co/marketplace)## **Step-by-Step Process**-### **1. Access the Marketplace**-* Navigate to the marketplace section- * Note: The interface will differ from the cloud-hosted platform--### **2. Download the Agent**-1. Browse and select your desired agent-2. Click on the agent to view details-3. Look for and click the "Download Agent" button-4. The agent file will save to your computer--### **3. Import the Agent**-1. Return to the Monitor tab-2. Locate the dropdown menu next to "Create"-3. Select "Import from File"-4. In the file selection dialog:- * Navigate to your downloaded agent file- * Select the file- * Click "Open"-5. Click "Import and Edit"--### **4. Verify Import**-* The agent should now appear in your Builder-* You can begin editing or using the imported agent+### **1. Download the Agent**+1. Open the public marketplace and click the agent you want+2. Under "Want to use this agent locally?", click **Download here**+3. The agent file (JSON) saves to your computer++### **2. Import the Agent**+1. In your self-hosted instance, open **Agents**+2. Click **Import**+3. On the **AutoGPT agent** tab, select the downloaded agent file+4. Check the agent name and description+5. Click **Upload**++### **3. Verify Import**+* The agent opens in the Builder+* It also appears in your **Agents** library## **Important Notes**-* The marketplace interface differs between local hosting and cloud-hosted versions-* Ensure you're following the local hosting specific steps-* The agent will be available in your Builder after successful import\ No newline at end of file+* Before running it, connect the credentials its blocks need under **Settings → Integrations**+* Deployment-level provider keys and OAuth app credentials are set as environment variables instead; see [Self-Hosted Credentials](integrations-and-credentials.md#self-hosted-credentials)\ No newline at end of filediff --git a/docs/platform/getting-started-cloud.md b/docs/platform/getting-started-cloud.mdindex 0b48ad249a..df2e26eb51 100644--- a/docs/platform/getting-started-cloud.md+++ b/docs/platform/getting-started-cloud.md@@ -5,7 +5,7 @@This guide will get you up and running on the hosted AutoGPT Platform at [platform.agpt.co](https://platform.agpt.co). No local installation or Docker setup is required — just sign up and start building.{% hint style="info" %}-Looking to self-host instead? See the [Self-Hosting Guide](getting-started.md).+Looking to self-host instead? Run the [single-container Docker image](single-container.md) or see the [Self-Hosting Guide](getting-started.md).{% endhint %}## Creating Your Accountdiff --git a/docs/platform/getting-started.md b/docs/platform/getting-started.mdindex c986328937..6782844bd4 100644--- a/docs/platform/getting-started.md+++ b/docs/platform/getting-started.md@@ -2,65 +2,147 @@## Introduction-This guide will help you setup the server and builder for the project.+This guide will help you set up AutoGPT on your own machine. There are two ways+to do it:++- **[Quick Setup with Docker](#quick-setup-with-docker)** runs the published+ image from Docker Hub: one container and no source checkout. Start here if+ you want to use AutoGPT.+- **[Manual Setup](#manual-setup)** clones the repository and builds every+ service with Docker Compose. Use it to develop AutoGPT, or to run each+ service in its own container.++{% hint style="warning" %}+**DO NOT FOLLOW ANY OUTSIDE TUTORIALS AS THEY WILL LIKELY BE OUT OF DATE**+{% endhint %}++## Quick Setup with Docker++The quickest way to self-host is the single-container image on Docker Hub,+[`significantgravitas/autogpt`](https://hub.docker.com/r/significantgravitas/autogpt).+It bundles the web app, APIs, workers, PostgreSQL, RabbitMQ, Valkey, and+FalkorDB-backed memory, and keeps all of its data in one Docker volume. The+image is meant for local and small installations, not+high-availability deployments.++### Prerequisites++You only need Docker: Docker Engine or Docker Desktop running Linux containers+on `amd64` or `arm64`. Git, Node.js, and Docker Compose are not required. Test+installations use about 5–6 GiB of memory, so plan for at least 8 GB of RAM+and about 25 GB of free disk. Docker Desktop caps its VM's memory: raise the+limit under **Settings → Resources**, or in `.wslconfig` on Windows with the+WSL 2 backend.-<!-- The video is listed in the root Readme.md of the repo -->+Install Docker from the [official Docker documentation](https://docs.docker.com/get-docker/),+start it, then verify that it is running:++```console+docker -v+docker info+```-<!--We also offer this in video format. You can check it out [here](https://github.com/Significant-Gravitas/AutoGPT?tab=readme-ov-file#how-to-setup-for-self-hosting). -->+### Running the image-!!! warning- **DO NOT FOLLOW ANY OUTSIDE TUTORIALS AS THEY WILL LIKELY BE OUT OF DATE**+```bash+docker run -d \+ --name autogpt \+ --restart unless-stopped \+ --shm-size 2g \+ --ulimit nofile=65536:65536 \+ --log-driver json-file \+ --log-opt max-size=50m \+ --log-opt max-file=5 \+ -p 127.0.0.1:3000:3000 \+ -e AUTOGPT_PUBLIC_URL=http://localhost:3000 \+ -v autogpt-data:/data \+ significantgravitas/autogpt:latest+```-## Prerequisites+`AUTOGPT_PUBLIC_URL` must match the address in your browser, so change both if+you publish a different port.-The single-container appliance's only product prerequisite is an installed,-running Docker CLI and daemon. Select a local Docker endpoint using Linux-containers on `amd64` or `arm64`. The Unix bootstrap also uses Bash, curl, and-`sha256sum` or `shasum`. Docker Compose, Git, Node.js, and NPM are not required-for the appliance installer.+On Windows, put the command on one line in PowerShell, or run it from a WSL 2+terminal.-Install Docker from the [official Docker documentation](https://docs.docker.com/get-docker/),-start it, then verify the selected daemon:+The first boot applies database migrations and can take several minutes. Don't+stop the container until Docker reports it as `healthy`:```console-docker -v-docker info+docker inspect --format '{{.State.Health.Status}}' autogpt+```++Then open [http://localhost:3000](http://localhost:3000), create your account,+and make it the administrator:++```bash+docker exec autogpt autogpt-admin promote [email protected]+```++Sign out and back in so your session picks up the administrator role.++Signup stays open to anyone who can reach the app, which is why the command+above publishes the port on `127.0.0.1` only. To close signup, remove the+container:++```bash+docker stop autogpt+docker rm autogpt```-## Quick Setup with the Appliance Installer+Then run the `docker run` command again with `-e AUTH_ALLOW_NEW_ACCOUNTS=false`+added. Keep the `autogpt-data` volume whenever you replace the container: it+holds your accounts, agents, memory, and generated secrets.++`latest` tracks the newest verified release. To pin a version, use an immutable+`vX.Y.Z` tag instead.-The release installer pulls and starts the published single-container-appliance: one Docker container, one loopback port, no source checkout. It-needs a running Docker daemon with Linux containers on `amd64` or `arm64`; it-does not install Docker or build AutoGPT from source. See-[the installer reference](installer.md) for details.+[Run AutoGPT in One Docker Container](single-container.md) covers model+providers, another port or a public URL, backups, upgrades, and+troubleshooting.-The hosted installer is not live yet: `setup.agpt.co/install.sh` still serves-the Compose installer, and the appliance image tags are not public until the-[release gates](installer.md#maintainer-release-gates) pass. This first release-supports Linux and macOS. Until then, and on Windows, use the-[from-source setup](#manual-setup) below, which is also the path that supports-a fully offline install with a local LLM.+### Appliance installer+The [appliance installer](installer.md#install) wraps these steps in one command+for Linux, macOS, and Windows: it checks your Docker setup, pins the pulled+image by digest, and keeps its configuration in a private directory.## Manual Setup+The manual setup clones the repository, builds every service from source, and+runs each one in its own container with Docker Compose. The `setup-autogpt.sh`+and `setup-autogpt.bat` scripts described in+[the installer reference](installer.md#installing-from-source-compose) run the+same steps for you and can also set up a local Ollama model.++{% hint style="warning" %}+Docker Compose publishes PostgreSQL, Redis, RabbitMQ, and every backend service+port on all network interfaces. Redis has no password, PostgreSQL and RabbitMQ+use the default passwords from this repository, and signup is open. Run the+stack on a machine and network you trust.+{% endhint %}+### Development prerequisites-The manual source checkout requires-[Git](https://git-scm.com/downloads),-[Node.js and NPM](https://nodejs.org/en/download/), Docker, and-[Docker Compose](https://docs.docker.com/compose/install/). Verify them before-continuing:+The manual setup needs [Git](https://git-scm.com/downloads), Docker with+[Docker Compose](https://docs.docker.com/compose/install/), `make`, and+Python 3, which `make init-env` uses to generate your secrets. Node.js is only+needed to run the frontend outside Docker (see [Development](#development)) or+to migrate an older Supabase-based install. Verify the rest before continuing:```consolegit --version-node -v-npm -vdocker -vdocker compose version+make --version+python3 --version```+On Windows, where `make` is usually not installed, clone the repository as+below, then run `autogpt_platform\installer\setup-autogpt.bat` instead of the+remaining steps. It creates the `.env` files, generates the secrets, and starts+the stack.+### Cloning the RepositoryThe first step is cloning the AutoGPT repository to your computer.To do this, open a terminal window in a folder on your computer and run:@@ -117,8 +199,8 @@ Inside the `autogpt_platform` directory, you can use:| Command | What it Does ||------------------------|-------------------------------------------------------------------------------|| `make init-env` | Create missing `.env` files from `.env.default` (`autogpt_platform`, `backend`, and `frontend`) and generate the secrets they leave blank |-| `make start-core` | Start just the core services (Postgres, Redis, RabbitMQ) in background |-| `make stop-core` | Stop the core services |+| `make start-core` | Start the services the backend needs (Postgres, Redis, RabbitMQ, ClamAV, FalkorDB) in background and apply the database migrations |+| `make stop-core` | Stop every running service in the stack || `make logs-core` | Tail the logs for core services || `make format` | Format & lint backend (Python) and frontend (TypeScript) code || `make migrate` | Run backend database migrations |@@ -146,7 +228,7 @@ You can always check available Makefile recipes by running:```shmake help```-(or just inspecting the `Makefile` in the repo root).+(or just inspecting `autogpt_platform/Makefile`).---@@ -158,9 +240,9 @@ You can check if the server is running by visiting [http://localhost:3000](http:By default the application for different services run on the following ports:-Frontend UI Server: 3000-Backend Websocket Server: 8001-Execution API Rest Server: 8006+- Frontend UI Server: 3000+- Backend Websocket Server: 8001+- Execution API Rest Server: 8006### Upgrading: secrets are generated per install@@ -168,11 +250,14 @@ Execution API Rest Server: 8006come with a value in `.env.default`, so every install that did not set its ownran on the same three values. They are now blank there and generated for eachinstall, and the backend **does not start** without an `ENCRYPTION_KEY` or-with the one `.env.default` used to contain.+with the one `.env.default` used to contain. This applies to Docker Compose+installs; the Docker Hub image generates its own secrets on first boot and+keeps them in its data volume.-A fresh install needs nothing beyond `make init-env` (or the installer script,-which does the same). An install that already set its own values needs-nothing either. Follow the steps below if you are upgrading an install that+A fresh install needs nothing beyond `make init-env` (or+`installer/setup-autogpt.sh` / `setup-autogpt.bat`, which do the same). An+install that already set its own values needs nothing either. Follow the steps+below if you are upgrading an install that- has no `autogpt_platform/backend/.env`, or one without an `ENCRYPTION_KEY`line — it was running on the value from `.env.default`; or@@ -235,8 +320,8 @@ move them to the new key instead of losing them. Run everything frompython3 single-container/runtime_config.py fill-env --path frontend/.env```- Do not re-run the installer script for this: it also starts the stack,- which is step 5.+ Do not re-run `setup-autogpt.sh` or `setup-autogpt.bat` for this: they also+ start the stack, which is step 5.4. Re-encrypt what is stored. Build the new images and bring the database upto date first; `migrate` starts the database on its own:diff --git a/docs/platform/installer.md b/docs/platform/installer.mdindex b24e751983..07cb9a4101 100644--- a/docs/platform/installer.md+++ b/docs/platform/installer.md@@ -15,28 +15,20 @@ Before running the installer:- Install and start Docker from the[official Docker Engine](https://docs.docker.com/engine/install/) or[Docker Desktop](https://docs.docker.com/desktop/) documentation.-- Select a local `unix://` Docker endpoint on Linux or macOS. Remote and- non-Unix contexts are rejected.+- Select a local Docker endpoint: `unix://` on Linux and macOS, `npipe://` on+ Windows. Remote and TCP contexts are rejected.- Configure the daemon for Linux containers on `amd64` or `arm64`.- Allow about 25 GB of free disk; at least 8 GB RAM is recommended.+- Have Bash, curl, and `sha256sum` or `shasum` available for the bootstrap, or+ PowerShell and `curl.exe` on Windows. Docker Compose, Git, Node.js, and npm+ are not required.Docker Desktop is a separate product with its own license terms. AutoGPT doesnot install it or grant a Docker license.-## Install (After the Release Gates Pass)+## Install-> [!WARNING]-> Do not use the hosted command yet. `setup.agpt.co/install.sh` still serves-> the legacy Compose installer, and the appliance image tags are not public.-> Maintainers must complete every-> [release gate](#maintainer-release-gates) before exposing these commands in-> the README or getting-started guide.--This first appliance-installer release supports Linux and macOS. Windows is-intentionally withheld until its standard-user filesystem checks and native-Docker argument handling are validated; use the manual setup guide there.--The command below uses a unique temporary file, executes it only after the HTTPS+Each command below uses a unique temporary file, executes it only after the HTTPSdownload succeeds, and removes it afterward. Do not stream a network responsedirectly into a shell.@@ -52,25 +44,44 @@ directly into a shell.)```+### Windows++```powershell+& {+ $installer = Join-Path ([IO.Path]::GetTempPath()) "autogpt-install-$([guid]::NewGuid().ToString('N')).ps1"+ try {+ curl.exe --proto '=https' --proto-redir '=https' --tlsv1.2 -fsSL -o $installer https://setup.agpt.co/install.ps1+ if ($LASTEXITCODE -eq 0) {+ powershell.exe -NoProfile -ExecutionPolicy Bypass -File $installer+ }+ } finally {+ Remove-Item -LiteralPath $installer -Force -ErrorAction SilentlyContinue+ }+}+```+### Options-| Goal | Linux/macOS |-| --- | --- |-| Current published appliance | _(no flag)_ |-| Specific published version | `--release=vX.Y.Z` |-| Appliance release-tag form | `--release=autogpt-platform-beta-vX.Y.Z` |-| Hardware and Docker checks only | `--preflight-only` |-| Print image selection only | `--resolve-only` |-| Skip RAM/disk checks | `--skip-preflight` |-| Custom private state directory | `--dir=PATH` |+Add a flag after `bash "$installer"` on Linux and macOS, or after+`-File $installer` on Windows.++| Goal | Linux/macOS | Windows |+| --- | --- | --- |+| Current published appliance | _(no flag)_ | _(no flag)_ |+| Specific published version | `--release=vX.Y.Z` | `-Release vX.Y.Z` |+| Appliance release-tag form | `--release=autogpt-platform-beta-vX.Y.Z` | `-Release autogpt-platform-beta-vX.Y.Z` |+| Hardware and Docker checks only | `--preflight-only` | `-PreflightOnly` |+| Print image selection only | `--resolve-only` | `-ResolveOnly` |+| Skip RAM/disk checks | `--skip-preflight` | `-SkipPreflight` |+| Custom private state directory | `--dir=PATH` | `-Dir PATH` |`--skip-preflight` does not skip the local-endpoint, Linux-container, orarchitecture checks.The default state directory is `$XDG_CONFIG_HOME/autogpt`, or-`$HOME/.config/autogpt` when `XDG_CONFIG_HOME` is unset. A custom directory-must be user-owned and private; the installer rejects symlink paths and shared-or unsafe locations.+`$HOME/.config/autogpt` when `XDG_CONFIG_HOME` is unset, and+`%LOCALAPPDATA%\AutoGPT` on Windows. A custom directory must be user-owned and+private; the installer rejects symlink paths and shared or unsafe locations.## Artifact and Runtime Contract@@ -148,34 +159,35 @@ behind a TLS reverse proxy and set `AUTOGPT_PUBLIC_URL` to the exact public URL.## Upgrades-Before an upgrade, back up `autogpt-platform-data`. Stop and remove only the+Before an upgrade, back up `autogpt-platform-data` as described in+[Cold backup](single-container.md#cold-backup). Stop and remove only the`autogpt` container, then rerun the installer with the intended release. Theinstaller will reuse the named volume only when its ownership labels and theprivate installer identity still match.## Maintainer Release Gates-Repository CI cannot prove the public bootstrap handoff. Do not publish or-announce the installation commands until every external gate below passes:--- Deploy the new repository `install.sh` through the Caddy or object-storage- configuration behind `setup.agpt.co`. The endpoint must no longer serve the- legacy clone/Compose installer.-- Publish `significantgravitas/autogpt:vX.Y.Z` and `:latest` only after the- multi-architecture workflow smoke-tests and scans both runnable images.-- Ensure the appliance release's tag commit contains the full installer,- publication workflow, and helper, then verify the release-triggered run.- Manual development dispatches publish SHA artifacts, not the release channel- used by this installer.-- Verify both public tags expose Linux `amd64` and `arm64` manifests and the- expected OCI identity:+`https://setup.agpt.co/install.sh`, `https://setup.agpt.co/install.ps1`, and+`https://setup.agpt.co/install.bat` redirect to the files of the same name in+`autogpt_platform/installer/` on `master`, so the hosted installers change+whenever those files change on `master`. Repository CI cannot prove this public+bootstrap handoff, so each release must keep every gate below passing:++- Only a published, non-prerelease `autogpt-platform-beta-vX.Y.Z` release+ publishes images. Its run smoke-tests and scans both architectures, then+ pushes `sha-<commit>` and `vX.Y.Z` and moves `:latest` forward. Pushes to+ `dev` and manual dispatches build, test, and scan without publishing.+- The release's tag commit contains the full installer, publication workflow,+ and helper, and its release-triggered run succeeded.+- Both public tags expose Linux `amd64` and `arm64` manifests and the expected+ OCI identity:```bashdocker buildx imagetools inspect significantgravitas/autogpt:vX.Y.Zdocker buildx imagetools inspect significantgravitas/autogpt:latest```-- Fetch the hosted installer into a new temporary file from an external+- Fetch each hosted installer into a new temporary file from an externalmachine and compare it with the released repository file. On each supportedoperating system, perform a clean install against the public image, wait forhealth, verify the loopback endpoint, rerun to prove exact-contract@@ -184,9 +196,9 @@ announce the installation commands until every external gate below passes:## Installing from source (Compose)The scripts below are the other supported path: they clone the repository and-start every service with Docker Compose. Use them on Windows, for development,-or for a fully offline install with a local LLM. The appliance described above-is the image documented in+start every service with Docker Compose. Use them for development, or for a+fully offline install with a local+LLM. The appliance described above is the image documented in[Run AutoGPT in one Docker container](single-container.md); these scripts donot use it.@@ -197,7 +209,10 @@ If you prefer, you can manually download and run the installer scripts:- **Linux/macOS:** `setup-autogpt.sh`- **Windows:** `setup-autogpt.bat`-These scripts are located in the `autogpt_platform/installer/` directory.+These scripts are located in the `autogpt_platform/installer/` directory. Run+`./setup-autogpt.sh` or `setup-autogpt.bat` from there. Inside a clone, a+script uses that checkout; otherwise it clones the repository into a new+`AutoGPT` folder first.Both create the three `.env` files if they are missing and generate thesecrets `.env.default` leaves blank (`ENCRYPTION_KEY`,@@ -222,7 +237,7 @@ full reference.cd autogpt_platform/installer./setup-autogpt.sh --with-ollama# Optional overrides:-# --ollama-model=qwen3:14b-instruct-q4_K_M+# --ollama-model=qwen3:14b-q4_K_M# --ollama-host=http://gpu-rig.lab:11434 # use an existing Ollama```@@ -232,15 +247,15 @@ cd autogpt_platform/installercd autogpt_platform\installersetup-autogpt.bat /with-ollamaREM Optional overrides:-REM /ollama-model=qwen3:14b-instruct-q4_K_M+REM /ollama-model=qwen3:14b-q4_K_MREM /ollama-host=http://gpu-rig.lab:11434```The installer:1. Installs Ollama (skipped if already present, or if `--ollama-host` points at an existing one).-2. Configures `OLLAMA_HOST=0.0.0.0:11434` + `OLLAMA_CONTEXT_LENGTH=32768` so containers can reach it and so AutoPilot's ~8 k system prompt isn't truncated by Ollama's 4 k default.-3. Pulls the chat model (default `hf.co/unsloth/Qwen3.5-4B-GGUF:Q4_K_M`).+2. Configures `OLLAMA_HOST=0.0.0.0:11434` + `OLLAMA_CONTEXT_LENGTH=262144` so containers can reach it and so AutoPilot's ~8 k system prompt isn't truncated by Ollama's 4 k default; 262,144 tokens is the default model's native window.+3. Pulls the chat model (default `hf.co/ornith-ai/Ornith-1.5-9B-GGUF:Q4_K_M`).4. Appends a marker-bounded block to `autogpt_platform/backend/.env` with `CHAT_USE_LOCAL=true` plus the `CHAT_BASE_URL` / `CHAT_API_KEY` / `CHAT_*_MODEL` overrides.Re-running with `--with-ollama` is idempotent — the wiring block is rewritten in place.diff --git a/docs/platform/integrating/api-guide.md b/docs/platform/integrating/api-guide.mdindex 09b81f6638..da84bbbd59 100644--- a/docs/platform/integrating/api-guide.md+++ b/docs/platform/integrating/api-guide.md@@ -10,6 +10,10 @@ Full API documentation with interactive examples is available at:This Swagger UI documentation includes all available endpoints, request/response schemas, and allows you to try out API calls directly.+{% hint style="info" %}+**Self-hosting?** Use your own server instead of `backend.agpt.co`. With Docker Compose the External API is at `http://localhost:8006/external-api/v1/...` and its Swagger UI at `http://localhost:8006/external-api/docs`. The single-container image serves the API under your public URL at `/_agpt/external-api/v1/...` and does not expose the Swagger UI.+{% endhint %}+## Authentication MethodsThe External API supports two authentication methods:diff --git a/docs/platform/integrations-and-credentials.md b/docs/platform/integrations-and-credentials.mdindex 40a4ae80e4..b4a7b74449 100644--- a/docs/platform/integrations-and-credentials.md+++ b/docs/platform/integrations-and-credentials.md@@ -66,4 +66,4 @@ Removing a credential can break agents, workflows, or active webhooks that refer## Self-Hosted Credentials-When self-hosting, configure deployment-level provider keys and OAuth application credentials in `autogpt_platform/backend/.env`, then connect end-user accounts from **Settings → Integrations** as needed. See the [Self-Hosting Guide](getting-started.md) for details.+When self-hosting, configure deployment-level provider keys and OAuth application credentials as environment variables. For the [Docker Hub image](single-container.md), put them in the environment file you pass to `docker run --env-file`; for a Docker Compose or source install, put them in `autogpt_platform/backend/.env`. Register `<your AutoGPT URL>/auth/integrations/oauth_callback` (for example `http://localhost:3000/auth/integrations/oauth_callback`) as each OAuth app's redirect URI, then connect end-user accounts from **Settings → Integrations** as needed. See the [Self-Hosting Guide](getting-started.md) for details.diff --git a/docs/platform/ollama.md b/docs/platform/ollama.mdindex 41b0ae9e2b..a449b12a5c 100644--- a/docs/platform/ollama.md+++ b/docs/platform/ollama.md@@ -6,7 +6,7 @@ Follow these steps to set up and run Ollama with the AutoGPT platform.## Prerequisites-1. Make sure you have gone through and completed the [AutoGPT Setup](/platform/getting-started) steps, if not please do so before continuing with this guide.+1. Make sure you have gone through and completed the [AutoGPT Setup](getting-started.md) steps, if not please do so before continuing with this guide.2. Before starting, ensure you have [Ollama installed](https://ollama.com/download) on your machine.## Setup Steps@@ -113,7 +113,7 @@ Now that both Ollama and the AutoGPT platform are running, we can use Ollama wit> - `llama3.1:405b`> - `dolphin-mistral:latest`>- > **Note**: To use other models, follow the "Add Custom Models" step above.+ > **Note**: To use other models, follow [Add Custom Models (Advanced)](#add-custom-models-advanced) below.4. **Set your local IP address** in the "Ollama Host" field:@@ -200,6 +200,8 @@ Model definitions are centralized in the LLM catalog — see [Managing LLM Modeldocker compose up -d --build```+ The prebuilt single-container image cannot pick up a new catalog entry; build it from source as described in [Run AutoGPT in One Docker Container](single-container.md#get-an-image).+4. **Pull the model in Ollama**:```bashollama pull your-model-name@@ -227,7 +229,7 @@ If you encounter any issues, verify that:```bashollama pull llama3.2```-- If using a custom model, ensure it's added to the model list in `backend/api/model.py`+- If using a custom model, ensure it's registered in the LLM catalog (`autogpt_platform/backend/backend/data/llm_registry/catalog.py`) and `autogpt_platform/backend/backend/data/llm_registry/llm_models.py` as described in [Add Custom Models (Advanced)](#add-custom-models-advanced) above#### Docker Issues- Ensure Docker daemon is running:diff --git a/docs/platform/single-container.md b/docs/platform/single-container.mdindex 171c09faf9..1b53e2a5ae 100644--- a/docs/platform/single-container.md+++ b/docs/platform/single-container.md@@ -1,4 +1,4 @@-# Run AutoGPT in One Docker Container (Experimental)+# Run AutoGPT in One Docker ContainerThe image packages the AutoGPT Platform frontend and backend together withPostgreSQL, a three-node Valkey cluster, RabbitMQ, nginx, and FalkorDB.@@ -39,11 +39,11 @@ tag or manifest digest. Docker image tags map to source releases as follows:- `latest` points to the newest stable AutoGPT Platform release.- `vX.Y.Z` is the immutable image for GitHub release`autogpt-platform-beta-vX.Y.Z`.-- `sha-<git-sha>` is the immutable image for an exact `dev` or release source- revision.+- `sha-<git-sha>` is the immutable image for the exact source revision of a+ release. Each release publishes one for the commit it was built from; `dev`+ commits are built and tested in CI but not published.-Older `canary-sha-*` tags are legacy pre-release validation artifacts, not a-currently published or supported tag family.+`canary-sha-*` tags are unsupported pre-release validation artifacts.To build from source instead, run Docker Buildx Bake from the repository root:@@ -129,11 +129,11 @@ docker run --detach --name autogpt \"${IMAGE}"```-The `--shm-size 2g` allocation keeps temporary ChatGPT/Codex authentication-homes in memory instead of the container's writable layer. The `nofile` limit-sets a predictable per-process file-descriptor ceiling for the bundled services.-The JSON log options retain about five 50 MB files instead of allowing container-logs to grow without a bound.+The `--shm-size 2g` allocation raises the container's `/dev/shm` above Docker's+64 MB default; the bundled PostgreSQL and browser tooling both use shared+memory. The `nofile` limit sets a predictable per-process file-descriptor+ceiling for the bundled services. The JSON log options retain about five 50 MB+files instead of allowing container logs to grow without a bound.Wait for the complete appliance to become healthy:@@ -167,8 +167,11 @@ inspecting whether the migration's database changes completed.Test installations used about 5–6 GiB of memory during startup and steady-statehealth checks. This is measured guidance, not a guaranteed minimum; allowheadroom for enabled services, agents, local models, and workload growth. On-Docker Desktop, make sure the VM's memory allocation in **Settings → Resources**-exceeds that observed use and leaves the same headroom.+Docker Desktop for macOS or Linux, or Windows in Hyper-V mode, make sure the+VM's memory allocation in **Settings → Resources** exceeds that observed use and+leaves the same headroom. With the default WSL 2 backend on Windows, set the+limit with `memory=` under `[wsl2]` in `%UserProfile%\.wslconfig` instead, then+run `wsl --shutdown`.Open `http://localhost:3000`, create the intended account, and promote it:@@ -213,8 +216,16 @@ Agent runs still executing when the container stops are abandoned. Their queuemessages can be dropped and their execution rows can remain `RUNNING`, but theydo not resume. Start a new run after restart.-Supervisor process names are group-qualified. Use `supervisorctl status` to see-names such as `runtime:rest` and `state:postgres`.+Supervisor process names are group-qualified. Pass the appliance's Supervisor+configuration to see names such as `runtime:rest` and `state:postgres`:++```bash+docker exec autogpt supervisorctl \+ -c /opt/autogpt/single-container/supervisor/supervisord.conf status+```++`runtime:bootstrap` runs once per boot, so it shows `EXITED` after a successful+start.## Port and public URL@@ -407,23 +418,36 @@ CHAT_USE_LOCAL=trueCHAT_BASE_URL=http://host.docker.internal:11434/v1CHAT_API_KEY=ollamaCHAT_FAST_STANDARD_MODEL=hf.co/unsloth/Qwen3.5-4B-GGUF:Q4_K_M+GRAPHITI_LLM_MODEL=hf.co/unsloth/Qwen3.5-4B-GGUF:Q4_K_M+GRAPHITI_RERANKER_MODEL=hf.co/unsloth/Qwen3.5-4B-GGUF:Q4_K_M````CHAT_API_KEY` must be non-empty even if the local server ignores it. The-local transport makes Graphiti inherit the same base URL and API key. With the-default profile above, Graphiti rewrites its extraction and reranker models to-`hf.co/unsloth/Qwen3.5-4B-GGUF:Q4_K_M` and uses `nomic-embed-text` for-embeddings. If you choose another chat model, also set `GRAPHITI_LLM_MODEL`+local transport points Graphiti at the same base URL, and its extraction client+uses `CHAT_API_KEY`. Graphiti's own local default is+`hf.co/ornith-ai/Ornith-1.5-9B-GGUF:Q4_K_M`, so the two `GRAPHITI_*` lines keep+extraction and reranking on the 4B chat model; embeddings use+`nomic-embed-text`. If you choose another chat model, set `GRAPHITI_LLM_MODEL`and `GRAPHITI_RERANKER_MODEL` to a model that the endpoint serves. Set`GRAPHITI_EMBEDDER_MODEL` too when its embedding model uses another slug.+Graphiti's embedder prefers `CHAT_OPENAI_API_KEY` or `OPENAI_API_KEY` when+either is set, and sends that key to this endpoint. If you keep+`OPENAI_API_KEY` for blocks or transcription, also set+`GRAPHITI_EMBEDDER_API_KEY` to the value of `CHAT_API_KEY`.+On Docker Engine, add `--add-host host.docker.internal:host-gateway` to the run-command for this local-model profile. Docker Desktop provides that hostname-without the extra option. To apply the flag to an existing container, stop and-remove the container, then repeat the Quick start command with the same named-volume and the added flag. Small quantized models reduce memory requirements,-but latency and answer quality remain hardware-, model-, and workload-dependent;-select another compatible model when the default does not meet your needs.+command for this local-model profile. Ollama must then also listen on an+address the container can reach, because it binds only to `127.0.0.1` by+default: set `OLLAMA_HOST=0.0.0.0:11434` in the same service configuration as+`OLLAMA_CONTEXT_LENGTH`, and limit port `11434` with the host firewall to the+Docker bridge and other hosts you trust. Docker Desktop provides that hostname+and reaches the host's loopback without either change. To apply the flag to an+existing container, stop and remove the container, then repeat the Quick start+command with the same named volume and the added flag. Small quantized models+reduce memory requirements, but latency and answer quality remain hardware-,+model-, and workload-dependent; select another compatible model when the+default does not meet your needs.Check connectivity from the running appliance:@@ -1099,9 +1123,16 @@ docker logs --follow --tail 100 autogpt````GET /healthz` checks nginx only; it is not proof that the whole appliance is-ready. The watchdog allows 600 seconds for initial full health; if that deadline-expires, it stops the container and `--restart unless-stopped` begins another-startup attempt.+ready. Once bootstrap has applied migrations and published readiness, the+watchdog allows 600 seconds for initial full health; if that deadline expires,+it stops the container and `--restart unless-stopped` begins another startup+attempt.++After migrations, each boot also publishes the public skills catalog from+GitHub; it supplies the Skills Hub skills and the expert roster. The step is+best-effort: if GitHub is unreachable it gives up after at most 10 minutes,+logs a warning, and startup continues without the catalog. Set+`AUTOGPT_PUBLISH_SKILLS=0` to skip it, for example on an egress-filtered host.| Symptom | What to check || --- | --- |@@ -1109,14 +1140,14 @@ startup attempt.| Port `3300` opens but auth actions fail | Use `--publish 127.0.0.1:3300:3000` and set `AUTOGPT_PUBLIC_URL=http://localhost:3300`, then replace the container. || Signup shows **Email Not Allowed** | Inspect the API response or container logs to distinguish closed registration from an allowlist miss. Set `AUTH_ALLOW_NEW_ACCOUNTS=true` with an exact-address `[email protected]`, replace the container, create the intended accounts, and close signup again. || The container remains `starting` or becomes `unhealthy` | First boot can take several minutes. Run `autogpt-healthcheck` and inspect container logs for the first failed service. |-| The container is OOM-killed or repeatedly restarts during startup | The appliance uses about 5–6 GiB before workload headroom. On Docker Desktop, increase the VM memory allocation under **Settings → Resources**. |+| The container is OOM-killed or repeatedly restarts during startup | The appliance uses about 5–6 GiB before workload headroom. On Docker Desktop, increase the VM memory allocation under **Settings → Resources**, or in `.wslconfig` with the Windows WSL 2 backend. || Startup refuses to continue after an interrupted migration | Follow the empty-install versus existing-install recovery procedure in [Quick start](#quick-start). The restart-looping container cannot reliably run `docker exec`; do not mark the migration applied or rolled back until you verify which database changes completed. || Startup rejects `DB_CONNECTION_LIMIT`, `DB_CONNECT_TIMEOUT`, or `DB_POOL_TIMEOUT` | Use an integer in the supported range: `1`–`5`, `1`–`600`, and `1`–`3600`, respectively. || Startup rejects legacy JWT secrets | Remove `JWT_VERIFY_KEY` and `SUPABASE_JWT_SECRET` for a fresh Better Auth installation. Set `AUTOGPT_ENABLE_LEGACY_AUTH=true` only for an intentional legacy-auth migration, and set both legacy variables to the same shared secret of at least 32 characters. || A run stays `RUNNING` without progress after a restart | The container stopped while the run was in flight. Its message was dropped and the row was not reconciled; start a new run. || Requests stall for minutes under concurrent runs | Inspect backend and PostgreSQL logs for connection-pool exhaustion. `DB_CONNECTION_LIMIT` cannot be raised above its default maximum of `5`; lowering `DB_POOL_TIMEOUT` makes pool exhaustion fail sooner but does not add capacity. Reduce concurrency or move to a distributed deployment when the fixed pools are insufficient. || AutoPilot returns a provider `401` | Configure the key for the selected transport. The default remote route needs `OPEN_ROUTER_API_KEY`; complete remote memory also needs `OPENAI_API_KEY`. |-| Local chat works but memory ingestion fails | Install the configured embedding model and confirm its `/v1/embeddings` endpoint works. If the server does not provide the default Qwen and `nomic-embed-text` slugs, set and install `GRAPHITI_LLM_MODEL`, `GRAPHITI_RERANKER_MODEL`, and `GRAPHITI_EMBEDDER_MODEL` explicitly. |+| Local chat works but memory ingestion fails | Install the configured embedding model and confirm its `/v1/embeddings` endpoint works. Under the local transport Graphiti defaults to `hf.co/ornith-ai/Ornith-1.5-9B-GGUF:Q4_K_M` and `nomic-embed-text`; if the server does not serve those slugs, set and install `GRAPHITI_LLM_MODEL`, `GRAPHITI_RERANKER_MODEL`, and `GRAPHITI_EMBEDDER_MODEL` explicitly. || Ollama cannot be reached | Keep the host-gateway option, ensure Ollama listens on an address Docker can reach, and test `/api/tags` from inside the container. || The container exits after a persistent health failure | The watchdog intentionally stops the appliance. Keep `--restart unless-stopped` so Docker can recover it. || Data appears missing after replacement | The new container is using another or anonymous `/data` volume. Inspect its mount and reattach the original named volume. |diff --git a/docs/platform/what-is-autogpt-platform.md b/docs/platform/what-is-autogpt-platform.mdindex cf32e12d8e..70e978983c 100644--- a/docs/platform/what-is-autogpt-platform.md+++ b/docs/platform/what-is-autogpt-platform.md@@ -63,7 +63,7 @@ The full model list — models, capabilities, context windows, and pricing — l* OpenAI - <https://openai.com/>* Anthropic - <https://www.anthropic.com/>* Groq - <https://groq.com/>-* Llama - <https://llamaindex.ai/>+* Llama - <https://www.llama.com/>* AI/ML API - <https://aimlapi.com/>* AI/ML API provides 300+ AI models including Deepseek, Gemini, ChatGPT. The models run at enterprise-grade rate limits and uptimes.@@ -73,10 +73,11 @@ We've adopted a dual-license approach to balance open collaboration with sustain* **MIT License**: The majority of the AutoGPT repository remains under this license.* **Polyform Shield License**: Applies to the new `autogpt_platform` folder.+* **Docker image**: The single-container image also bundles third-party services under their own licenses, including FalkorDB under SSPL-1.0. Their license files are in the image under `/usr/share/licenses/`.This strategy allows us to share previously closed-source components, fostering a vibrant ecosystem of developers and users.## Ready to Get Started?* **Cloud:** Read the [Getting Started (Cloud)](getting-started-cloud.md) guide to start using the hosted platform immediately.-* **Self-Host:** Read the [Self-Hosting Guide](getting-started.md) to run the platform on your own infrastructure.+* **Self-Host:** Run the whole platform from one Docker image, `significantgravitas/autogpt` on Docker Hub, with the [single-container guide](single-container.md), or read the [Self-Hosting Guide](getting-started.md) to run each service with Docker Compose on your own infrastructure.