ai 7.0.157 → 7.0.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +1 -1
- package/docs/02-foundations/02-providers-and-models.mdx +32 -5
- package/docs/03-agents/01-overview.mdx +7 -0
- package/docs/03-agents/10-eve.mdx +96 -0
- package/docs/03-agents/index.mdx +6 -0
- package/docs/03-ai-sdk-core/16-mcp-tools.mdx +13 -7
- package/docs/03-ai-sdk-core/17-mcp-apps.mdx +3 -8
- package/docs/06-advanced/10-vercel-deployment-guide.mdx +7 -0
- package/docs/07-reference/01-ai-sdk-core/23-create-mcp-client.mdx +6 -8
- package/docs/07-reference/01-ai-sdk-core/24-mcp-stdio-transport.mdx +4 -4
- package/docs/07-reference/01-ai-sdk-core/34-sandbox.mdx +114 -6
- package/docs/07-reference/02-ai-sdk-ui/48-mcp-app-renderer.mdx +6 -11
- package/docs/07-reference/02-ai-sdk-ui/index.mdx +1 -1
- package/package.json +12 -12
- package/src/index.ts +2 -0
- package/src/test/mock-sandbox.ts +7 -1
- package/src/util/fix-json.ts +0 -1
package/dist/internal/index.js
CHANGED
|
@@ -115,6 +115,8 @@ Additionally, any self-hosted provider that supports the OpenAI specification ca
|
|
|
115
115
|
The AI providers support different language models with various capabilities.
|
|
116
116
|
Here are the capabilities of popular models:
|
|
117
117
|
|
|
118
|
+
{/* OpenAI, Anthropic, and Google rows are generated from provider model catalogs by pnpm generate:model-capabilities-docs. */}
|
|
119
|
+
|
|
118
120
|
| Provider | Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
|
|
119
121
|
| -------------------------------------------------- | ------------------------------------------- | ----------- | ----------------- | ---------- | -------------- |
|
|
120
122
|
| [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-4.7` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
@@ -124,6 +126,8 @@ Here are the capabilities of popular models:
|
|
|
124
126
|
| [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-3` | <Cross /> | <Check /> | <Check /> | <Check /> |
|
|
125
127
|
| [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-3-mini` | <Cross /> | <Check /> | <Check /> | <Check /> |
|
|
126
128
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6-astra` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
129
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6.1-sol` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
130
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6.1-terra` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
127
131
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6-luna` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
128
132
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6-sol` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
129
133
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.6` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
@@ -139,18 +143,26 @@ Here are the capabilities of popular models:
|
|
|
139
143
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.2-pro` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
140
144
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.2-chat-latest` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
141
145
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.2` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
142
|
-
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
143
|
-
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5-mini` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
144
|
-
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5-nano` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
145
|
-
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.1-chat-latest` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
146
146
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.1-codex-mini` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
147
147
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.1-codex` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
148
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.1-chat-latest` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
148
149
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.1` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
150
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5-pro` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
151
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
152
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5-mini` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
153
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5-nano` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
149
154
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5-codex` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
150
|
-
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5-chat-latest` | <Check /> | <
|
|
155
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5-chat-latest` | <Check /> | <Cross /> | <Cross /> | <Cross /> |
|
|
156
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-4.1` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
157
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-4.1-mini` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
158
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-4.1-nano` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
159
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-4o` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
160
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-4o-mini` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
151
161
|
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-5-5` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
162
|
+
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-5` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
152
163
|
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-sonnet-5-5` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
153
164
|
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-sonnet-5` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
165
|
+
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-haiku-5-5` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
154
166
|
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-fable-5-1` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
155
167
|
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-fable-5` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
156
168
|
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-4-8` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
@@ -158,14 +170,29 @@ Here are the capabilities of popular models:
|
|
|
158
170
|
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-4-6` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
159
171
|
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-sonnet-4-6` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
160
172
|
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-4-5` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
173
|
+
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-haiku-4-5` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
174
|
+
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-sonnet-4-5` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
161
175
|
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-4-1` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
162
176
|
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-4-0` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
163
177
|
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-sonnet-4-0` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
178
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-nano-banana-2.1` | <Check /> | <Cross /> | <Cross /> | <Cross /> |
|
|
179
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-4-argon` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
164
180
|
| [Google](/providers/ai-sdk-providers/google) | `gemini-3.8-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
181
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-3.7-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
182
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-3.6-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
183
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-3.5-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
184
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-3.5-flash-lite` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
165
185
|
| [Google](/providers/ai-sdk-providers/google) | `gemini-3.1-pro-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
186
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-3.1-flash-image-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
187
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-3.1-flash-lite-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
166
188
|
| [Google](/providers/ai-sdk-providers/google) | `gemini-3-pro-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
189
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-3-pro-image-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
190
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-3-flash-preview` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
167
191
|
| [Google](/providers/ai-sdk-providers/google) | `gemini-2.5-pro` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
168
192
|
| [Google](/providers/ai-sdk-providers/google) | `gemini-2.5-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
193
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-2.5-flash-lite` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
194
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-2.5-flash-lite-preview-06-17` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
195
|
+
| [Google](/providers/ai-sdk-providers/google) | `gemini-2.0-flash` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
169
196
|
| [Mistral](/providers/ai-sdk-providers/mistral) | `pixtral-large-latest` | <Check /> | <Check /> | <Check /> | <Check /> |
|
|
170
197
|
| [Mistral](/providers/ai-sdk-providers/mistral) | `mistral-large-latest` | <Cross /> | <Check /> | <Check /> | <Check /> |
|
|
171
198
|
| [Mistral](/providers/ai-sdk-providers/mistral) | `mistral-medium-latest` | <Cross /> | <Check /> | <Check /> | <Check /> |
|
|
@@ -133,6 +133,12 @@ Agents are flexible and powerful, but non-deterministic. When you need reliable,
|
|
|
133
133
|
|
|
134
134
|
[Explore workflow patterns](/docs/agents/workflows) to learn more about building structured, reliable systems.
|
|
135
135
|
|
|
136
|
+
## Agent Frameworks
|
|
137
|
+
|
|
138
|
+
The agent classes in this section are primitives you assemble inside your own application. When you want a production framework for durable, long-running agents — with channels, schedules, approvals, and testing included — [eve](https://eve.dev) is an open-source framework built on the AI SDK. It uses the same `tool()` shape and model settings, and runs agents durably on Vercel or self-hosted.
|
|
139
|
+
|
|
140
|
+
Learn more in [eve](/docs/agents/eve).
|
|
141
|
+
|
|
136
142
|
## Next Steps
|
|
137
143
|
|
|
138
144
|
- **[Building Agents](/docs/agents/building-agents)** - Guide to creating agents with the ToolLoopAgent
|
|
@@ -140,3 +146,4 @@ Agents are flexible and powerful, but non-deterministic. When you need reliable,
|
|
|
140
146
|
- **[Workflow Patterns](/docs/agents/workflows)** - Structured patterns using core functions for complex workflows
|
|
141
147
|
- **[Loop Control](/docs/agents/loop-control)** - Execution control with stopWhen and prepareStep
|
|
142
148
|
- **[Chat Platforms](/docs/agents/chat-platforms)** - Run agents in Slack, Microsoft Teams, Discord, and more with Chat SDK
|
|
149
|
+
- **[eve](/docs/agents/eve)** - Build production agents for durable, long-running work
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: eve
|
|
3
|
+
description: Build production AI agents with eve, an open-source agent framework for durable, long-running work that is built on the AI SDK.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# eve
|
|
7
|
+
|
|
8
|
+
[eve](https://eve.dev) is an open-source agent framework for durable, long-running work. Build, govern, and evolve enterprise-grade agents that scale — with channels, durable runs, approvals, and testing built in.
|
|
9
|
+
|
|
10
|
+
eve is built on the AI SDK:
|
|
11
|
+
|
|
12
|
+
- `defineTool` uses the same shape as [`tool()`](/docs/ai-sdk-core/tools-and-tool-calling): a `description`, an `inputSchema` (Zod, any Standard Schema, or a JSON Schema object), and an `execute` function.
|
|
13
|
+
- `defineAgent` accepts an [AI Gateway](https://vercel.com/ai-gateway) model ID such as `openai/gpt-6-luna-fast`, or any AI SDK `LanguageModel` from a [provider package](/providers).
|
|
14
|
+
- Options like `reasoning` map to the AI SDK's model settings.
|
|
15
|
+
- A [Chat SDK](/docs/agents/chat-platforms) channel connects any Chat SDK adapter to your agent.
|
|
16
|
+
|
|
17
|
+
## Built for Production
|
|
18
|
+
|
|
19
|
+
- **Channels** — Multiplayer and single-player chat across Slack, Teams, iMessage, WhatsApp, and the web. Channels are a framework primitive.
|
|
20
|
+
- **Durable runs** — Checkpoints every step. Survives crashes, restarts, and days-long waits. Runs on crons, too.
|
|
21
|
+
- **Agentic or deterministic** — Fully agentic loops, deterministic workflows, or both in one run. You choose per task.
|
|
22
|
+
- **Human in the loop** — Pause for approval. Resume durably when it arrives.
|
|
23
|
+
- **Any provider** — Swap models with a one-line edit. Provider fallback included. Route different models to different tasks.
|
|
24
|
+
- **Per-user capabilities** — Skills, schedules, memory, and tools resolved per user at runtime.
|
|
25
|
+
- **MCP, OpenAPI, and subagents** — Connect to services over MCP and OpenAPI, or delegate to focused subagents. Credentials stay in the runtime.
|
|
26
|
+
- **Testing** — Test agent behavior before and after every change.
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
Create a new agent project:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx eve@latest init my-agent
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This creates a `my-agent` directory, installs its dependencies, initializes Git, and starts the interactive terminal UI. To add an agent to an existing project, pass a path:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cd myapp
|
|
40
|
+
npx eve@latest init .
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
<Note>
|
|
44
|
+
Like the `ai` package, `eve` bundles its full documentation, so coding agents
|
|
45
|
+
can read it locally from `node_modules/eve/docs`. See [Coding
|
|
46
|
+
Agents](/docs/getting-started/coding-agents) for the same workflow with the AI
|
|
47
|
+
SDK.
|
|
48
|
+
</Note>
|
|
49
|
+
|
|
50
|
+
## A Minimal Example
|
|
51
|
+
|
|
52
|
+
An eve agent lives in an `agent/` directory. Replace the system prompt in `agent/instructions.md`:
|
|
53
|
+
|
|
54
|
+
```md filename="agent/instructions.md"
|
|
55
|
+
You are a concise weather demo assistant. Tell users that the weather data is mocked.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Add a tool at `agent/tools/get_weather.ts`. The filename is the tool name the model sees:
|
|
59
|
+
|
|
60
|
+
```ts filename="agent/tools/get_weather.ts"
|
|
61
|
+
import { defineTool } from 'eve/tools';
|
|
62
|
+
import { z } from 'zod';
|
|
63
|
+
|
|
64
|
+
export default defineTool({
|
|
65
|
+
description: 'Return mock weather data for a city.',
|
|
66
|
+
inputSchema: z.object({ city: z.string().min(1) }),
|
|
67
|
+
async execute({ city }) {
|
|
68
|
+
return { city, condition: 'Sunny', temperatureF: 72 };
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Choose the model in `agent/agent.ts`:
|
|
74
|
+
|
|
75
|
+
```ts filename="agent/agent.ts"
|
|
76
|
+
import { defineAgent } from 'eve';
|
|
77
|
+
|
|
78
|
+
export default defineAgent({
|
|
79
|
+
model: 'openai/gpt-6-luna-fast',
|
|
80
|
+
reasoning: 'high',
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## When to Choose eve
|
|
85
|
+
|
|
86
|
+
The AI SDK gives you the primitives; eve is the production framework around them.
|
|
87
|
+
|
|
88
|
+
- Use eve when you want a complete production agent — durable, long-running work across channels, schedules, and approvals — without assembling those pieces yourself.
|
|
89
|
+
- Use [`ToolLoopAgent`](/docs/agents/building-agents) when you are assembling your own model-and-tools loop inside an application.
|
|
90
|
+
- Use [`WorkflowAgent`](/docs/agents/workflow-agent) from `@ai-sdk/workflow` when you need durable, resumable execution with explicit workflow steps.
|
|
91
|
+
- Use [Chat SDK](/docs/agents/chat-platforms) when you are adding an agent to chat platforms.
|
|
92
|
+
|
|
93
|
+
## Next Steps
|
|
94
|
+
|
|
95
|
+
- [eve documentation](https://eve.dev/docs) — the full project layout and guides
|
|
96
|
+
- [eve on GitHub](https://github.com/vercel/eve) — source code and discussions
|
package/docs/03-agents/index.mdx
CHANGED
|
@@ -74,5 +74,11 @@ The following section shows you how to build agents with the AI SDK - systems wh
|
|
|
74
74
|
'Run agents in Slack, Microsoft Teams, Discord, and more with Chat SDK.',
|
|
75
75
|
href: '/docs/agents/chat-platforms',
|
|
76
76
|
},
|
|
77
|
+
{
|
|
78
|
+
title: 'eve',
|
|
79
|
+
description:
|
|
80
|
+
'Build production AI agents with eve, an open-source framework for durable, long-running work.',
|
|
81
|
+
href: '/docs/agents/eve',
|
|
82
|
+
},
|
|
77
83
|
]}
|
|
78
84
|
/>
|
|
@@ -160,7 +160,7 @@ The Stdio transport can be imported from either the MCP SDK or the AI SDK:
|
|
|
160
160
|
import { createMCPClient } from '@ai-sdk/mcp';
|
|
161
161
|
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
162
162
|
// Or use the AI SDK's stdio transport:
|
|
163
|
-
// import {
|
|
163
|
+
// import { StdioMCPTransport as StdioClientTransport } from '@ai-sdk/mcp/mcp-stdio';
|
|
164
164
|
|
|
165
165
|
const mcpClient = await createMCPClient({
|
|
166
166
|
transport: new StdioClientTransport({
|
|
@@ -666,16 +666,12 @@ client throws an `MCPClientError`.
|
|
|
666
666
|
|
|
667
667
|
## Using MCP Prompts
|
|
668
668
|
|
|
669
|
-
<Note type="warning">
|
|
670
|
-
MCP Prompts is an experimental feature and may change in the future.
|
|
671
|
-
</Note>
|
|
672
|
-
|
|
673
669
|
According to the MCP specification, prompts are user-controlled templates that servers expose for clients to list and retrieve with optional arguments.
|
|
674
670
|
|
|
675
671
|
### Listing Prompts
|
|
676
672
|
|
|
677
673
|
```typescript
|
|
678
|
-
const prompts = await mcpClient.
|
|
674
|
+
const prompts = await mcpClient.listPrompts();
|
|
679
675
|
```
|
|
680
676
|
|
|
681
677
|
### Getting a Prompt
|
|
@@ -683,7 +679,7 @@ const prompts = await mcpClient.experimental_listPrompts();
|
|
|
683
679
|
Retrieve prompt messages, optionally passing arguments defined by the server:
|
|
684
680
|
|
|
685
681
|
```typescript
|
|
686
|
-
const prompt = await mcpClient.
|
|
682
|
+
const prompt = await mcpClient.getPrompt({
|
|
687
683
|
name: 'code_review',
|
|
688
684
|
arguments: { code: 'function add(a, b) { return a + b; }' },
|
|
689
685
|
});
|
|
@@ -742,6 +738,16 @@ mcpClient.onElicitationRequest(ElicitationRequestSchema, async request => {
|
|
|
742
738
|
|
|
743
739
|
### Elicitation Response Actions
|
|
744
740
|
|
|
741
|
+
On MCP `2026-07-28` connections, the same handler processes form elicitation
|
|
742
|
+
requests embedded in `input_required` results from tools, prompts, and resource
|
|
743
|
+
reads. The client retries the original request with the handler's answers and
|
|
744
|
+
the server's unchanged `requestState` until it receives a final result, with a
|
|
745
|
+
limit of 10 retries. State-only retries are delayed by 250 ms. Each round respects
|
|
746
|
+
`timeout`, including time spent awaiting the handler, while `maxTotalTimeout`
|
|
747
|
+
bounds the entire exchange. Missing handlers and unsupported input requests
|
|
748
|
+
reject the operation. Older connections continue to use `elicitation/create`
|
|
749
|
+
server requests.
|
|
750
|
+
|
|
745
751
|
Your handler must return an object with an `action` field that can be one of:
|
|
746
752
|
|
|
747
753
|
- `'accept'`: User provided the requested information. Must include `content` with the data.
|
|
@@ -153,18 +153,13 @@ In production, add any policy and user approval checks your app needs before for
|
|
|
153
153
|
|
|
154
154
|
## Render With React
|
|
155
155
|
|
|
156
|
-
In your React chat UI, render normal message parts as usual and pass tool parts to `
|
|
157
|
-
|
|
158
|
-
<Note type="warning">
|
|
159
|
-
`experimental_MCPAppRenderer` is experimental and may change in a future
|
|
160
|
-
release.
|
|
161
|
-
</Note>
|
|
156
|
+
In your React chat UI, render normal message parts as usual and pass tool parts to `MCPAppRenderer`.
|
|
162
157
|
|
|
163
158
|
```tsx filename="app/page.tsx"
|
|
164
159
|
'use client';
|
|
165
160
|
|
|
166
161
|
import {
|
|
167
|
-
|
|
162
|
+
MCPAppRenderer,
|
|
168
163
|
useChat,
|
|
169
164
|
type MCPAppBridgeHandlers,
|
|
170
165
|
type MCPAppMetadata,
|
|
@@ -242,7 +237,7 @@ export default function Chat() {
|
|
|
242
237
|
}
|
|
243
238
|
```
|
|
244
239
|
|
|
245
|
-
For ordinary tools, `
|
|
240
|
+
For ordinary tools, `MCPAppRenderer` renders the provided `fallback` (or nothing when no fallback is provided). For app-backed tools, it loads the resource, creates the sandbox bridge, sends tool input and result notifications to the iframe, and forwards supported app requests through your handlers.
|
|
246
241
|
|
|
247
242
|
## Best Practices
|
|
248
243
|
|
|
@@ -11,6 +11,13 @@ Vercel is a platform for developers that provides the tools, workflows, and infr
|
|
|
11
11
|
|
|
12
12
|
Vercel allows for automatic deployments on every branch push and merges onto the production branch of your GitHub, GitLab, and Bitbucket projects. It is a great option for deploying your AI application.
|
|
13
13
|
|
|
14
|
+
<Note>
|
|
15
|
+
Deploying a durable backend agent instead of an application with a UI?
|
|
16
|
+
[eve](https://eve.dev) is an open-source agent framework built on the AI SDK
|
|
17
|
+
for durable, long-running work — channels, schedules, and approvals included.
|
|
18
|
+
Learn more in the [eve guide](/docs/agents/eve).
|
|
19
|
+
</Note>
|
|
20
|
+
|
|
14
21
|
## Before You Begin
|
|
15
22
|
|
|
16
23
|
To follow along with this guide, you will need:
|
|
@@ -562,13 +562,12 @@ Returns a Promise that resolves to an `MCPClient` with the following properties
|
|
|
562
562
|
],
|
|
563
563
|
},
|
|
564
564
|
{
|
|
565
|
-
name: '
|
|
565
|
+
name: 'listPrompts',
|
|
566
566
|
type: `async (options?: {
|
|
567
567
|
params?: PaginatedRequest['params'];
|
|
568
568
|
options?: RequestOptions;
|
|
569
569
|
}) => Promise<ListPromptsResult>`,
|
|
570
|
-
description:
|
|
571
|
-
'Lists available prompts from the MCP server. This method is experimental and may change in the future.',
|
|
570
|
+
description: 'Lists available prompts from the MCP server.',
|
|
572
571
|
properties: [
|
|
573
572
|
{
|
|
574
573
|
type: 'options',
|
|
@@ -591,14 +590,13 @@ Returns a Promise that resolves to an `MCPClient` with the following properties
|
|
|
591
590
|
],
|
|
592
591
|
},
|
|
593
592
|
{
|
|
594
|
-
name: '
|
|
593
|
+
name: 'getPrompt',
|
|
595
594
|
type: `async (args: {
|
|
596
595
|
name: string;
|
|
597
596
|
arguments?: Record<string, unknown>;
|
|
598
597
|
options?: RequestOptions;
|
|
599
598
|
}) => Promise<GetPromptResult>`,
|
|
600
|
-
description:
|
|
601
|
-
'Retrieves a prompt by name, optionally passing arguments. This method is experimental and may change in the future.',
|
|
599
|
+
description: 'Retrieves a prompt by name, optionally passing arguments.',
|
|
602
600
|
properties: [
|
|
603
601
|
{
|
|
604
602
|
type: 'args',
|
|
@@ -667,13 +665,13 @@ Returns a Promise that resolves to an `MCPClient` with the following properties
|
|
|
667
665
|
```typescript
|
|
668
666
|
import { createMCPClient } from '@ai-sdk/mcp';
|
|
669
667
|
import { generateText } from 'ai';
|
|
670
|
-
import {
|
|
668
|
+
import { StdioMCPTransport } from '@ai-sdk/mcp/mcp-stdio';
|
|
671
669
|
|
|
672
670
|
let client;
|
|
673
671
|
|
|
674
672
|
try {
|
|
675
673
|
client = await createMCPClient({
|
|
676
|
-
transport: new
|
|
674
|
+
transport: new StdioMCPTransport({
|
|
677
675
|
command: 'node server.js',
|
|
678
676
|
}),
|
|
679
677
|
});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: StdioMCPTransport
|
|
3
3
|
description: Create a transport for Model Context Protocol (MCP) clients to communicate with MCP servers using standard input and output streams
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# `
|
|
6
|
+
# `StdioMCPTransport`
|
|
7
7
|
|
|
8
8
|
Creates a transport for Model Context Protocol (MCP) clients to communicate with MCP servers using standard input and output streams. This transport is only supported in Node.js environments.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
`Experimental_StdioMCPTransport` is a deprecated alias of `StdioMCPTransport`.
|
|
11
11
|
|
|
12
12
|
## Import
|
|
13
13
|
|
|
14
14
|
<Snippet
|
|
15
|
-
text={`import {
|
|
15
|
+
text={`import { StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio"`}
|
|
16
16
|
prompt={false}
|
|
17
17
|
/>
|
|
18
18
|
|
|
@@ -6,7 +6,7 @@ description: API Reference for the Experimental_SandboxSession interface.
|
|
|
6
6
|
# `Experimental_SandboxSession`
|
|
7
7
|
|
|
8
8
|
The `Experimental_SandboxSession` interface describes an execution environment that
|
|
9
|
-
tools can use to run commands. Pass an experimental sandbox using the
|
|
9
|
+
tools can use to run commands and access files. Pass an experimental sandbox using the
|
|
10
10
|
`experimental_sandbox` option to `generateText`, `streamText`,
|
|
11
11
|
`ToolLoopAgent.generate`, `ToolLoopAgent.stream`, or agent UI stream helpers to
|
|
12
12
|
make it available to tool description functions and tool execution.
|
|
@@ -30,19 +30,91 @@ make it available to tool description functions and tool execution.
|
|
|
30
30
|
```ts
|
|
31
31
|
type Experimental_SandboxSession = {
|
|
32
32
|
readonly description: string;
|
|
33
|
+
|
|
33
34
|
readonly run: (options: {
|
|
34
35
|
command: string;
|
|
35
36
|
workingDirectory?: string;
|
|
36
37
|
env?: Record<string, string>;
|
|
37
38
|
abortSignal?: AbortSignal;
|
|
38
|
-
}) => PromiseLike<{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
}) => PromiseLike<{ exitCode: number; stdout: string; stderr: string }>;
|
|
40
|
+
readonly spawn: (options: {
|
|
41
|
+
command: string;
|
|
42
|
+
workingDirectory?: string;
|
|
43
|
+
env?: Record<string, string>;
|
|
44
|
+
abortSignal?: AbortSignal;
|
|
45
|
+
stdin?: boolean;
|
|
46
|
+
}) => PromiseLike<Experimental_SandboxProcess>;
|
|
47
|
+
|
|
48
|
+
readonly readFile: (options: {
|
|
49
|
+
path: string;
|
|
50
|
+
abortSignal?: AbortSignal;
|
|
51
|
+
}) => PromiseLike<ReadableStream<Uint8Array> | null>;
|
|
52
|
+
readonly readBinaryFile: (options: {
|
|
53
|
+
path: string;
|
|
54
|
+
abortSignal?: AbortSignal;
|
|
55
|
+
}) => PromiseLike<Uint8Array | null>;
|
|
56
|
+
readonly readTextFile: (options: {
|
|
57
|
+
path: string;
|
|
58
|
+
encoding?: string;
|
|
59
|
+
startLine?: number;
|
|
60
|
+
endLine?: number;
|
|
61
|
+
abortSignal?: AbortSignal;
|
|
62
|
+
}) => PromiseLike<string | null>;
|
|
63
|
+
|
|
64
|
+
readonly writeFile: (options: {
|
|
65
|
+
path: string;
|
|
66
|
+
content: ReadableStream<Uint8Array>;
|
|
67
|
+
abortSignal?: AbortSignal;
|
|
68
|
+
}) => PromiseLike<void>;
|
|
69
|
+
readonly writeBinaryFile: (options: {
|
|
70
|
+
path: string;
|
|
71
|
+
content: Uint8Array;
|
|
72
|
+
abortSignal?: AbortSignal;
|
|
73
|
+
}) => PromiseLike<void>;
|
|
74
|
+
readonly writeTextFile: (options: {
|
|
75
|
+
path: string;
|
|
76
|
+
content: string;
|
|
77
|
+
encoding?: string;
|
|
78
|
+
abortSignal?: AbortSignal;
|
|
79
|
+
}) => PromiseLike<void>;
|
|
80
|
+
|
|
81
|
+
readonly stat: (options: {
|
|
82
|
+
path: string;
|
|
83
|
+
abortSignal?: AbortSignal;
|
|
84
|
+
}) => PromiseLike<Experimental_SandboxFileStat | null>;
|
|
85
|
+
readonly listDirectory: (options: {
|
|
86
|
+
path: string;
|
|
87
|
+
abortSignal?: AbortSignal;
|
|
88
|
+
}) => PromiseLike<Array<Experimental_SandboxDirectoryEntry> | null>;
|
|
89
|
+
readonly deleteFile: (options: {
|
|
90
|
+
path: string;
|
|
91
|
+
abortSignal?: AbortSignal;
|
|
92
|
+
}) => PromiseLike<boolean>;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
type Experimental_SandboxFileStat = {
|
|
96
|
+
type: 'file' | 'directory' | 'other';
|
|
97
|
+
size: number;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
type Experimental_SandboxDirectoryEntry = {
|
|
101
|
+
name: string;
|
|
102
|
+
type: 'file' | 'directory' | 'symlink' | 'other';
|
|
43
103
|
};
|
|
44
104
|
```
|
|
45
105
|
|
|
106
|
+
## Paths
|
|
107
|
+
|
|
108
|
+
Relative paths in every method, including the `workingDirectory` option of `run`
|
|
109
|
+
and `spawn`, resolve against the same base directory: the directory that `run`
|
|
110
|
+
and `spawn` start in when no `workingDirectory` is given. The base directory does
|
|
111
|
+
not change for the lifetime of the session. Changing the directory inside a
|
|
112
|
+
command, for example with `cd`, only affects that command. Absolute paths are
|
|
113
|
+
used as is.
|
|
114
|
+
|
|
115
|
+
This lets tools combine methods. For example, a path that a `grep` command run
|
|
116
|
+
with `run` prints can be passed to `readTextFile`.
|
|
117
|
+
|
|
46
118
|
## Properties
|
|
47
119
|
|
|
48
120
|
<PropertiesTable
|
|
@@ -90,6 +162,42 @@ type Experimental_SandboxSession = {
|
|
|
90
162
|
},
|
|
91
163
|
],
|
|
92
164
|
},
|
|
165
|
+
{
|
|
166
|
+
name: 'spawn',
|
|
167
|
+
type: '(options: { command: string; workingDirectory?: string; env?: Record<string, string>; abortSignal?: AbortSignal; stdin?: boolean }) => PromiseLike<Experimental_SandboxProcess>',
|
|
168
|
+
description:
|
|
169
|
+
'Starts a long-running process and returns immediately with a handle that streams standard output and standard error, can be waited on, and can be killed. With `stdin: true`, standard input stays open and the handle also has a writable `stdin` stream; implementations that do not support this reject before starting the command.',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'readFile / readBinaryFile / readTextFile',
|
|
173
|
+
type: '(options: { path: string; abortSignal?: AbortSignal }) => PromiseLike<ReadableStream<Uint8Array> | Uint8Array | string | null>',
|
|
174
|
+
description:
|
|
175
|
+
'Reads one file as a stream of bytes, raw bytes, or decoded text. Resolves to `null` when the file does not exist. `readTextFile` accepts an `encoding` (default `utf-8`) and 1-based inclusive `startLine` and `endLine`.',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: 'writeFile / writeBinaryFile / writeTextFile',
|
|
179
|
+
type: '(options: { path: string; content: ReadableStream<Uint8Array> | Uint8Array | string; abortSignal?: AbortSignal }) => PromiseLike<void>',
|
|
180
|
+
description:
|
|
181
|
+
'Writes one file from a stream of bytes, raw bytes, or a string. Creates parent directories and overwrites an existing file. Rejects when the path is a directory.',
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'stat',
|
|
185
|
+
type: '(options: { path: string; abortSignal?: AbortSignal }) => PromiseLike<Experimental_SandboxFileStat | null>',
|
|
186
|
+
description:
|
|
187
|
+
'Returns the type (`file`, `directory`, or `other`) and size in bytes of a path. The size of a directory is implementation-defined. Symbolic links are followed. Resolves to `null` when the path does not exist.',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'listDirectory',
|
|
191
|
+
type: '(options: { path: string; abortSignal?: AbortSignal }) => PromiseLike<Array<Experimental_SandboxDirectoryEntry> | null>',
|
|
192
|
+
description:
|
|
193
|
+
'Lists the entries of one directory, without descending into subdirectories. Each entry has a `name` and a `type` (`file`, `directory`, `symlink`, or `other`); symbolic links are not followed. The order is unspecified. Resolves to `null` when the directory does not exist and rejects when the path is not a directory.',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'deleteFile',
|
|
197
|
+
type: '(options: { path: string; abortSignal?: AbortSignal }) => PromiseLike<boolean>',
|
|
198
|
+
description:
|
|
199
|
+
'Deletes one file. A symbolic link is deleted itself, not its target. Resolves to `true` when the file was deleted and `false` when it does not exist. Rejects when the path is a directory.',
|
|
200
|
+
},
|
|
93
201
|
]}
|
|
94
202
|
/>
|
|
95
203
|
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: MCPAppRenderer
|
|
3
3
|
description: API reference for rendering MCP Apps with @ai-sdk/react.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# `
|
|
6
|
+
# `MCPAppRenderer`
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
`experimental_MCPAppRenderer` is experimental and may change in a future
|
|
10
|
-
release.
|
|
11
|
-
</Note>
|
|
12
|
-
|
|
13
|
-
`experimental_MCPAppRenderer` renders an MCP App for an AI SDK tool UI part. It detects MCP App metadata on the tool part, loads the app resource, renders the app in a sandbox proxy iframe, and bridges MCP Apps JSON-RPC messages between the iframe and your host application.
|
|
8
|
+
`MCPAppRenderer` renders an MCP App for an AI SDK tool UI part. It detects MCP App metadata on the tool part, loads the app resource, renders the app in a sandbox proxy iframe, and bridges MCP Apps JSON-RPC messages between the iframe and your host application.
|
|
14
9
|
|
|
15
10
|
For tool parts without MCP App metadata, the component renders the `fallback`.
|
|
16
11
|
|
|
17
12
|
## Import
|
|
18
13
|
|
|
19
14
|
<Snippet
|
|
20
|
-
text={`import {
|
|
15
|
+
text={`import { MCPAppRenderer } from "@ai-sdk/react"`}
|
|
21
16
|
prompt={false}
|
|
22
17
|
/>
|
|
23
18
|
|
|
@@ -27,7 +22,7 @@ For tool parts without MCP App metadata, the component renders the `fallback`.
|
|
|
27
22
|
'use client';
|
|
28
23
|
|
|
29
24
|
import {
|
|
30
|
-
|
|
25
|
+
MCPAppRenderer,
|
|
31
26
|
type MCPAppBridgeHandlers,
|
|
32
27
|
type MCPAppMetadata,
|
|
33
28
|
type MCPAppResource,
|
|
@@ -198,7 +193,7 @@ export function MessagePart({ part }: { part: unknown }) {
|
|
|
198
193
|
|
|
199
194
|
## Bridge Handlers
|
|
200
195
|
|
|
201
|
-
`
|
|
196
|
+
`MCPAppRenderer` uses these handlers to respond to iframe requests. In production, server-backed handlers should validate authorization and MCP Apps tool visibility before calling the MCP server.
|
|
202
197
|
|
|
203
198
|
<PropertiesTable
|
|
204
199
|
content={[
|
|
@@ -77,7 +77,7 @@ AI SDK UI contains the following hooks:
|
|
|
77
77
|
href: '/docs/reference/ai-sdk-ui/websocket-chat-transport',
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
|
-
title: '
|
|
80
|
+
title: 'MCPAppRenderer',
|
|
81
81
|
description: 'Render interactive MCP App tool UIs in React.',
|
|
82
82
|
href: '/docs/reference/ai-sdk-ui/mcp-app-renderer',
|
|
83
83
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.158",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,20 +42,20 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@ai-sdk/gateway": "4.0.
|
|
46
|
-
"@ai-sdk/provider": "4.0.
|
|
47
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
45
|
+
"@ai-sdk/gateway": "4.0.131",
|
|
46
|
+
"@ai-sdk/provider": "4.0.35",
|
|
47
|
+
"@ai-sdk/provider-utils": "5.0.72"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@ai-sdk/amazon-bedrock": "5.0.
|
|
51
|
-
"@ai-sdk/deepseek": "3.0.
|
|
52
|
-
"@ai-sdk/google": "4.0.
|
|
53
|
-
"@ai-sdk/groq": "4.0.
|
|
54
|
-
"@ai-sdk/huggingface": "2.0.
|
|
55
|
-
"@ai-sdk/moonshotai": "3.0.
|
|
56
|
-
"@ai-sdk/openai": "4.0.
|
|
50
|
+
"@ai-sdk/amazon-bedrock": "5.0.129",
|
|
51
|
+
"@ai-sdk/deepseek": "3.0.77",
|
|
52
|
+
"@ai-sdk/google": "4.0.109",
|
|
53
|
+
"@ai-sdk/groq": "4.0.74",
|
|
54
|
+
"@ai-sdk/huggingface": "2.0.82",
|
|
55
|
+
"@ai-sdk/moonshotai": "3.0.82",
|
|
56
|
+
"@ai-sdk/openai": "4.0.106",
|
|
57
57
|
"@ai-sdk/test-server": "2.0.4",
|
|
58
|
-
"@ai-sdk/xai": "5.0.
|
|
58
|
+
"@ai-sdk/xai": "5.0.34",
|
|
59
59
|
"@edge-runtime/vm": "^5.0.0",
|
|
60
60
|
"@smithy/eventstream-codec": "^4.3.3",
|
|
61
61
|
"@smithy/util-utf8": "^4.3.3",
|