内容提要
AI SDK 的 harness 层新增 GitHub Copilot 支持,通过官方 @ai-sdk/harness-github-copilot 适配器接入。开发者可在 HarnessAgent 中传入 githubCopilot 运行该代理,底层借助 ACP 协议连接。目前支持的 harness 还包括 Claude Code、Cline、Codex、Cursor 等。
延伸解读
Harness 层的作用
Harness 层为应用提供统一的 HarnessAgent 接口,使开发者能够运行不同的编码代理,而无需修改应用代码。这意味着切换代理时,只需更换传入的 harness 参数,降低了集成和维护成本。
接入方式与底层协议
通过官方 @ai-sdk/harness-github-copilot 适配器,开发者可在 HarnessAgent 中传入 githubCopilot 来运行代理。底层借助 @ai-sdk/harness-acp 和 Agent Client Protocol (ACP) 连接 GitHub Copilot 与 HarnessAgent,实现协议层面的兼容。
当前支持的代理列表
除 GitHub Copilot 外,Harness 层还支持 Claude Code、Cline、Codex、Cursor、Deep Agents、fx、Grok Build、OpenCode 和 Pi 等代理,且官方表示未来会支持更多。这为开发者提供了丰富的选择,便于根据需求灵活切换。
Q&A
AI SDK 的 harness 层现在支持哪些编码代理?
目前支持的 harness 包括 GitHub Copilot、Claude Code、Cline、Codex、Cursor、Deep Agents、fx、Grok Build、OpenCode 和 Pi,未来还会支持更多。
如何在 HarnessAgent 中接入 GitHub Copilot?
通过官方适配器 @ai-sdk/harness-github-copilot,将 githubCopilot 传入 HarnessAgent 的 harness 选项即可。示例代码:import { HarnessAgent } from '@ai-sdk/harness/agent'; import { githubCopilot } from '@ai-sdk/harness-github-copilot'; const agent = new HarnessAgent({ harness: githubCopilot });
GitHub Copilot 适配器底层使用什么协议连接?
底层使用 @ai-sdk/harness-acp 通过 Agent Client Protocol (ACP) 将 GitHub Copilot 连接到 HarnessAgent。
harness 层的主要作用是什么?
harness 层让应用程序通过统一的 HarnessAgent 接口运行不同的编码代理,从而无需更改应用代码即可切换代理。
使用 GitHub Copilot harness 需要安装哪个包?
需要安装官方适配器包 @ai-sdk/harness-github-copilot。
在哪里可以找到 GitHub Copilot harness 的文档?
可以阅读 GitHub Copilot harness 文档来开始使用,文章末尾提供了文档链接。