Como instalar o Tencent LoopForge no Linux e executar fluxos de agentes
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
Tencent LoopForge organizes programming agent workflows into script, agent, and human approval stages. Each execution can pause for someone to approve the result, add context, or return the work. The tool is distributed under an MIT license and can be started with a script that configures the platform and MySQL in Docker containers. This guide describes installing version 0.4.0 on Ubuntu 26.04 and configuring the service with HTTPS.
Tencent LoopForge 将编程代理工作流组织为脚本、代理和人工审批阶段。每次执行都可以暂停,以便有人批准结果、添加上下文或退回工作。该工具采用 MIT 许可证分发,可以通过一个在 Docker 容器中配置平台和 MySQL 的脚本来启动。本指南介绍了在 Ubuntu 26.04 上安装 0.4.0 版本并配置 HTTPS 服务的过程。
Prepare the server and install LoopForge. Use a 64-bit Linux server with Git and sudo, and reserve at least 15 GB of free space for the images. The LoopForge image takes up 4.3 GB and the MySQL image 1.1 GB. To configure HTTPS, the machine also needs a domain pointed to the server and ports 80 and 443 opened. Keep port 8090 closed to internet connections. LoopForge starts two containers, one for the platform and one for MySQL, and creates another for each execution. The guide recommends sizing the machine according to the agents’ work: four vCPUs and 8 GB of memory are a baseline for agents using hosted models; a local model requires more resources.
准备服务器并安装 LoopForge。使用带有 Git 和 sudo 的 64 位 Linux 服务器,并为镜像预留至少 15 GB 的可用空间。LoopForge 镜像占用 4.3 GB,MySQL 镜像占用 1.1 GB。要配置 HTTPS,机器还需要一个指向服务器的域名,并开放 80 和 443 端口。请保持 8090 端口对互联网连接关闭。LoopForge 会启动两个容器(一个用于平台,一个用于 MySQL),并为每次执行创建一个新容器。指南建议根据代理的工作负载来调整机器配置:四核 vCPU 和 8 GB 内存是使用托管模型的代理的基准;本地模型则需要更多资源。
The guide queries the GitHub API to get the latest stable version so that the installation uses a release instead of the variable content of the main branch. In the described test, the API returned v0.4.0; the command prints the selected tag before using it:
LOOPFORGE_VERSION=$(curl -s https://api.github.com/repos/Tencent/LoopForge/releases/latest | grep -m1 '\"tag_name\"' | cut -d'\"' -f4)
echo "$LOOPFORGE_VERSION"
git clone --branch "$LOOPFORGE_VERSION" https://github.com/Tencent/LoopForge.git ~/LoopForge
cd ~/LoopForge
time ./start.sh
指南通过查询 GitHub API 获取最新的稳定版本,以便安装使用发布版本而非主分支的变动内容。在所述测试中,API 返回了 v0.4.0;命令在执行前会打印所选标签:
LOOPFORGE_VERSION=$(curl -s https://api.github.com/repos/Tencent/LoopForge/releases/latest | grep -m1 '\"tag_name\"' | cut -d'\"' -f4)
echo "$LOOPFORGE_VERSION"
git clone --branch "$LOOPFORGE_VERSION" https://github.com/Tencent/LoopForge.git ~/LoopForge
cd ~/LoopForge
time ./start.sh
On a new machine, the script installs Docker if necessary, creates unique secrets for the database and sessions, downloads the images, and loads the initial catalog. In the environment used by the guide, the installation took 2 minutes and 8 seconds to display the access addresses. Before using the installation with your repositories, check if the digest of the downloaded image matches the one published on the release page. This step verifies that the received image matches the expected reference for the installed version:
sudo docker image inspect ghcr.io/tencent/loopforge:0.4.0 --format '{{index .RepoDigests 0}}'
在全新的机器上,脚本会在必要时安装 Docker,为数据库和会话创建唯一的密钥,下载镜像并加载初始目录。在指南使用的环境中,安装过程耗时 2 分 8 秒,随后显示了访问地址。在将安装用于您的存储库之前,请检查下载镜像的摘要是否与发布页面上公布的一致。此步骤可验证接收到的镜像是否与已安装版本的预期引用相符:
sudo docker image inspect ghcr.io/tencent/loopforge:0.4.0 --format '{{index .RepoDigests 0}}'
The test performed during publication returned the digest below. Compare this identifier to the value reported on the corresponding release page before granting the service access to your repositories, as recommended by the installation guide:
ghcr.io/tencent/loopforge@sha256:87b6a3e3cba201d03f8f8d22929881f576021fc78c7c42e82f78329abbf4bda4
发布期间进行的测试返回了以下摘要。在授予服务访问存储库的权限之前,请按照安装指南的建议,将此标识符与相应发布页面上报告的值进行比较:
ghcr.io/tencent/loopforge@sha256:87b6a3e3cba201d03f8f8d22929881f576021fc78c7c42e82f78329abbf4bda4
Create the account without exposing the port. By default, the service listens on all interfaces and the installer instructs to open port 8090. Registration also starts open, allowing the first person to access the service to create the administrator account. Before restricting these settings, access the interface via an SSH tunnel without publishing the port. Run the command on the local computer and replace the address with the server data:
ssh -L 8090:127.0.0.1:8090 [email protected]
在不暴露端口的情况下创建账户。默认情况下,服务会监听所有接口,安装程序会指示打开 8090 端口。注册功能最初也是开放的,允许第一个访问该服务的人创建管理员账户。在限制这些设置之前,请通过 SSH 隧道访问界面,而无需发布端口。在本地计算机上运行该命令,并将地址替换为服务器数据:
ssh -L 8090:127.0.0.1:8090 [email protected]
With the tunnel active, open http://localhost:8090 in the browser and create the initial account, which will have administrative privileges. Use a long password: although the form accepts six-character passwords, the account can start containers on the server and therefore deserves a strong credential.
在隧道激活后,在浏览器中打开 http://localhost:8090 并创建初始账户,该账户将拥有管理权限。请使用长密码:尽管表单接受六字符密码,但该账户可以在服务器上启动容器,因此值得使用强凭据。
Restrict access and configure HTTPS. In the .env file, disable registration, limit the service to the local address, and enable secure cookies. The command below removes previous values of these settings, writes the new ones, and restarts the platform. According to the guide, this restart recreates the platform container and preserves existing data.
cd ~/LoopForge
for k in AGENTFLOW_ALLOW_SIGNUP LOOPFORGE_BIND AGENTFLOW_SECURE_COOKIES; do sed -i "/^$k=/d" .env; done
printf "%s\n" AGENTFLOW_ALLOW_SIGNUP=false LOOPFORGE_BIND=127.0.0.1 AGENTFLOW_SECURE_COOKIES=true >> .env
./start.sh
限制访问并配置 HTTPS。在 .env 文件中,禁用注册,将服务限制为本地地址,并启用安全 Cookie。以下命令会删除这些设置的先前值,写入新值并重启平台。根据指南,此重启操作会重新创建平台容器并保留现有数据。
cd ~/LoopForge
for k in AGENTFLOW_ALLOW_SIGNUP LOOPFORGE_BIND AGENTFLOW_SECURE_COOKIES; do sed -i "/^$k=/d" .env; done
printf "%s\n" AGENTFLOW_ALLOW_SIGNUP=false LOOPFORGE_BIND=127.0.0.1 AGENTFLOW_SECURE_COOKIES=true >> .env
./start.sh
Configure Nginx as a reverse proxy for 127.0.0.1:8090. LoopForge streams execution logs live and uses WebSockets; therefore, the proxy needs connection upgrade headers, unbuffered sending, and a long read timeout. In the file, replace the example domain with the domain pointed to the server.
将 Nginx 配置为 127.0.0.1:8090 的反向代理。LoopForge 会实时流式传输执行日志并使用 WebSockets;因此,代理需要连接升级头、无缓冲发送以及较长的读取超时时间。在文件中,将示例域名替换为指向服务器的域名。
Install Nginx and Certbot, save the site configuration in /etc/nginx/sites-available/loopforge, and enable it in sites-enabled. The commands also remove the default site, test the Nginx syntax, and reload the service to apply the changes:
sudo apt update
sudo apt install -y nginx certbot python3-certbot-nginx
sudo vim /etc/nginx/sites-available/loopforge
sudo ln -sf /etc/nginx/sites-available/loopforge /etc/nginx/sites-enabled/loopforge
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl reload nginx
安装 Nginx 和 Certbot,将站点配置保存到 /etc/nginx/sites-available/loopforge,并在 sites-enabled 中启用它。这些命令还会删除默认站点,测试 Nginx 语法,并重新加载服务以应用更改:
sudo apt update
sudo apt install -y nginx certbot python3-certbot-nginx
sudo vim /etc/nginx/sites-available/loopforge
sudo ln -sf /etc/nginx/sites-available/loopforge /etc/nginx/sites-enabled/loopforge
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl reload nginx
Before requesting the certificate, replace loopforge.example.com with the real domain pointed to the server and [email protected] with a valid email address. Let’s Encrypt refuses example addresses from the example.com domain, so these values cannot be copied without editing:
sudo certbot --nginx -d loopforge.example.com -m [email protected] --agree-tos --non-interactive --redirect
在申请证书之前,请将 loopforge.example.com 替换为指向服务器的真实域名,并将 [email protected] 替换为有效的电子邮件地址。Let’s Encrypt 会拒绝来自 example.com 域的示例地址,因此这些值在未经编辑的情况下无法直接复制:
sudo certbot --nginx -d loopforge.example.com -m [email protected] --agree-tos --non-interactive --redirect
Afterward, verify that registration has been closed, that a registration attempt is refused, and that HTTP redirects to HTTPS. In the guide’s test, registration returned HTTP 403, access via HTTP redirected to HTTPS, and the service…
随后,验证注册功能是否已关闭,注册尝试是否被拒绝,以及 HTTP 是否重定向到 HTTPS。在指南的测试中,注册返回了 HTTP 403,通过 HTTP 的访问重定向到了 HTTPS,并且该服务……