远程节点 API

工作电脑(Docker 节点)管理 API。

远程节点 API

远程节点 API 用于管理 AI 员工的工作电脑(Docker 容器节点),包括创建、健康检查和资源监控。

获取节点列表

GET /api/remote-nodes

响应示例:

{
  "items": [
    {
      "id": 1,
      "name": "worker-node-01",
      "node_type": "docker",
      "status": "online",
      "config": {
        "image": "openvort/browser-sandbox:latest",
        "memory_limit": "2g",
        "cpu_limit": "2.0"
      },
      "created_at": "2025-02-01T10:00:00Z"
    }
  ],
  "total": 3
}

创建节点

POST /api/remote-nodes

请求体:

{
  "name": "worker-node-02",
  "node_type": "docker",
  "host": "tcp://192.168.1.100:2375",
  "config": {
    "image": "openvort/browser-sandbox:latest",
    "memory_limit": "4g",
    "cpu_limit": "4.0"
  }
}

创建 Docker 节点(自动创建容器)

POST /api/remote-nodes/docker

此接口在创建节点记录的同时自动拉取镜像并启动 Docker 容器,适合快速部署场景。

请求体:

{
  "name": "auto-worker",
  "config": {
    "image": "openvort/browser-sandbox:latest",
    "memory_limit": "2g",
    "cpu_limit": "2.0"
  }
}

node_type 自动设为 docker,容器创建完成后节点状态变为 online

删除节点

DELETE /api/remote-nodes/:id

删除节点会同时停止并移除关联的 Docker 容器。

健康检查

GET /api/remote-nodes/:id/health

响应示例:

{
  "status": "healthy",
  "uptime_seconds": 86400,
  "last_heartbeat": "2025-03-17T12:00:00Z"
}

资源统计

GET /api/remote-nodes/:id/stats

响应示例:

{
  "cpu_usage_percent": 35.2,
  "memory_usage_mb": 1024,
  "memory_limit_mb": 2048,
  "disk_usage_mb": 512
}