AI SDK(@aisdk)

Learn more: https://t.co/eEpaV5wRDf

8.5内容质量
Learn more: https://t.co/eEpaV5wRDf

TL;DR · AI 摘要

AI SDK 推出 HarnessAgent 的 stopWhen 功能,支持每一步骤控制,提升开发效率。

核心要点

  • stopWhen 参数可设置为 isStepCount(1) 实现步骤控制
  • Vercel 沙箱环境支持 Node.js 24 运行时和 4000 端口配置
  • 工作流集成优化了代理步骤边界管理

结构提纲

按章节快速跳转。

  1. 宣布 HarnessAgent 新增 stopWhen 参数控制功能

  2. 通过 isStepCount(1) 实现步骤级中断控制

  3. 展示 stepped-harness-agent.ts 完整实现代码

  4. 说明 workflow SDK 的步骤函数实现方式

  5. 配置 Vercel 沙箱的 node24 运行环境

思维导图

用一张图看清主题之间的关系。

查看大纲文本(无障碍 / 无 JS 友好)
  • HarnessAgent 新功能
    • stopWhen 控制
      • isStepCount(1) 实现
    • 工作流集成
      • agentStep 状态管理
    • Vercel 沙箱
      • node24 运行时支持

金句 / Highlights

值得收藏与分享的关键句。

#AI SDK#HarnessAgent#Vercel#工作流集成
打开原文

![Image 2: Vercel](https://twitter.com/vercel) @aisdk Jul 28 𝙷𝚊𝚛𝚗𝚎𝚜𝚜𝙰𝚐𝚎𝚗𝚝 now supports 𝚜𝚝𝚘𝚙𝚆𝚑𝚎𝚗 for per-step control [![Image 3: Code snippet demonstrating the use of HarnessAgent with stopWhen: // stepped-harness-agent.ts import { HarnessAgent } from '@ai-sdk/harness/agent'; import { claudeCode } from '@ai-sdk/harness-claude-code'; import { createVercelSandbox } from '@ai-sdk/sandbox-vercel'; import { isStepCount } from 'ai'; export const agent = new HarnessAgent({ harness: claudeCode, sandbox: createVercelSandbox({ runtime: 'node24', ports: [4000], }), instructions: 'You are a helpful coding assistant.', stopWhen: isStepCount(1), });](https://pbs.twimg.com/media/HOU58KPbUAAr8ba?format=webp&name=medium)](https://x.com/aisdk/status/2082134111725183324/photo/1)

![Image 5: Vercel](https://twitter.com/vercel) @aisdk Jul 28 Use 𝙷𝚊𝚛𝚗𝚎𝚜𝚜𝙰𝚐𝚎𝚗𝚝 with workflow and clean agent step boundary ![Image 6: Code snippet showing a workflow SDK step function using `HarnessAgent` with per-agent step boundary: import { runHarnessAgentStep, type HarnessWorkflowState, } from '@ai-sdk/workflow-harness'; export async function agentStep( state: HarnessWorkflowState, ): Promise<HarnessWorkflowState> { 'use step'; const { agent } = await import('./stepped-harness-agent'); return runHarnessAgentStep({ agent, state, }); }](https://x.com/aisdk/status/2082134128825426164/photo/1)

![Image 8: Vercel](https://twitter.com/vercel) @aisdk Learn more: ai-sdk.dev/docs/ai-sdk-ha… 4:00 PM · Jul 28, 2026856 Views