> ## 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.

# Harness Infra 资源与配置

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

> [!WARNING]
>
> 创建资源和调用模型可能产生费用。配置文件和 Environment Key 含凭据，应仅保存在受保护的位置。cleanup 默认保留 Endpoint、IAM 角色和 PG 会话存储。显式使用 --delete-session-store 会删除本流程创建的存储及其数据。

先执行 config init，在输出的 YAML 中配置账号和模型密钥名称。从项目根目录依次创建资源，每个 create 成功后记录 ID 并显示接续命令。若已配置已有 PG，则复用该存储。runtime-template 是 runtime 的兼容别名。

```bash theme={null}
agentkit harness-infra config init
```

```bash theme={null}
agentkit harness-infra environments create
agentkit harness-infra harness create
agentkit harness-infra session-store create
agentkit harness-infra runtime create
agentkit harness-infra api-key create
agentkit harness-infra sessions create
agentkit harness-infra invoke --message "Hello"
agentkit harness-infra sessions:events list
```

声明式资源可先 validate，再用 apply --dry-run 查看计划。apply 会写入实际资源并维护锁文件，--prune 会回收已跟踪但已从本地移除的资源。

## harness-infra config init

在当前项目中创建共享 YAML 配置。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |

```bash theme={null}
agentkit harness-infra config init
```

## harness-infra cleanup

回收当前工作流创建的资源。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `-y, --yes` | 跳过交互确认 | 未启用 |
| `--delete-session-store` | 运行时删除后，删除本流程创建的 PG 会话存储和数据 | 未启用 |
| `-r, --region <region>` | API 调用地域 | — |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `--json` | 输出 JSON | 未启用 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra cleanup --yes
```

## harness-infra apply

比较本地声明与云端状态，并执行资源变更。

`agentkit harness-infra apply [paths...]`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--dry-run` | 预览操作 | 未启用 |
| `-y, --yes` | 跳过交互确认 | 未启用 |
| `--force` | 校正远端已偏离声明的可变字段 | 未启用 |
| `--prune` | 归档或删除锁文件中已跟踪且本地声明已移除的资源 | 未启用 |
| `--lock-file <path>` | 资源锁文件路径 | — |
| `-r, --region <region>` | API 调用地域 | — |
| `--timeout <seconds>` | 请求或等待超时秒数 | 900 |
| `--concurrency <number>` | 同时处理的独立操作数 | 4 |
| `--json` | 输出 JSON | 未启用 |
| `-v, --verbose` | 显示更多执行细节 | 未启用 |
| `--detailed-exitcode` | dry-run 检测到变更时退出码为 2 | 未启用 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra apply ./resources --dry-run
```

## harness-infra validate

在应用前校验资源文件及其引用。

`agentkit harness-infra validate [paths...]`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--lock-file <path>` | 资源锁文件路径 | — |
| `--json` | 输出 JSON | 未启用 |
| `--workspace-id <id>` | 工作空间 ID，省略时使用服务默认工作空间 | DEFAULT |
| `--config <path>` | 共享 Harness Infra YAML 配置文件 | `.agentkit/harness-infra/config.yaml` |

```bash theme={null}
agentkit harness-infra validate ./resources
```

## harness-infra endpoint create

为账号创建访问入口。需要已有的 API 网关 ID。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--file <path>` | JSON 或 YAML 请求文件 | — |
| `--apig-gateway-id <id>` | 创建 Endpoint 所用的 API 网关 ID | — |
| `--user-id <id>` | 任务所属用户的上下文标识 | — |
| `--custom-domain <domain>` | 自定义域名声明 | — |
| `-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 endpoint create --apig-gateway-id "$GATEWAY_ID"
```

## harness-infra endpoint list

查询账号的访问入口。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--max-results <number>` | 每页条数，范围 1–100 | 100 |
| `--next-token <token>` | 下一页游标 | — |
| `--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 endpoint list
```

## harness-infra environment-resource create

使用当前配置或请求文件创建资源。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--file <path>` | JSON 或 YAML 请求文件 | — |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--environment-key-env <name>` | 保存方舟 Environment Key 的环境变量名 | — |
| `--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 environment-resource create --file resource.yaml --wait
```

## harness-infra environment-resource list

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

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--target-type <type>` | 目标类型，可取 agentkit、ark | — |
| `--environment-id <id>` | 环境 ID | — |
| `--status <status>` | 按资源状态筛选 | — |
| `--include-deleted` | 包含已删除资源的记录 | 未启用 |
| `--all` | 读取全部分页 | 未启用 |
| `--max-results <number>` | 每页条数，范围 1–100 | 20 |
| `--next-token <token>` | 下一页游标 | — |
| `-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 environment-resource list --target-type ark
```

## harness-infra environment-resource show

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

`agentkit harness-infra environment-resource show <resource-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 environment-resource show "$RESOURCE_ID"
```

## harness-infra environment-resource update

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

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

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--file <path>` | JSON 或 YAML 请求文件 | — |
| `--expected-revision <number>` | 使用最近查询的修订校验并发修改 | — |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--environment-key-env <name>` | 保存方舟 Environment Key 的环境变量名 | — |
| `--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 environment-resource update "$RESOURCE_ID" --file patch.yaml --wait
```

## harness-infra environment-resource delete

删除指定资源。

`agentkit harness-infra environment-resource delete <resource-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 environment-resource delete "$RESOURCE_ID"
```

## harness-infra harness create

使用当前配置或请求文件创建资源。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--file <path>` | JSON 或 YAML 请求文件 | — |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `-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 harness create
```

## harness-infra harness show

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

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

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--harness-version <number>` | 指定 Harness 版本 | — |
| `-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 harness show "$HARNESS_ID"
```

## harness-infra harness list

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

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--max-results <number>` | 每页条数，范围 1–100 | 100 |
| `--next-token <token>` | 下一页游标 | — |
| `--include-archived` | 包含已归档资源 | 未启用 |
| `--status <status>` | 按资源状态筛选 | — |
| `--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 harness list
```

## harness-infra harness update

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

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

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--file <path>` | JSON 或 YAML 请求文件 | — |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `-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 harness update "$HARNESS_ID" --file patch.yaml
```

## harness-infra harness archive

将指定资源归档。

`agentkit harness-infra harness archive <harness-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `-y, --yes` | 跳过交互确认 | 未启用 |
| `-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 harness archive "$HARNESS_ID"
```

## harness-infra harness versions

查询已保存的版本。

`agentkit harness-infra harness versions <harness-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--max-results <number>` | 每页条数，范围 1–100 | 100 |
| `--next-token <token>` | 下一页游标 | — |
| `--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 harness versions "$HARNESS_ID"
```

## harness-infra runtime create

创建运行时并返回运行时 ID。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--file <path>` | JSON 或 YAML 请求文件 | — |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 1800 |
| `-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 runtime create
```

## harness-infra runtime show

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

`agentkit harness-infra runtime show <runtime-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 runtime show "$RUNTIME_ID"
```

## harness-infra runtime delete

删除指定资源。

`agentkit harness-infra runtime delete <runtime-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `-y, --yes` | 跳过交互确认 | 未启用 |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 1800 |
| `-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 runtime delete "$RUNTIME_ID"
```

## harness-infra session-store create

创建 PG 会话存储，或验证并复用配置中的已有 ID。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--file <path>` | JSON 或 YAML 请求文件 | — |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 1800 |
| `-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 session-store create
```

## harness-infra session-store show

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

`agentkit harness-infra session-store show <session-store-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 session-store show "$SESSION_STORE_ID"
```

## harness-infra session-store list

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

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--max-results <number>` | 每页条数，范围 1–100 | 100 |
| `--next-token <token>` | 下一页游标 | — |
| `--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 session-store list
```

## harness-infra session-store delete

永久删除指定存储及其托管数据库。

`agentkit harness-infra session-store delete <session-store-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `-y, --yes` | 跳过交互确认 | 未启用 |
| `--wait` | 等待资源操作完成 | 未启用 |
| `--timeout <seconds>` | 请求或等待超时秒数 | 1800 |
| `-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 session-store delete "$SESSION_STORE_ID"
```

## harness-infra api-key create

为环境签发密钥。文件模式下用 --key-output-file 安全保存首次返回的值。

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--file <path>` | JSON 或 YAML 请求文件 | — |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `--key-output-file <path>` | 将首次返回的密钥写入权限为 0600 的文件 | — |
| `--show-key` | 在标准输出显示首次返回的密钥 | 未启用 |
| `-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 api-key create
```

## harness-infra api-key show

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

`agentkit harness-infra api-key show <api-key-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 api-key show "$API_KEY_ID"
```

## harness-infra api-key list

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

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--environment-id <id>` | 环境 ID | — |
| `--endpoint-id <id>` | 指定 Endpoint ID | — |
| `--max-results <number>` | 每页条数，范围 1–100 | 100 |
| `--next-token <token>` | 下一页游标 | — |
| `--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 api-key list
```

## harness-infra api-key delete

删除指定资源。

`agentkit harness-infra api-key delete <api-key-id>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--client-token <token>` | 幂等标识，重试同一次请求时复用原值 | — |
| `-y, --yes` | 跳过交互确认 | 未启用 |
| `-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 api-key delete "$API_KEY_ID"
```

共享配置中的 `harness.agent_loop` 可设为 `dsh`。使用已有的 PG 存储时，将其 ID 填入 `session_store.id` 并在创建运行时前确认状态为 Ready。


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