0aff31e2d3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
799 B
799 B
layout
| layout |
|---|
| default |
Vercel AI SDK 6 - Agentes
Agent class (nuevo en v6)
import { openai } from '@ai-sdk/openai';
import { Agent, tool } from 'ai';
import { z } from 'zod';
const agent = new Agent({
model: openai('gpt-4.1'),
tools: {
weather: tool({
description: 'Obtiene el clima',
parameters: z.object({ city: z.string() }),
execute: async ({ city }) => ({ temp: 22, condition: 'Soleado' }),
}),
},
maxSteps: 5,
});
¿Agentes completos?
| Tiene ✅ | No tiene ❌ |
|---|---|
| Agent class reutilizable | Persistencia de estado (threads) |
Human-in-the-loop (needsApproval) |
Tools built-in (code interpreter) |
| Tools custom + Streaming | Orquestación multi-agente nativa |