---
layout: default
---

# Vercel AI SDK 6 - Agentes

<v-clicks>

### Agent class (nuevo en v6)

```typescript
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 |

</v-clicks>



