dotsagent.io
言語:日本語
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 · 27,070 スター
ホスティング विकल्प
Vercel Functions + Vercel Workflow
エージェント専用ランタイムではなく、汎用ホスティングプラットフォームです。

クイックスタート

パッケージをインストールして認証情報を設定し、公式ドキュメントにある最小構成のエージェントを実行します。モデル ID はドキュメントで使われているものです。アカウントで有効になっていない場合があります。

インストール
npm install ai zod  (inferred; not copied from docs)

AI Gateway or provider key が必要

TypeScript
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 に置き換わりました。

同じ言語の代替ツール

参照元

  1. ai-sdk.dev/docs/agents/overview
  2. ai-sdk.dev/docs/agents/tool-approvals
  3. ai-sdk.dev/docs/agents/workflow-agent
  4. ai-sdk.dev/docs/ai-sdk-core/mcp-tools
  5. vercel.com/kb/guide/durableagent-to-workflowagent
  6. registry.npmjs.org/ai
  7. api.github.com/repos/vercel/ai