Vercel News

HarnessAgent now supports image inputs for all harness adapters

6.4内容质量

TL;DR · AI 摘要

HarnessAgent now supports image inputs for all harness adapters - Vercel The AI SDK HarnessAgent layer now accepts image...

核心要点

  • 主题聚焦:HarnessAgent now supports image inputs for all h
  • 来源:Vercel News,建议结合原文判断细节。
  • AI 分析暂不可用,本条为保底评分与摘要。
#AI#编程#开源
打开原文

HarnessAgent 现在支持所有适配器的图像输入 - Vercel

AI SDK 的 HarnessAgent 层现在支持所有适配器的图像输入。

在标准的 AI SDK 消息格式中,将图像与文本一起传递:一个混合 { type: 'text' } 和 { type: 'file' } 的内容数组。

图像输入由适配器底层的视觉模型处理,支持所有可用适配器:Claude Code、Cline、Codex、Cursor、Deep Agents、fx、GitHub Copilot、Grok Build、OpenCode、Pi。

code
1
import
{
HarnessAgent
}
from
'@ai-sdk/harness/agent'
;
2
import
{
codex
}
from
'@ai-sdk/harness-codex'
;
3
import
{
createVercelNetworkSandboxSession
}
from
'@ai-sdk/sandbox-vercel'
;
4
import
{
readFileSync
}
from
'node:fs'
;
5
6
const
agent
=
new
HarnessAgent
(
{
harness
:
codex
}
)
;
7
8
const
sandboxSession
=
await
createVercelNetworkSandboxSession
(
{
9
runtime
:
'node24'
,
10
ports
:
[
4000
]
,
11
template
:
await
agent
.
getSandboxTemplate
(
)
,
12
}
)
;
13
const
session
=
await
agent
.
createSession
(
{
sandboxSession
}
)
;
14
15
const
result
=
await
agent
.
generate
(
{
16
session
,
17
messages
:
[
18
{
19
role
:
'user'
,
20
content
:
[
21
{
type
:
'text'
,
text
:
'Describe the image in one sentence.'
}
,
22
{
23
type
:
'file'
,
24
mediaType
:
'image/png'
,
25
data
:
readFileSync
(
'image.png'
)
,
26
}
,
27
]
,
28
}
,
29
]
,
30
}
)
;

要求 Codex 适配器描述给定图像的基本示例

阅读 HarnessAgent 图像输入文档以开始使用。 /think