text
stringlengths
0
59.1k
import { openai } from "@ai-sdk/openai";
const agent = new Agent({
name: "Vercel Powered Assistant",
instructions: "Use OpenAI model via Vercel AI SDK.",
model: openai("gpt-4o"),
});
async function run() {
const res = await agent.generateText("Hello from VoltAgent!");
console.log(res.text);
}
```
:::tip Installation
```bash
npm install @voltagent/core @ai-sdk/openai
```
:::
This setup lets VoltAgent use AI SDK 5's advanced features (typed streaming, tool calls, agentic loops) while adding memory and observability via VoltOps.
---
### Observability and VoltOps Integration
VoltAgent integrates telemetry from VoltOps, enabling traceable AI calls:
```typescript
import { withTelemetry } from "@voltagent/vercel-ai-exporter";
import { generateText } from "ai";
await withTelemetry({
traceName: "order_agent",
metadata: { agentId: "123", session: "abc" },
})(async () => {
const result = await generateText({
model: openai("gpt-4o"),
prompt: "Hi!",
});
});
```
VoltOps collects structured traces, tool call timing, and metadata for debugging and optimization.
---
<IntegrationScenarioSelector />
### Use Cases
**Streaming Chatbots**
For chatbots handling customer service or queries, streaming responses improves user experience. VoltAgent with `VercelAIProvider` uses the `streamText` function to stream responses as they generate.
**Structured Data Extraction**
Extract specific information (keywords, technical specifications) from text into JSON format. VoltAgent uses Vercel AI SDK's `generateObject` with Zod schemas to enforce output structure.
:::danger Schema Complexity
When using `generateObject` with schema validation, start with simple structures. Deeply nested schemas can cause validation errors that are difficult to debug. Add complexity incrementally.
:::
**Agentic Automation**
VoltAgent orchestrates multiple AI SDK tools dynamically for complex workflows. The Vercel AI Provider supports passing provider-specific configuration options through VoltAgent when needed.
---
### Migration Notes
If upgrading from AI SDK 4 → 5:
- Update packages to `ai@5.0.0` and `@ai-sdk/provider@2.0.0`
- Replace deprecated `parameters` with `inputSchema`
- Update UI states (`partial-call` → `input-streaming`, `result` → `output-available`)
- Run Vercel's codemods for automatic refactoring
---
### Summary
- **Vercel AI SDK 5** adds a new typed protocol, agentic loops, SSE streaming, speech APIs, dynamic tools, and global providers.
- **VoltAgent** builds on top, adding autonomous behavior, memory, and VoltOps observability.
Together, they form a complete ecosystem for modern AI agents — from LLM communication to full agent orchestration.
---
### References
- [Vercel AI SDK 5 Blog](https://vercel.com/blog/ai-sdk-5)
- [AI SDK Migration Guide 5.0](https://sdk.vercel.ai/docs/ai-sdk-core/migrating-to-5.0)
- [VoltAgent Docs](https://voltagent.dev/docs/)
<|endoftext|>
# source: VoltAgent__voltagent/website/blog/2025-05-28-langfuse/index.md type: docs
---
title: What is Langfuse?
description: Tired of walking in the dark while developing LLM apps? Dive into the world of traces, evals, prompt management and metrics with Langfuse.
tags: [observability]