Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/docs/pages/agent-integration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ Scenario provides specific integration guides for popular agent frameworks:
- **[LiteLLM Integration](./agent-integration/litellm)** - Integrate LiteLLM agents with unified LLM interface
- **[OpenAI Integration](./agent-integration/openai)** - Integrate OpenAI agents with direct API calls
- **[Pydantic AI Integration](./agent-integration/pydantic-ai)** - Integrate Pydantic AI agents with manual history management
- **[Vercel AI SDK Integration](./agent-integration/vercel-ai)** - Integrate Vercel AI SDK agents with streaming and tool calling support
- **[AgentKit Integration](./agent-integration/agentkit)** - Integrate AgentKit agents with proper state management

## Next Steps
Expand Down
58 changes: 58 additions & 0 deletions docs/docs/pages/agent-integration/vercel-ai.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
title: Test Vercel AI SDK Agents
description: Test agents built with Vercel AI SDK. Validate streaming responses, tool calling, structured outputs, and behavior across multiple AI providers.
---

import { RefLink } from "../../components/RefLink";

# Vercel AI SDK Integration [Learn how to integrate Vercel AI SDK agents with the Scenario testing framework]

[Vercel AI SDK](https://sdk.vercel.ai/docs) agents work seamlessly with Scenario through the <RefLink link={{ python: "agent_adapter.html#scenario.agent_adapter.AgentAdapter" }} code={{ python: "AgentAdapter" }} /> interface. The SDK provides a unified interface for building AI applications with streaming, tool calling, and structured outputs across multiple providers.

## Basic Integration Pattern

Given a Vercel AI SDK agent:

```typescript
import { openai } from '@ai-sdk/openai';
import { generateText } from 'ai';

async function myAgent(prompt: string) {
const result = await generateText({
model: openai('gpt-4-turbo'),
messages: [
{
role: 'system',
content: 'You are a helpful AI assistant.',
},
{
role: 'user',
content: prompt,
},
],
});

return result;
}
```

You can integrate it with Scenario like this:

```typescript
import scenario, { type AgentAdapter } from '@langwatch/scenario';

const createMyAgentAdapter = (): AgentAdapter => {
return {
call: async (input) => {
const result = await myAgent(input.messages.at(-1)?.content);
return result.response.messages;
},
};
};
```

## Next Steps

- Explore [Scenario Basics](/basics/concepts) for advanced testing patterns
- Learn about [Scripted Simulations](/basics/scripted-simulations) for precise control
- Check out more [Agent Integration patterns](/agent-integration) for other frameworks
4 changes: 4 additions & 0 deletions docs/vocs.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ export default defineConfig({
text: "Pydantic AI",
link: "/agent-integration/pydantic-ai",
},
{
text: "Vercel AI SDK",
link: "/agent-integration/vercel-ai",
},
],
},
{
Expand Down