From 197e67bd6cd2b29ca5d55d8dcd7122b3f2e560a5 Mon Sep 17 00:00:00 2001 From: songyichun1 Date: Wed, 24 Jun 2026 16:00:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=94=AF=E6=8C=81=E8=B0=83=E7=94=A8oauth?= =?UTF-8?q?=E9=89=B4=E6=9D=83=E7=B1=BB=E5=9E=8Bagent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/content/2.agentkit-cli/2.commands.md | 3 ++- docs/content/2.agentkit-cli/5.harness.md | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/content/2.agentkit-cli/2.commands.md b/docs/content/2.agentkit-cli/2.commands.md index 3c58a8b..1fdc610 100644 --- a/docs/content/2.agentkit-cli/2.commands.md +++ b/docs/content/2.agentkit-cli/2.commands.md @@ -401,7 +401,7 @@ agentkit add harness --name [options] | `--register-network-type` | 注册网络类型。 | `--register-network-type public` | | `--directory` | 写入 `.harness.json` 的目录(默认当前目录)。 | `--directory ./my_harness` | -配置 A2A registry 时,CLI 会在解析出 SpaceId 后调用 `UpdateA2aSpace`,将该空间的 `IntentEnabled` 设置为 `true`,因此调用方需要 `agentkit:UpdateA2aSpace` 权限。部署后的 Harness Runtime 会在每轮对话前用用户输入的前 2048 个 UTF-8 bytes 调用 `SearchAgentCards`,再通过 `GetA2aAgent` 把本轮命中的远程 Agent 临时挂载为 `remote_a2a_*` 动态工具。 +配置 A2A registry 时,CLI 会在解析出 SpaceId 后调用 `UpdateA2aSpace`,将该空间的 `IntentEnabled` 设置为 `true`,因此调用方需要 `agentkit:UpdateA2aSpace` 权限。部署后的 Harness Runtime 会在每轮对话前用用户输入的前 2048 个 UTF-8 bytes 调用 `SearchAgentCards`,再通过 `GetA2aAgent` 把本轮命中的远程 Agent 临时挂载为 `remote_a2a_*` 动态工具。远程 Agent 可使用 `apiKey` 或 `oauth2.clientCredentials` 鉴权;OAuth 类型会自动通过 Identity UserPool 的 M2M client 换取 access token,并以 `Authorization: Bearer ` 调用 `message/send` / `tasks/get`。 ### 组件参数 @@ -1620,6 +1620,7 @@ agentkit invoke harness [消息内容] [选项] - `--registry default` 等价于 `--registry "agentkit://a2a-registry?space_name=Default®ion=cn-beijing&endpoint=https://open.volcengineapi.com/"` - `--registry-space-name` 和 URI 中的 `space_name` 会在本地通过 `ListA2aSpaces` 解析为 space id 后传给运行时 - 解析出 space id 后会调用 `UpdateA2aSpace` 开启 `IntentEnabled=true` +- 命中的 remote-agent 若是 OAuth 类型,运行时会根据 `GetA2aAgent` 返回的 AgentCard 中的 `oauth2.clientCredentials.tokenUrl` 自动获取 Bearer token - URI 中只支持 `space_name`,不支持 `registry_space_name` 等别名 - 示例:`agentkit invoke harness my-harness --registry-space-name my-space --registry-region cn-beijing "找一个财务专家"` diff --git a/docs/content/2.agentkit-cli/5.harness.md b/docs/content/2.agentkit-cli/5.harness.md index feb17d1..67eb5b9 100644 --- a/docs/content/2.agentkit-cli/5.harness.md +++ b/docs/content/2.agentkit-cli/5.harness.md @@ -124,6 +124,8 @@ agentkit add harness --name my-harness --registry default 部署后的 Harness Runtime 在每轮用户对话开始前,会用用户原始输入的前 2048 个 UTF-8 bytes 调用 `SearchAgentCards`;对本轮返回的每个 AgentCard,再调用 `GetA2aAgent` 获取 endpoint 与鉴权信息,并临时包装为本轮可用的 `remote_a2a_*` 工具。这些动态工具只对当前轮次生效,不写回 spec,也不污染已部署的基础 Agent。 +远程 Agent 的调用鉴权由 Runtime 自动处理:`apiKey` 类型 AgentCard 会按 `securitySchemes` 中声明的 header 注入;`oauth2` 且声明 `clientCredentials.tokenUrl` 的 AgentCard 会从 token URL 解析火山引擎 Identity UserPool,查询其中的 `MACHINE_TO_MACHINE` client,使用 `client_credentials` 换取 access token,并以 `Authorization: Bearer ` 调用远程 A2A endpoint。通常无需额外配置;如果 `registry endpoint` 不是公网 OpenAPI 网关且无法同时访问 Identity OpenAPI,可用 `REGISTRY_ID_ENDPOINT` / `AGENTKIT_ID_ENDPOINT` 指定 Identity OpenAPI 地址。 + `--registry-endpoint` 用于指定 Harness Runtime 后续访问 A2A Registry OpenAPI 的地址。通常不传时会按 region 推导默认 endpoint;如果部署后的运行时环境无法解析 region 专属域名,或需要统一走火山引擎公网 OpenAPI 网关,可以显式设置为 `https://open.volcengineapi.com/`: ```bash @@ -376,6 +378,8 @@ agentkit add harness --name my-harness \ 当本次调用通过 `--registry` / `--registry-space-id` / `--registry-space-name` 指定了 A2A SpaceId 时,CLI 同样会先调用 `UpdateA2aSpace` 开启 `IntentEnabled=true`,再把 registry 覆写发送给 Harness Runtime。 +本次调用若命中 OAuth 类型 remote-agent,鉴权行为与部署时的 registry 配置一致:Runtime 会在 `GetA2aAgent` 后根据 AgentCard 的 `oauth2.clientCredentials.tokenUrl` 自动获取 access token,并在动态 `remote_a2a_*` 工具执行 `message/send` / `tasks/get` 时附加 Bearer token。 + ```bash # 基础调用(run_sse,默认,流式) agentkit invoke harness my-harness "今天杭州天气如何?"