Skip to content
Back to skills

Ai Sdk 6

ASecurity

Vercel AI SDK v6 development. Use when building AI agents, chatbots, tool integrations, or streaming applications with the ai package.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
ai-agentstypescriptbashreactapidocumentation

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill ai-sdk-6 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ai Sdk 6?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ai Sdk 6
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-ai-sdk-6/badge)](https://www.skillsdirectory.com/skills/david-li0406-ai-sdk-6)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ai-sdk-6
description: Vercel AI SDK v6 development. Use when building AI agents, chatbots, tool integrations, or streaming applications with the ai package.
---

# Vercel AI SDK v6 Development Guide

Use this skill when developing AI-powered features using Vercel AI SDK v6 (`ai` package).

## Quick Reference

### Installation

```bash
bun add ai @ai-sdk/anthropic zod
```

### Core Functions

| Function       | Purpose                                                           |
| -------------- | ----------------------------------------------------------------- |
| `generateText` | Non-streaming text generation (+ structured output with `Output`) |
| `streamText`   | Streaming text generation (+ structured output with `Output`)     |

> **v6 Note**: `generateObject`/`streamObject` are deprecated.
> Use `generateText`/`streamText` with `output: Output.object({ schema })` instead.

### Structured Output (v6)

```typescript
import { generateText, Output } from "ai";
import { z } from "zod";

const { output } = await generateText({
  model: anthropic("claude-sonnet-4-5"),
  output: Output.object({
    schema: z.object({
      sentiment: z.enum(["positive", "neutral", "negative"]),
      topics: z.array(z.string()),
    }),
  }),
  prompt: "Analyze this feedback...",
});
```

Output types: `Output.object()`, `Output.array()`, `Output.choice()`, `Output.json()`

### Agent Class (v6 Key Feature)

```typescript
import { ToolLoopAgent, tool, stepCountIs } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
import { z } from "zod";

const myAgent = new ToolLoopAgent({
  model: anthropic("claude-sonnet-4-5"),
  instructions: "You are a helpful assistant.",
  tools: {
    getData: tool({
      description: "Fetch data from API",
      inputSchema: z.object({
        query: z.string(),
      }),
      execute: async ({ query }) => {
        return { result: "data" };
      },
    }),
  },
  stopWhen: stepCountIs(20),
});

// Usage
const { text } = await myAgent.generate({ prompt: "Hello" });
const stream = myAgent.stream({ prompt: "Hello" });
```

### API Route with Agent

```typescript
// app/api/chat/route.ts
import { createAgentUIStreamResponse } from "ai";
import { myAgent } from "@/agents/my-agent";

export async function POST(request: Request) {
  const { messages } = await request.json();

  return createAgentUIStreamResponse({
    agent: myAgent,
    uiMessages: messages,
  });
}
```

### useChat Hook (Client)

```typescript
"use client";
import { useChat } from "@ai-sdk/react";

export function Chat() {
  const { messages, sendMessage, status } = useChat();

  return (
    <div>
      {messages.map((msg) => (
        <div key={msg.id}>
          {msg.parts.map((part) =>
            part.type === "text" ? part.text : null
          )}
        </div>
      ))}
    </div>
  );
}
```

## Reference Documentation

For detailed information, see:

- [agents.md](references/agents.md) - ToolLoopAgent, loop control, workflows
- [core-functions.md](references/core-functions.md) - generateText, streamText, Output patterns
- [tools.md](references/tools.md) - Tool definition with Zod schemas
- [ui-hooks.md](references/ui-hooks.md) - useChat, UIMessage, streaming
- [middleware.md](references/middleware.md) - Custom middleware patterns
- [mcp.md](references/mcp.md) - MCP server integration

## Official Documentation

For the latest information, see [AI SDK docs](https://ai-sdk.dev/docs/agents).

Files in this skill

  • SKILL.md3.4 KB
  • references/agents.md6.7 KB
  • references/core-functions.md10 KB
  • references/mcp.md4.7 KB
  • references/middleware.md4.2 KB
  • references/tools.md5.1 KB
  • references/ui-hooks.md7.2 KB
  • references/workflows.md7.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…