ai 7.0.146 → 7.0.148

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +3 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/internal/index.js +1 -1
  6. package/docs/02-foundations/01-overview.mdx +1 -1
  7. package/docs/02-foundations/02-providers-and-models.mdx +2 -2
  8. package/docs/02-foundations/03-prompts.mdx +3 -3
  9. package/docs/02-foundations/04-tools.mdx +2 -2
  10. package/docs/02-getting-started/00-choosing-a-provider.mdx +1 -1
  11. package/docs/02-getting-started/02-nextjs-app-router.mdx +4 -4
  12. package/docs/02-getting-started/03-nextjs-pages-router.mdx +4 -4
  13. package/docs/02-getting-started/04-svelte.mdx +3 -3
  14. package/docs/02-getting-started/05-nuxt.mdx +3 -3
  15. package/docs/02-getting-started/06-nodejs.mdx +2 -2
  16. package/docs/02-getting-started/07-expo.mdx +4 -4
  17. package/docs/02-getting-started/08-tanstack-start.mdx +4 -4
  18. package/docs/03-ai-sdk-core/10-generating-structured-data.mdx +1 -1
  19. package/docs/03-ai-sdk-core/18-tools.mdx +24 -5
  20. package/docs/03-ai-sdk-core/37-speech.mdx +1 -1
  21. package/docs/03-ai-sdk-core/41-skill-uploads.mdx +24 -10
  22. package/docs/03-ai-sdk-harnesses/02-harness-agent.mdx +33 -1
  23. package/docs/03-ai-sdk-harnesses/05-harness-adapters.mdx +5 -5
  24. package/docs/03-ai-sdk-harnesses/06-workflow-utilities.mdx +12 -0
  25. package/docs/03-ai-sdk-harnesses/07-ui.mdx +2 -2
  26. package/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +2 -2
  27. package/docs/05-ai-sdk-rsc/01-overview.mdx +1 -1
  28. package/docs/05-ai-sdk-rsc/10-migrating-to-ui.mdx +1 -1
  29. package/docs/06-advanced/01-prompt-engineering.mdx +1 -1
  30. package/docs/06-advanced/03-backpressure.mdx +1 -1
  31. package/docs/06-advanced/10-vercel-deployment-guide.mdx +1 -1
  32. package/docs/06-advanced/11-secure-url-fetching.mdx +2 -2
  33. package/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +1 -1
  34. package/docs/07-reference/01-ai-sdk-core/14-upload-skill.mdx +3 -3
  35. package/docs/07-reference/01-ai-sdk-core/22-dynamic-tool.mdx +1 -1
  36. package/docs/08-migration-guides/index.mdx +12 -12
  37. package/docs/09-troubleshooting/05-tool-invocation-missing-result.mdx +1 -1
  38. package/package.json +11 -11
  39. package/src/generate-text/output.ts +1 -1
  40. package/src/ui/process-ui-message-stream.ts +1 -0
@@ -111,7 +111,7 @@ function asAsyncIterableStream(stream) {
111
111
  }
112
112
  //#endregion
113
113
  //#region src/version.ts
114
- const VERSION = "7.0.146";
114
+ const VERSION = "7.0.148";
115
115
  //#endregion
116
116
  //#region src/util/download/download.ts
117
117
  /**
@@ -40,4 +40,4 @@ However, it's crucial to understand LLMs' limitations. When asked about less kno
40
40
 
41
41
  An **embedding model** is used to convert complex data (like words or images) into a dense vector (a list of numbers) representation, known as an embedding. Unlike generative models, embedding models do not generate new text or data. Instead, they provide representations of semantic and syntactic relationships between entities that can be used as input for other models or other natural language processing tasks.
42
42
 
43
- In the next section, you will learn about the difference between models providers and models, and which ones are available in the AI SDK.
43
+ In the next section, you will learn about the difference between model providers and models, and which ones are available in the AI SDK.
@@ -9,7 +9,7 @@ Companies such as OpenAI and Anthropic (providers) offer access to a range of la
9
9
 
10
10
  Each provider typically has its own unique method for interfacing with their models, complicating the process of switching providers and increasing the risk of vendor lock-in.
11
11
 
12
- To solve these challenges, AI SDK Core offers a standardized approach to interacting with LLMs through a [language model specification](https://github.com/vercel/ai/tree/main/packages/provider/src/language-model/v3) that abstracts differences between providers. This unified interface allows you to switch between providers with ease while using the same API for all providers.
12
+ To solve these challenges, AI SDK Core offers a standardized approach to interacting with LLMs through a [language model specification](https://github.com/vercel/ai/tree/main/packages/provider/src/language-model/v4) that abstracts differences between providers. This unified interface allows you to switch between providers with ease while using the same API for all providers.
13
13
 
14
14
  Here is an overview of the AI SDK Provider Architecture:
15
15
 
@@ -56,7 +56,7 @@ You can also use the [OpenAI Compatible provider](/providers/openai-compatible-p
56
56
  - [LM Studio](/providers/openai-compatible-providers/lmstudio)
57
57
  - [Heroku](/providers/openai-compatible-providers/heroku)
58
58
 
59
- Our [language model specification](https://github.com/vercel/ai/tree/main/packages/provider/src/language-model/v3) is published as an open-source package, which you can use to create [custom providers](/providers/community-providers/custom-providers).
59
+ Our [language model specification](https://github.com/vercel/ai/tree/main/packages/provider/src/language-model/v4) is published as an open-source package, which you can use to create [custom providers](/providers/community-providers/custom-providers).
60
60
 
61
61
  The open-source community has created the following providers:
62
62
 
@@ -58,7 +58,7 @@ System messages in `prompt` or `messages` are rejected by default; use the `inst
58
58
  const result = await generateText({
59
59
  model: __MODEL__,
60
60
  instructions:
61
- `You help planning travel itineraries. ` +
61
+ `You help plan travel itineraries. ` +
62
62
  `Respond to the users' request with a list ` +
63
63
  `of the best stops to make in their destination.`,
64
64
  prompt:
@@ -481,7 +481,7 @@ const result = await generateText({
481
481
  });
482
482
  ```
483
483
 
484
- ### Tool messages
484
+ ### Tool Messages
485
485
 
486
486
  <Note>
487
487
  [Tools](/docs/foundations/tools) (also known as function calling) are programs
@@ -616,7 +616,7 @@ const result = await generateText({
616
616
  model: __MODEL__,
617
617
  allowSystemInMessages: true,
618
618
  messages: [
619
- { role: 'system', content: 'You help planning travel itineraries.' },
619
+ { role: 'system', content: 'You help plan travel itineraries.' },
620
620
  {
621
621
  role: 'user',
622
622
  content:
@@ -34,7 +34,7 @@ A tool consists of three properties:
34
34
 
35
35
  If the LLM decides to use a tool, it will generate a tool call.
36
36
  Tools with an `execute` function are run automatically when these calls are generated.
37
- The output of the tool calls are returned using tool result objects.
37
+ The output of the tool calls is returned using tool result objects.
38
38
 
39
39
  You can automatically pass tool results back to the LLM
40
40
  using [multi-step calls](/docs/ai-sdk-core/tools-and-tool-calling#multi-step-calls-using-stopwhen) with `streamText` and `generateText`.
@@ -150,7 +150,7 @@ const result = await generateText({
150
150
 
151
151
  ## Schemas
152
152
 
153
- Schemas are used to define and validate the [tool input](/docs/ai-sdk-core/tools-and-tool-calling), tools outputs, and structured output generation.
153
+ Schemas are used to define and validate the [tool input](/docs/ai-sdk-core/tools-and-tool-calling), tool outputs, and structured output generation.
154
154
 
155
155
  The AI SDK supports the following schemas:
156
156
 
@@ -80,7 +80,7 @@ See [available providers](/providers/ai-sdk-providers) for setup instructions fo
80
80
 
81
81
  ## Custom Providers
82
82
 
83
- You can build your own provider to integrate any service with the AI SDK. The AI SDK provides a [Language Model Specification](https://github.com/vercel/ai/tree/main/packages/provider/src/language-model/v3) that ensures compatibility across providers.
83
+ You can build your own provider to integrate any service with the AI SDK. The AI SDK provides a [Language Model Specification](https://github.com/vercel/ai/tree/main/packages/provider/src/language-model/v4) that ensures compatibility across providers.
84
84
 
85
85
  ```ts
86
86
  import { generateText } from 'ai';
@@ -16,7 +16,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
16
16
  To follow this quickstart, you'll need:
17
17
 
18
18
  - Node.js 22+ and pnpm installed on your local development machine.
19
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
19
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
20
20
 
21
21
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
22
22
 
@@ -40,7 +40,7 @@ Navigate to the newly created directory:
40
40
 
41
41
  ### Install dependencies
42
42
 
43
- Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [ Vercel AI Gateway provider ](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
43
+ Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [Vercel AI Gateway provider](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
44
44
 
45
45
  <Note>
46
46
  This guide uses the Vercel AI Gateway provider so you can access hundreds of
@@ -109,7 +109,7 @@ This Route Handler creates a POST request endpoint at `/api/chat`.
109
109
 
110
110
  ## Choosing a Provider
111
111
 
112
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
112
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
113
113
 
114
114
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
115
115
 
@@ -149,7 +149,7 @@ Pick the approach that best matches how you want to manage providers across your
149
149
 
150
150
  ## Wire up the UI
151
151
 
152
- Now that you have a Route Handler that can query an LLM, it's time to setup your frontend. The AI SDK's [ UI ](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
152
+ Now that you have a Route Handler that can query an LLM, it's time to set up your frontend. The AI SDK's [UI](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
153
153
 
154
154
  Update your root page (`app/page.tsx`) with the following code to show a list of chat messages and provide a user message input:
155
155
 
@@ -16,7 +16,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
16
16
  To follow this quickstart, you'll need:
17
17
 
18
18
  - Node.js 22+ and pnpm installed on your local development machine.
19
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
19
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
20
20
 
21
21
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
22
22
 
@@ -38,7 +38,7 @@ Navigate to the newly created directory:
38
38
 
39
39
  ### Install dependencies
40
40
 
41
- Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [ Vercel AI Gateway provider ](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
41
+ Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [Vercel AI Gateway provider](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
42
42
 
43
43
  <Note>
44
44
  This guide uses the Vercel AI Gateway provider so you can access hundreds of
@@ -113,7 +113,7 @@ This Route Handler creates a POST request endpoint at `/api/chat`.
113
113
 
114
114
  ## Choosing a Provider
115
115
 
116
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
116
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
117
117
 
118
118
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
119
119
 
@@ -153,7 +153,7 @@ Pick the approach that best matches how you want to manage providers across your
153
153
 
154
154
  ## Wire up the UI
155
155
 
156
- Now that you have an API route that can query an LLM, it's time to set up your frontend. The AI SDK's [ UI ](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
156
+ Now that you have an API route that can query an LLM, it's time to set up your frontend. The AI SDK's [UI](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
157
157
 
158
158
  Update your root page (`pages/index.tsx`) with the following code to show a list of chat messages and provide a user message input:
159
159
 
@@ -16,7 +16,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
16
16
  To follow this quickstart, you'll need:
17
17
 
18
18
  - Node.js 22+ and pnpm installed on your local development machine.
19
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
19
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
20
20
 
21
21
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
22
22
 
@@ -32,7 +32,7 @@ Navigate to the newly created directory:
32
32
 
33
33
  ### Install Dependencies
34
34
 
35
- Install `ai` and `@ai-sdk/svelte`, the AI package and AI SDK's Svelte bindings. The AI SDK's [ Vercel AI Gateway provider ](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
35
+ Install `ai` and `@ai-sdk/svelte`, the AI package and AI SDK's Svelte bindings. The AI SDK's [Vercel AI Gateway provider](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
36
36
 
37
37
  <Note>
38
38
  This guide uses the Vercel AI Gateway provider so you can access hundreds of
@@ -112,7 +112,7 @@ Let's take a look at what is happening in this code:
112
112
 
113
113
  ## Choosing a Provider
114
114
 
115
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
115
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
116
116
 
117
117
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
118
118
 
@@ -16,7 +16,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
16
16
  To follow this quickstart, you'll need:
17
17
 
18
18
  - Node.js 22+ and pnpm installed on your local development machine.
19
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
19
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
20
20
 
21
21
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
22
22
 
@@ -120,7 +120,7 @@ Let's take a look at what is happening in this code:
120
120
 
121
121
  ## Choosing a Provider
122
122
 
123
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
123
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
124
124
 
125
125
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
126
126
 
@@ -154,7 +154,7 @@ model: openai('gpt-6-astra');
154
154
 
155
155
  ## Wire up the UI
156
156
 
157
- Now that you have an API route that can query an LLM, it's time to set up your frontend. The AI SDK's [ UI ](/docs/ai-sdk-ui/overview) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
157
+ Now that you have an API route that can query an LLM, it's time to set up your frontend. The AI SDK's [UI](/docs/ai-sdk-ui/overview) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
158
158
 
159
159
  Update your root page (`pages/index.vue`) with the following code to show a list of chat messages and provide a user message input:
160
160
 
@@ -16,7 +16,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
16
16
  To follow this quickstart, you'll need:
17
17
 
18
18
  - Node.js 22+ and pnpm installed on your local development machine.
19
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
19
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
20
20
 
21
21
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
22
22
 
@@ -133,7 +133,7 @@ You should see a prompt in your terminal. Test it out by entering a message and
133
133
 
134
134
  ## Choosing a Provider
135
135
 
136
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
136
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
137
137
 
138
138
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
139
139
 
@@ -14,7 +14,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
14
14
  To follow this quickstart, you'll need:
15
15
 
16
16
  - Node.js 22+ and pnpm installed on your local development machine.
17
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
17
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
18
18
 
19
19
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
20
20
 
@@ -32,7 +32,7 @@ Navigate to the newly created directory:
32
32
 
33
33
  ### Install dependencies
34
34
 
35
- Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [ Vercel AI Gateway provider ](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
35
+ Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [Vercel AI Gateway provider](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
36
36
 
37
37
  <Note>
38
38
  This guide uses the Vercel AI Gateway provider so you can access hundreds of
@@ -112,7 +112,7 @@ This API route creates a POST request endpoint at `/api/chat`.
112
112
 
113
113
  ## Choosing a Provider
114
114
 
115
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
115
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
116
116
 
117
117
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
118
118
 
@@ -152,7 +152,7 @@ Pick the approach that best matches how you want to manage providers across your
152
152
 
153
153
  ## Wire up the UI
154
154
 
155
- Now that you have an API route that can query an LLM, it's time to setup your frontend. The AI SDK's [ UI ](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
155
+ Now that you have an API route that can query an LLM, it's time to set up your frontend. The AI SDK's [UI](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
156
156
 
157
157
  Update your root page (`app/(tabs)/index.tsx`) with the following code to show a list of chat messages and provide a user message input:
158
158
 
@@ -16,7 +16,7 @@ If you are unfamiliar with the concepts of [Prompt Engineering](/docs/advanced/p
16
16
  To follow this quickstart, you'll need:
17
17
 
18
18
  - Node.js 22+ and pnpm installed on your local development machine.
19
- - A [ Vercel AI Gateway ](https://vercel.com/ai-gateway) API key.
19
+ - A [Vercel AI Gateway](https://vercel.com/ai-gateway) API key.
20
20
 
21
21
  If you haven't obtained your Vercel AI Gateway API key, you can do so by [signing up](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai&title=Go+to+AI+Gateway) on the Vercel website.
22
22
 
@@ -32,7 +32,7 @@ Navigate to the newly created directory:
32
32
 
33
33
  ### Install dependencies
34
34
 
35
- Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [ Vercel AI Gateway provider ](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
35
+ Install `ai` and `@ai-sdk/react`, the AI package and AI SDK's React hooks. The AI SDK's [Vercel AI Gateway provider](/providers/ai-sdk-providers/ai-gateway) ships with the `ai` package. You'll also install `zod`, a schema validation library used for defining tool inputs.
36
36
 
37
37
  <Note>
38
38
  This guide uses the Vercel AI Gateway provider so you can access hundreds of
@@ -108,7 +108,7 @@ This Route Handler creates a POST request endpoint at `/api/chat`.
108
108
 
109
109
  ## Choosing a Provider
110
110
 
111
- The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [ community ](/providers/community-providers) packages.
111
+ The AI SDK supports dozens of model providers through [first-party](/providers/ai-sdk-providers), [OpenAI-compatible](/providers/openai-compatible-providers), and [community](/providers/community-providers) packages.
112
112
 
113
113
  This quickstart uses the [Vercel AI Gateway](https://vercel.com/ai-gateway) provider, which is the default [global provider](/docs/ai-sdk-core/provider-management#global-provider-configuration). This means you can access models using a simple string in the model configuration:
114
114
 
@@ -148,7 +148,7 @@ Pick the approach that best matches how you want to manage providers across your
148
148
 
149
149
  ## Wire up the UI
150
150
 
151
- Now that you have a Route Handler that can query an LLM, it's time to setup your frontend. The AI SDK's [ UI ](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
151
+ Now that you have a Route Handler that can query an LLM, it's time to set up your frontend. The AI SDK's [UI](/docs/ai-sdk-ui) package abstracts the complexity of a chat interface into one hook, [`useChat`](/docs/reference/ai-sdk-ui/use-chat).
152
152
 
153
153
  Update your index route (`src/routes/index.tsx`) with the following code to show a list of chat messages and provide a user message input:
154
154
 
@@ -11,7 +11,7 @@ For example, you might want to extract information from text, classify data, or
11
11
  Many language models are capable of generating structured data, often defined as using "JSON modes" or "tools".
12
12
  However, you need to manually provide schemas and then validate the generated data as LLMs can produce incorrect or incomplete structured data.
13
13
 
14
- The AI SDK standardises structured object generation across model providers
14
+ The AI SDK standardizes structured object generation across model providers
15
15
  using the `output` property on [`generateText`](/docs/reference/ai-sdk-core/generate-text)
16
16
  and [`streamText`](/docs/reference/ai-sdk-core/stream-text).
17
17
  You can use [Zod schemas](/docs/reference/ai-sdk-core/zod-schema), [Valibot](/docs/reference/ai-sdk-core/valibot-schema), or [JSON schemas](/docs/reference/ai-sdk-core/json-schema) to specify the shape of the data that you want,
@@ -17,7 +17,7 @@ For defining your own tools and configuring tool execution, see
17
17
 
18
18
  ## Bash Tool
19
19
 
20
- `createBashTool` lets agents run Bash commands to search, analyze, and transform files.
20
+ `experimental_createBashTool` lets agents run Bash commands to search, analyze, and transform files.
21
21
  Supply an `Experimental_SandboxSession` to choose where commands run. Use
22
22
  `@ai-sdk/sandbox-just-bash` for an in-memory environment,
23
23
  `@ai-sdk/sandbox-vercel` for Vercel Sandbox, or your own implementation.
@@ -38,7 +38,7 @@ Requires Node.js 22.13 or newer.
38
38
 
39
39
  ```ts
40
40
  import { createJustBashNetworkSandboxSession } from '@ai-sdk/sandbox-just-bash';
41
- import { createBashTool } from '@ai-sdk/tool-bash';
41
+ import { experimental_createBashTool as createBashTool } from '@ai-sdk/tool-bash';
42
42
  import { generateText, isStepCount } from 'ai';
43
43
 
44
44
  const session = await createJustBashNetworkSandboxSession();
@@ -72,7 +72,7 @@ Vercel Sandbox. Wrap it with the adapter before passing it to the tool:
72
72
 
73
73
  ```ts
74
74
  import { createVercelSandboxSessionFromNativeSandbox } from '@ai-sdk/sandbox-vercel';
75
- import { createBashTool } from '@ai-sdk/tool-bash';
75
+ import { experimental_createBashTool as createBashTool } from '@ai-sdk/tool-bash';
76
76
  import { Sandbox } from '@vercel/sandbox';
77
77
 
78
78
  const nativeSandbox = await Sandbox.create();
@@ -100,13 +100,14 @@ Raw runtime instances need their respective adapters; a custom
100
100
 
101
101
  ### Options
102
102
 
103
- `createBashTool()` requires an options object:
103
+ `experimental_createBashTool()` requires an options object:
104
104
 
105
105
  | Option | Type | Description |
106
106
  | ------------------ | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
107
107
  | `sandbox` | `Experimental_SandboxSession` | Required session for command execution and file operations. |
108
108
  | `workingDirectory` | `string` | Optional absolute starting directory for each command, created if needed. When omitted, uses the sandbox's default directory. |
109
109
  | `maxOutputLength` | `number` | Positive integer limiting characters retained from each output stream before a truncation notice. Defaults to `30000`. |
110
+ | `timeout` | `number` | Optional timeout per command execution, in milliseconds (integer from `1` to `2147483647`). No tool-level timeout by default. |
110
111
 
111
112
  The model calls the tool with `{ command: string }` and receives
112
113
  `{ stdout, stderr, exitCode }`. Nonzero exit codes are returned so the model can
@@ -114,6 +115,24 @@ inspect failures and recover. AI SDK cancellation is forwarded to the session.
114
115
  Output truncation happens after execution and does not limit execution memory or
115
116
  duration.
116
117
 
118
+ ### Command timeout
119
+
120
+ Set `timeout` to cancel commands that run longer than the configured duration:
121
+
122
+ ```ts
123
+ const bash = await createBashTool({
124
+ sandbox,
125
+ timeout: 10_000,
126
+ });
127
+ ```
128
+
129
+ Each command gets a fresh timeout starting when its execution begins. This does
130
+ not include tool initialization or time waiting for model output or approval.
131
+ The timeout is combined with the caller's abort signal; either can cancel the
132
+ command. The sandbox must honor cancellation. Its result or error is passed
133
+ through; for example, just-bash returns exit code `124` when a running command is
134
+ cancelled. SDK and sandbox timeouts still apply when this option is omitted.
135
+
117
136
  ### Files and lifecycle
118
137
 
119
138
  Commands use the sandbox's default working directory unless `workingDirectory`
@@ -129,7 +148,7 @@ Tools using the same session share files. Creating a tool does not reset existin
129
148
  files or create a new sandbox. Use separate sessions for independent workflows.
130
149
  The caller creates, reconnects, and destroys the sandbox.
131
150
 
132
- `createBashTool()` returns the tool directly, ready to use as `tools: { bash }`.
151
+ `experimental_createBashTool()` returns the tool directly, ready to use as `tools: { bash }`.
133
152
  Use the supplied sandbox's `readTextFile({ path })` to read generated text files;
134
153
  it returns `null` if the file is missing. Relative read paths depend on the
135
154
  sandbox adapter; just-bash resolves them against its default directory. With an
@@ -50,7 +50,7 @@ const audioBase64 = result.audio.base64; // audio data as base64 string
50
50
 
51
51
  ## Settings
52
52
 
53
- ### Provider-Specific settings
53
+ ### Provider-Specific Settings
54
54
 
55
55
  You can set model-specific settings with the `providerOptions` parameter.
56
56
 
@@ -14,7 +14,7 @@ that providers can load, e.g. in sandboxed container environments.
14
14
 
15
15
  In the AI SDK, the uploaded skill is identified by a `ProviderReference` — a
16
16
  `Record<string, string>` mapping provider names to provider-specific identifiers.
17
- This concept is used for other provider specific asset references too, such as
17
+ This concept is used for other provider-specific asset references too, such as
18
18
  uploaded media files.
19
19
 
20
20
  ```ts
@@ -30,7 +30,7 @@ const { providerReference } = await uploadSkill({
30
30
  files: [
31
31
  {
32
32
  path: 'my-skill/SKILL.md',
33
- content: readFileSync('./SKILL.md'),
33
+ data: readFileSync('./SKILL.md'),
34
34
  },
35
35
  ],
36
36
  displayTitle: 'My Skill',
@@ -57,16 +57,16 @@ As a shorthand, you can pass a provider instance directly to `api` instead of ca
57
57
  ```ts highlight="2"
58
58
  const { providerReference } = await uploadSkill({
59
59
  api: anthropic, // shorthand for anthropic.skills()
60
- files: [{ path: 'my-skill/SKILL.md', content: readFileSync('./SKILL.md') }],
60
+ files: [{ path: 'my-skill/SKILL.md', data: readFileSync('./SKILL.md') }],
61
61
  displayTitle: 'My Skill',
62
62
  });
63
63
  ```
64
64
 
65
65
  ## Skill Files
66
66
 
67
- A skill is composed of one or more files, each with a relative `path` and `content`.
68
- File content can be provided as a `Uint8Array` (e.g. from `fs.readFileSync`) or as a
69
- base64-encoded string:
67
+ A skill is composed of one or more files, each with a relative `path` and `data`.
68
+
69
+ File content can be provided as a `Uint8Array` (for example, from `fs.readFileSync`) or as a base64-encoded string. Alternatively, `data` can be provided as a tagged object with either `type: 'text'` or `type: 'data'` to explicitly specify the content format:
70
70
 
71
71
  ```ts
72
72
  const { providerReference } = await uploadSkill({
@@ -74,11 +74,25 @@ const { providerReference } = await uploadSkill({
74
74
  files: [
75
75
  {
76
76
  path: 'my-skill/SKILL.md',
77
- content: readFileSync('./SKILL.md'), // Uint8Array
77
+ data: readFileSync('./SKILL.md'), // Uint8Array
78
78
  },
79
79
  {
80
80
  path: 'my-skill/helper.py',
81
- content: readFileSync('./helper.py'),
81
+ data: readFileSync('./helper.py'),
82
+ },
83
+ {
84
+ path: 'my-skill/data.json',
85
+ data: {
86
+ type: 'data',
87
+ data: Buffer.from(JSON.stringify({ foo: 'bar' })).toString('base64'),
88
+ },
89
+ },
90
+ {
91
+ path: 'my-skill/README.txt',
92
+ data: {
93
+ type: 'text',
94
+ text: 'This is a skill for demonstrating skill uploads.',
95
+ },
82
96
  },
83
97
  ],
84
98
  });
@@ -123,11 +137,11 @@ merge the references:
123
137
  const [openaiUpload, anthropicUpload] = await Promise.all([
124
138
  uploadSkill({
125
139
  api: openai.skills(),
126
- files: [{ path: 'my-skill/SKILL.md', content: skillSource }],
140
+ files: [{ path: 'my-skill/SKILL.md', data: skillSource }],
127
141
  }),
128
142
  uploadSkill({
129
143
  api: anthropic.skills(),
130
- files: [{ path: 'my-skill/SKILL.md', content: skillSource }],
144
+ files: [{ path: 'my-skill/SKILL.md', data: skillSource }],
131
145
  displayTitle: 'My Skill',
132
146
  }),
133
147
  ]);
@@ -15,7 +15,7 @@ Install the core harness package, a harness adapter, and a sandbox adapter:
15
15
 
16
16
  <InstallPackages packages="@ai-sdk/harness @ai-sdk/harness-claude-code @ai-sdk/sandbox-vercel" />
17
17
 
18
- Bridge-backed harnesses such as Claude Code and Codex require using real network sandbox
18
+ Bridge-backed harnesses such as Claude Code and Codex require using a real network sandbox
19
19
  like `@ai-sdk/sandbox-vercel`. Host-runtime harnesses such as Pi can also run with
20
20
  `@ai-sdk/sandbox-just-bash` because they do not need a sandbox-exposed port.
21
21
 
@@ -106,6 +106,38 @@ try {
106
106
  }
107
107
  ```
108
108
 
109
+ ### Image Inputs
110
+
111
+ For harness adapters that support images, you can include an image as a file part
112
+ in the latest user message. Set `mediaType` to the image's MIME type:
113
+
114
+ ```ts
115
+ import { readFileSync } from 'node:fs';
116
+
117
+ const result = await agent.generate({
118
+ session,
119
+ messages: [
120
+ {
121
+ role: 'user',
122
+ content: [
123
+ {
124
+ type: 'text',
125
+ text: 'Describe the image in one sentence.',
126
+ },
127
+ {
128
+ type: 'file',
129
+ mediaType: 'image/png',
130
+ data: readFileSync('image.png'),
131
+ },
132
+ ],
133
+ },
134
+ ],
135
+ });
136
+ ```
137
+
138
+ For image input support, see the
139
+ [adapter capability table](/docs/ai-sdk-harnesses/harness-adapters#adapter-capabilities).
140
+
109
141
  ## Lifecycle Callbacks
110
142
 
111
143
  Configure lifecycle callbacks on `HarnessAgent` to observe agent calls, model
@@ -38,10 +38,10 @@ The AI SDK includes the following harness adapters:
38
38
  | [Claude Code](/providers/ai-sdk-harnesses/claude-code) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
39
39
  | [Cline](/providers/ai-sdk-harnesses/cline) | Host process | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
40
40
  | [Codex](/providers/ai-sdk-harnesses/codex) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> | <Check /> | <Cross /> |
41
- | [Cursor](/providers/ai-sdk-harnesses/cursor) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Cross /> | <Cross /> | <Cross /> | <Cross /> |
42
- | [Deep Agents](/providers/ai-sdk-harnesses/deepagents) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection | <Cross /> | <Cross /> |
41
+ | [Cursor](/providers/ai-sdk-harnesses/cursor) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Cross /> | <Cross /> | <Check /> | <Cross /> |
42
+ | [Deep Agents](/providers/ai-sdk-harnesses/deepagents) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection | <Check /> | <Cross /> |
43
43
  | [fx](/providers/ai-sdk-harnesses/fx) | Host process | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> |
44
- | [GitHub Copilot](/providers/ai-sdk-harnesses/github-copilot) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Cross /> | <Cross /> | <Cross /> | <Cross /> |
45
- | [Grok Build](/providers/ai-sdk-harnesses/grok-build) | Sandbox via ACP | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> | <Cross /> | <Cross /> |
46
- | [OpenCode](/providers/ai-sdk-harnesses/opencode) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> |
44
+ | [GitHub Copilot](/providers/ai-sdk-harnesses/github-copilot) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Cross /> | <Cross /> | <Check /> | <Cross /> |
45
+ | [Grok Build](/providers/ai-sdk-harnesses/grok-build) | Sandbox via ACP | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> | <Check /> | <Cross /> |
46
+ | [OpenCode](/providers/ai-sdk-harnesses/opencode) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
47
47
  | [Pi](/providers/ai-sdk-harnesses/pi) | Host process | <Check /> | <Check /> | <Cross /> | <Check /> | <Check /> | <Check /> | <Cross /> |
@@ -308,6 +308,18 @@ export async function POST(request: Request) {
308
308
  }
309
309
  ```
310
310
 
311
+ If you use Next.js, wrap your config with `withWorkflow()` so the Workflow SDK
312
+ transforms `'use workflow'` and `'use step'` modules. Other frameworks have
313
+ their own Workflow SDK setup.
314
+
315
+ ```js filename='next.config.js'
316
+ import { withWorkflow } from 'workflow/next';
317
+
318
+ const nextConfig = {};
319
+
320
+ export default withWorkflow(nextConfig);
321
+ ```
322
+
311
323
  The workflow state `sessionId` identifies the harness session. The step derives
312
324
  `sandboxId` from it; otherwise, you must persist `sandboxSession.id` separately
313
325
  to reattach across steps. Keep
@@ -93,7 +93,7 @@ export const agent = new HarnessAgent({
93
93
 
94
94
  Persist the opaque resume state returned by `session.detach()`. If the
95
95
  turn paused for approval or was otherwise interrupted, that resume state carries
96
- the continuation state internally. The chat id can also be the harness
96
+ the continuation state internally. The chat ID can also be the harness
97
97
  `sessionId`. Here we derive a stable `sandboxId` from that known chat id. If
98
98
  you do not derive one, persist the returned `sandboxSession.id` separately.
99
99
 
@@ -170,7 +170,7 @@ export async function POST(request: Request) {
170
170
  } = await request.json();
171
171
 
172
172
  if (!body.id) {
173
- throw new Error('Missing chat id');
173
+ return new Response('Missing chat ID', { status: 400 });
174
174
  }
175
175
 
176
176
  const chatId = body.id;
@@ -16,12 +16,12 @@ The flow is as follows:
16
16
 
17
17
  1. The user enters a message in the chat UI.
18
18
  1. The message is sent to the API route.
19
- 1. In your server side route, the language model generates tool calls during the `streamText` call.
19
+ 1. In your server-side route, the language model generates tool calls during the `streamText` call.
20
20
  1. All tool calls are forwarded to the client.
21
21
  1. Server-side tools are executed using their `execute` method and their results are forwarded to the client.
22
22
  1. Client-side tools that should be automatically executed are handled with the `onToolCall` callback.
23
23
  You must call `addToolOutput` to provide the tool result.
24
- 1. Client-side tool that require user interactions can be displayed in the UI.
24
+ 1. Client-side tools that require user interactions can be displayed in the UI.
25
25
  The tool calls and results are available as tool invocation parts in the `parts` property of the last assistant message.
26
26
  1. When the user interaction is done, `addToolOutput` can be used to add the tool result to the chat.
27
27
  1. The chat can be configured to automatically submit when all tool results are available using `sendAutomaticallyWhen`.