AI SDK(@aisdk)

Use 𝙷𝚊𝚛𝚗𝚎𝚜𝚜𝙰𝚐𝚎𝚗𝚝 with workflow and clean agent step boundary

8.5内容质量
Use 𝙷𝚊𝚛𝚗𝚎𝚜𝚜𝙰𝚐𝚎𝚗𝚝 with workflow and clean agent step boundary

TL;DR · AI 摘要

HarnessAgent 新增 stopWhen 步骤控制和工作流边界管理功能,提升 AI 代理执行的可控性与可维护性。

核心要点

  • HarnessAgent 通过 stopWhen(isStepCount(1)) 实现步骤级执行控制
  • 工作流 SDK 支持 agentStep 函数实现边界管理
  • Vercel Sandbox 集成 Node24 运行时和 4000 端口配置

结构提纲

按章节快速跳转。

  1. 宣布 HarnessAgent 新增 stopWhen 步骤控制功能

  2. 通过 isStepCount(1) 实现执行步骤的精确控制

  3. 展示 agentStep 函数与 Vercel Sandbox 的集成方式

  4. 用户指出步骤边界提升长期运行代理的可理解性

  5. 提供 ai-sdk.dev 官方文档链接进行深入查阅

思维导图

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

查看大纲文本(无障碍 / 无 JS 友好)
  • HarnessAgent 新功能
    • 步骤控制
      • stopWhen API
      • isStepCount(1)
    • 工作流集成
      • agentStep 函数
      • Vercel Sandbox
    • 用户价值
      • 提升可维护性
      • 增强可控性

金句 / 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 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) 4:00 PM · Jul 28, 20261.3K Views

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

Step boundaries make long-running agents easier to reason about.

AI SDK on X: "Use 𝙷𝚊𝚛𝚗𝚎𝚜𝚜𝙰𝚐𝚎𝚗𝚝 with workflow and clean agent step boundary https://t.co/q7KR35mux4" / X