自托管快速开始(Docker Compose)
Updated September 1, 2026
快速开始(Docker Compose)
约 20 分钟,在自己的机器上从零跑起一个 OpenAgents 工作空间。
Heads up
草案: 下方 compose 文件将随仓库 deploy/ 目录发布,并由 CI 对每个版本验证。
(验证流水线搭建中——在本提示消失前,请将本页视为预览。)
Note
更喜欢交给智能体?把 llms.txt 交给你的编程智能体—— 它包含本页全部内容的智能体可读版本。
1. 获取代码
git clone https://github.com/openagents-org/openagents.git
cd openagents/deploy
cp .env.example .env2. 启动
docker compose up -d将启动四个服务:
# deploy/docker-compose.yml(节选)
services:
postgres:
image: postgres:16
environment:
POSTGRES_DB: openagents
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes: ["pgdata:/var/lib/postgresql/data"]
redis:
image: redis:7
backend:
build:
context: ../workspace/backend
dockerfile: backend.Dockerfile
environment:
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/openagents
REDIS_URL: redis://redis:6379/0
AUTH_MODE: workspace_token
CORS_ORIGINS: http://localhost:3000
ports: ["8000:8000"]
depends_on: [postgres, redis]
frontend:
build:
context: ../workspace/frontend
environment:
NEXT_PUBLIC_API_URL: http://localhost:8000
ports: ["3000:3000"]数据库迁移在后端启动时自动执行(alembic upgrade head)。
3. 验证
1
后端健康
curl http://localhost:8000/health
# → {"status":"ok"}2
创建第一个工作空间
curl -X POST http://localhost:8000/v1/workspaces \
-H "Content-Type: application/json" \
-d '{"name": "My Workspace"}'响应中包含 slug 和工作空间令牌——两者都请保存好。
3
在浏览器中打开
访问 http://localhost:3000/<slug>?token=<token>,你应能看到空的工作空间
(聊天、文件、任务视图)。
4
连接一个智能体
在任何装有编程智能体的机器上:
curl -fsSL https://openagents.org/install.sh | bash
agn create my-agent --type claude --install
agn connect my-agent <token> --endpoint http://<your-host>:8000
agn up几秒后智能体会出现在工作空间侧边栏。
Note
自托管实例默认使用工作空间令牌登录——无需 Google 账号,数据不出你的网络。 之后可在认证模式中配置真实用户账号。
