Framework · Vercel
Vercel AI SDK の概要
Vercelのプロバイダー非依存なTypeScriptツールキットです。AI SDK 7ではToolLoopAgentが主要なエージェントクラスです。ツールループをストリーミングUIヘルパーと連携させ、WorkflowAgentでは再起動後も継続する実行を追加できます。
おすすめの用途: ツールループ型エージェントをストリーミングUIと密接に連携させたいNext.js・Web開発者。
基本情報
- メンテナー
- Vercel
- 言語
- TypeScript
- ライセンス
- Apache-2.0
- 最新バージョン
ai 7.0.126· 2026年9月30日- リポジトリ
- vercel/ai
- ホスティング विकल्प
- Vercel Functions + Vercel Workflow
クイックスタート
パッケージをインストールして認証情報を設定し、公式ドキュメントにある最小構成のエージェントを実行します。モデル ID はドキュメントで使われているものです。アカウントで有効になっていない場合があります。
npm install ai zod (inferred; not copied from docs)import { ToolLoopAgent, tool } from 'ai';
import { z } from 'zod';
const weatherAgent = new ToolLoopAgent({
model: "anthropic/claude-sonnet-5.5",
tools: {
weather: tool({
description: 'Get the weather in a location (in Fahrenheit)',
inputSchema: z.object({
location: z.string().describe('The location to get the weather for'),
}),
execute: async ({ location }) => ({
location,
temperature: 72 + Math.floor(Math.random() * 21) - 10,
}),
}),
convertFahrenheitToCelsius: tool({
description: 'Convert temperature from Fahrenheit to Celsius',
inputSchema: z.object({
temperature: z.number().describe('Temperature in Fahrenheit'),
}),
execute: async ({ temperature }) => {
const celsius = Math.round((temperature - 32) * (5 / 9));
return { celsius };
},
}),
},
});
const result = await weatherAgent.generate({
prompt: 'What is the weather in San Francisco in celsius?',
});
console.log(result.text); // agent's final answer
console.log(result.steps); // steps taken by the agent機能
| 任意のモデル | はい | 任意のプロバイダーパッケージ、またはanthropic/claude-sonnet-5.5などのAI Gateway文字列に対応 |
|---|---|---|
| MCPクライアント | はい | @ai-sdk/mcp クライアント |
| MCPサーバー | 未確認 | |
| マルチエージェント | はい | サブエージェント。HarnessAgent は Claude Code、Codex、Pi を実行 |
| 耐久性のある実行 | はい | Workflow 5 beta が必要な WorkflowAgent |
| 人による承認 | はい | HMAC 署名付き承認と OPA ポリシーに対応した toolApproval |
| トレーシング | 未確認 | |
| Evals | 未確認 |
最近の変更
- AI SDK 7 では、推奨エージェントクラスが ToolLoopAgent になりました。
- HarnessAgent はエージェントとして Claude Code、Codex、Pi を実行します。
- WorkflowAgent (@ai-sdk/workflow) が Workflow DevKit の DurableAgent に置き換わりました。
- runtimeContext と toolsContext が experimental_context に置き換わりました。