> ## Documentation Index
> Fetch the complete documentation index at: https://docs.veadk.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# 环境、镜像与 Devbox

使用火山引擎账号凭据管理控制面资源，会话和事件请求使用 Endpoint 和 Environment Key。使用 --workspace-id 指定工作空间，--config 选择项目配置。

> [!WARNING]
>
> 创建镜像和 Devbox 会消耗云资源。删除实例前请保存需要保留的数据。

Cloud-ECS 环境需要同地域可用的 Linux Cloud-Init amd64 基础镜像和网络配置。普通创建将软件包保留给实例首次启动。镜像构建要求非空软件包列表，将依赖写入镜像。用 environments build-status 等待完成。Devbox 创建后保留当时的环境快照。修改环境只影响后续实例。

```bash theme={null}
agentkit harness-infra environments list --json
agentkit harness-infra devbox create --name build-devbox --environment-id "$ENVIRONMENT_ID" --wait
agentkit harness-infra devbox list --environment-id "$ENVIRONMENT_ID" --all
```

## harness-infra environments create

通过共享配置或规格文件创建环境。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--file <path>` | JSON 或 YAML 请求文件 | — |
| `--name <name>` | 资源名称 | — |
| `--description <text>` | 资源说明 | — |
| `--type <type>` | 环境类型，可取 Cloud、Cloud-ECS、SelfHosted | — |
| `--image-id <id>` | Cloud-ECS 的基础镜像 ID | — |
| `--image-url <url>` | Cloud 或 SelfHosted 的容器镜像地址 | — |
| `--cpu-milli <number>` | CPU 毫核数 | — |
| `--memory-mb <number>` | 内存大小 | — |
| `--disk-size <size>` | 系统盘容量，例如 80Gi | — |
| `--env <KEY=VALUE>` | 注入环境变量，使用 KEY=VALUE，可重复指定 | — |
| `--compose-file <path>` | 本地 Docker Compose YAML 文件 | — |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra environments create
```

## harness-infra environments create-with-image-build

为 Cloud-ECS 构建镜像并异步创建环境。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--file <path>` | JSON 或 YAML 请求文件 | — |
| `--name <name>` | 资源名称 | — |
| `--description <text>` | 资源说明 | — |
| `--type <type>` | 环境类型，可取 Cloud、Cloud-ECS、SelfHosted | — |
| `--image-id <id>` | Cloud-ECS 的基础镜像 ID | — |
| `--image-url <url>` | Cloud 或 SelfHosted 的容器镜像地址 | — |
| `--cpu-milli <number>` | CPU 毫核数 | — |
| `--memory-mb <number>` | 内存大小 | — |
| `--disk-size <size>` | 系统盘容量，例如 80Gi | — |
| `--env <KEY=VALUE>` | 注入环境变量，使用 KEY=VALUE，可重复指定 | — |
| `--compose-file <path>` | 本地 Docker Compose YAML 文件 | — |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--build-script-file <path>` | UTF-8 构建脚本路径 | — |
| `--architecture <architecture>` | 构建镜像的架构，支持 amd64 | — |
| `--apt-package <package>` | 追加 Apt 包，可重复指定 | — |
| `--pip-package <package>` | 追加 Pip 包，可重复指定 | — |
| `--npm-package <package>` | 追加 npm 包，可重复指定 | — |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra environments create-with-image-build --name build-env --type Cloud-ECS --image-id "$IMAGE_ID" --file network.yaml --apt-package git --wait
```

## harness-infra environments build-status

查看构建状态，可等待任务结束。

`agentkit harness-infra environments build-status <environment-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra environments build-status "$ENVIRONMENT_ID"
```

## harness-infra environments show

读取指定资源的配置和状态。

`agentkit harness-infra environments show <environment-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra environments show "$ENVIRONMENT_ID"
```

## harness-infra environments list

分页列出符合筛选条件的资源。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--max-results <number>` | 每页条数，范围 1–100 | 100 |
| `--next-token <token>` | 下一页游标 | — |
| `--include-archived` | 包含已归档资源 | 未启用 |
| `--metadata-file <path>` | 提供元数据筛选条件的 JSON 或 YAML 文件 | — |
| `--project-name <name>` | 项目名称 | — |
| `--all` | 读取全部分页 | 未启用 |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra environments list
```

## harness-infra environments update

将文件中指定的变更应用到资源。

`agentkit harness-infra environments update <environment-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--file <path>` | JSON 或 YAML 请求文件 | — |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra environments update "$ENVIRONMENT_ID" --file patch.yaml
```

## harness-infra environments delete

删除指定资源。

`agentkit harness-infra environments delete <environment-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `-y, --yes` | 跳过交互确认 | 未启用 |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra environments delete "$ENVIRONMENT_ID"
```

## harness-infra devbox create

在指定环境中创建开发实例，继承该环境的资源和网络配置。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--file <path>` | JSON 或 YAML 请求文件 | — |
| `--name <name>` | 资源名称 | — |
| `--environment-id <id>` | 环境 ID | — |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra devbox create --name build-devbox --environment-id "$ENVIRONMENT_ID" --wait
```

## harness-infra devbox show

读取指定资源的配置和状态。

`agentkit harness-infra devbox show <devbox-instance-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra devbox show "$DEVBOX_INSTANCE_ID"
```

## harness-infra devbox list

分页列出符合筛选条件的资源。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--environment-id <id>` | 环境 ID | — |
| `--image-id <id>` | Cloud-ECS 的基础镜像 ID | — |
| `--user-id <id>` | 任务所属用户的上下文标识 | — |
| `--filter-region <region>` | 筛选实例所在地域 | — |
| `--status <status>` | 按资源状态筛选 | — |
| `--max-results <number>` | 每页条数，范围 1–100 | 20 |
| `--next-token <token>` | 下一页游标 | — |
| `--all` | 读取全部分页 | 未启用 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra devbox list
```

## harness-infra devbox start

启动指定实例。

`agentkit harness-infra devbox start <devbox-instance-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--expected-revision <number>` | 使用最近查询的修订校验并发修改 | — |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra devbox start "$DEVBOX_INSTANCE_ID"
```

## harness-infra devbox stop

停止指定实例。

`agentkit harness-infra devbox stop <devbox-instance-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--expected-revision <number>` | 使用最近查询的修订校验并发修改 | — |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra devbox stop "$DEVBOX_INSTANCE_ID"
```

## harness-infra devbox reboot

重启指定实例。

`agentkit harness-infra devbox reboot <devbox-instance-id>`

别名 `restart`.

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--expected-revision <number>` | 使用最近查询的修订校验并发修改 | — |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra devbox reboot "$DEVBOX_INSTANCE_ID"
```

## harness-infra devbox delete

删除指定资源。

`agentkit harness-infra devbox delete <devbox-instance-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--expected-revision <number>` | 使用最近查询的修订校验并发修改 | — |
| `--force` | 向服务端请求强制删除 | 未启用 |
| `-y, --yes` | 跳过交互确认 | 未启用 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra devbox delete "$DEVBOX_INSTANCE_ID"
```

## harness-infra devbox exec

提交云助手命令，可用返回的执行 ID 读取结果。

`agentkit harness-infra devbox exec <devbox-instance-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--command <text>` | 要在 Devbox 运行的 shell 命令 | — |
| `--command-file <path>` | 包含命令的 UTF-8 脚本路径 | — |
| `--command-timeout <seconds>` | 远端命令执行超时，范围 1–1800 秒 | — |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra devbox exec "$DEVBOX_ID" --command "pwd" --wait
```

## harness-infra devbox command-result

查看一次云助手命令的执行结果。

`agentkit harness-infra devbox command-result <command-execution-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `-r, --region <region>` | API 调用地域 | — |
| `--json` | 输出 JSON | 未启用 |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra devbox command-result "$COMMAND_EXECUTION_ID" --json
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.