---
title: "Vercel AI SDK: ฟีเจอร์ เวอร์ชัน และ Quickstart · DotsAgent"
description: "Vercel AI SDK โดย Vercel: ไลเซนส์ เวอร์ชันล่าสุด รองรับ MCP, การรันงานแบบต่อเนื่อง การอนุมัติโดยมนุษย์ การ tracing และ evals พร้อม Quickstart ที่คัดลอกไปใช้ได้"
url: https://dotsagent.io/th/frameworks/vercel-ai-sdk
---

เฟรมเวิร์ก · Vercel

# ภาพรวม Vercel AI SDK

ชุดเครื่องมือ TypeScript ที่ไม่ผูกกับ provider ของ Vercel โดย ToolLoopAgent เป็นคลาสเอเจนต์หลักตั้งแต่ AI SDK 7 ชุดเครื่องมือนี้เชื่อม tool loop เข้ากับตัวช่วยสร้าง UI แบบ streaming ส่วน WorkflowAgent เพิ่มการรันงานที่ทำต่อได้หลังรีสตาร์ต

**เหมาะสำหรับ:**  นักพัฒนา Next.js และเว็บที่ต้องการเชื่อมเอเจนต์แบบ tool loop เข้ากับ UI แบบ streaming อย่างใกล้ชิด

## ข้อมูลสำคัญ

- **ผู้ดูแล**: Vercel
- **ภาษา**: TypeScript
- **ไลเซนส์**: Apache-2.0
- **เวอร์ชันล่าสุด**: `ai 7.0.126` · 30 กันยายน 2569
- **Repository**: [vercel/ai](https://github.com/vercel/ai) · 27,070 ดาว
- **ตัวเลือกแบบโฮสต์**: [Vercel Functions + Vercel Workflow](https://ai-sdk.dev/docs/agents/workflow-agent)แพลตฟอร์มโฮสต์ทั่วไป ไม่ใช่ runtime ที่ออกแบบมาสำหรับ agent โดยเฉพาะ

## Quickstart

ติดตั้งแพ็กเกจ ตั้งค่าข้อมูลรับรอง แล้วเรียกใช้ agent ตัวอย่างที่เล็กที่สุดจากเอกสารทางการ Model 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
```

[แหล่งข้อมูล Quickstart](https://ai-sdk.dev/docs/agents/overview)

## ฟีเจอร์

| ใช้ได้กับทุกโมเดล | — | ใช้แพ็กเกจของ provider ใดก็ได้ หรือระบุ string ของ AI Gateway เช่น anthropic/claude-sonnet-5.5 |
| --- | --- | --- |
| MCP client | — | ไคลเอนต์ @ai-sdk/mcp |
| MCP server | — | — |
| หลาย agent | — | Subagent; HarnessAgent เรียกใช้ Claude Code, Codex หรือ Pi |
| การทำงานต่อเนื่องแบบทนทาน | — | WorkflowAgent ซึ่งต้องใช้ Workflow 5 beta |
| การอนุมัติโดยมนุษย์ | — | toolApproval พร้อมการอนุมัติที่ลงนามด้วย HMAC และนโยบาย OPA |
| Tracing | — | — |
| Evals | — | — |

## การเปลี่ยนแปลงล่าสุด

- AI SDK 7 กำหนดให้ ToolLoopAgent เป็นคลาส agent ที่แนะนำ
- HarnessAgent ใช้ Claude Code, Codex หรือ Pi เป็น agent
- WorkflowAgent (@ai-sdk/workflow) มาแทน DurableAgent ของ Workflow DevKit
- runtimeContext และ toolsContext มาแทน experimental_context

## ทางเลือกในภาษาเดียวกัน

- [OpenAI Agents SDK (JS)](https://dotsagent.io/th/frameworks/openai-agents-js)

- [Claude Agent SDK](https://dotsagent.io/th/frameworks/claude-agent-sdk)

- [Google ADK](https://dotsagent.io/th/frameworks/google-adk)

- [LangGraph](https://dotsagent.io/th/frameworks/langgraph)

- [LlamaIndex](https://dotsagent.io/th/frameworks/llamaindex)

- [Mastra](https://dotsagent.io/th/frameworks/mastra)

## แหล่งข้อมูล

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

แหล่งอ้างอิงอิสระสำหรับผู้สร้าง AI agent ไม่มีส่วนเกี่ยวข้องกับผู้ให้บริการที่กล่าวถึง

© 2026 DotsAgent · ตรวจสอบข้อมูลเมื่อ 1 ตุลาคม 2569
