dotsagent.io
Ngôn ngữ:Tiếng Việt
Framework · Vercel

Tổng quan về Vercel AI SDK

Bộ công cụ TypeScript không phụ thuộc nhà cung cấp của Vercel, trong đó ToolLoopAgent là lớp agent chính kể từ AI SDK 7. Bộ công cụ này kết hợp vòng lặp tool với các helper giao diện streaming; WorkflowAgent bổ sung các lượt chạy có thể tiếp tục sau khi khởi động lại.

Phù hợp nhất với: Nhà phát triển Next.js và web muốn dùng agent vòng lặp tool tích hợp chặt chẽ với giao diện streaming.

Thông tin chính

Đơn vị duy trì
Vercel
Ngôn ngữ
TypeScript
Giấy phép
Apache-2.0
Phiên bản mới nhất
ai 7.0.126 · 30 tháng 9, 2026
Repository
vercel/ai · 27.070 sao
Tùy chọn chạy trên nền tảng lưu trữ
Vercel Functions + Vercel Workflow
Nền tảng hosting tổng quát, không phải runtime chuyên dụng cho agent.

Bắt đầu nhanh

Cài package, thiết lập thông tin xác thực, rồi chạy agent đơn giản nhất theo tài liệu chính thức. ID model sử dụng trong tài liệu có thể chưa được bật cho tài khoản của bạn.

Cài đặt
npm install ai zod  (inferred; not copied from docs)

Cần 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

Nguồn hướng dẫn bắt đầu nhanh

Tính năng

Mọi modelCóDùng bất kỳ package provider nào hoặc chuỗi AI Gateway như anthropic/claude-sonnet-5.5
MCP clientCóclient @ai-sdk/mcp
MCP serverChưa xác nhận
Đa agentCóSubagent; HarnessAgent chạy Claude Code, Codex hoặc Pi
Lượt chạy bền vữngCóWorkflowAgent, cần bản beta Workflow 5
Phê duyệt của con ngườiCótoolApproval với phê duyệt ký bằng HMAC và chính sách OPA
TracingChưa xác nhận
EvalsChưa xác nhận

Các thay đổi gần đây

  • AI SDK 7 chọn ToolLoopAgent làm lớp agent được khuyến nghị.
  • HarnessAgent chạy Claude Code, Codex hoặc Pi làm agent.
  • WorkflowAgent (@ai-sdk/workflow) thay thế DurableAgent của Workflow DevKit.
  • runtimeContext và toolsContext thay thế experimental_context.

Các lựa chọn thay thế cùng ngôn ngữ

Nguồn

  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