AI SDK 7.1 for TypeScript agents: what to adopt first

Which AI SDK 7.1 features belong in your agent? Start with tool ordering and steering, check your 7.0 patch, then choose batch, audio or durable execution.

Published

AI SDK 7.1 for TypeScript agents: what to adopt first

If your TypeScript agent can update a file and read it back, start with tool-call ordering. If a user can correct the agent while it works, add steering next. Vercel’s AI SDK 7.1.0 release on December 3, 2026 gives a TypeScript app control over when a tool runs, when a correction takes effect and which jobs can finish after the request ends. Vercel’s release notes

What changes on the way from 7.0?

Check the exact version in your lockfile. The 7.1.0 notes collect features that landed across the 7.0 series. A team upgrading from 7.0.189 has a different migration from one still on an early 7.0 patch. Vercel labels 7.1.0 a minor release. As of December 2026, these are the changes I would check against an existing application. Tagged package changelog

Where to lookWhat movedWhat to check in your app
Early decision experimentsIn 7.0.128 Vercel renamed evaluate to decide.Use the current experimental_decide import before porting an early example.
Stored or incoming messagesFrom 7.0.155, core text and object calls skip runtime checks that TypeScript types already cover, including checking messages against the ModelMessage schema.Validate message JSON where it enters your app. A type assertion on database or request data cannot validate it.
Live audio importsIn 7.0.187, experimental_streamTranscribe became streamTranscription and experimental_streamTranslate became streamSpeechTranslation. The old names remain deprecated aliases.Update imports as you touch those paths. The translation provider shortcut is now speechTranslation().
Chat regenerationIn 7.1.0 a regenerate action sets chat status to submitted synchronously.Check any retry button or status test that reads state immediately after regenerating.

Adopt first for a small team

First, order dependent tool calls. Imagine a user asking an agent to update a file and then read it back. The model can ask for both operations in the same step. By default the SDK can execute them concurrently, so a successful read could still see the old file. On the call that needs ordering, use the setting from Vercel’s example. Here tools is the app’s configured tool set. Tool-call concurrency

TypeScript
const result = await generateText({
  model: "anthropic/claude-sonnet-5.5",
  tools,
  prompt: 'Update the file, then read it.',
  toolCallConcurrency: 1,
});
What happens when the model asks to write and then read
Generation call

prompt: 'Update the file, then read it.'

toolCallConcurrency: 1

SDK execution

Start SDK-executed calls in the order the model generated them.

Finish the write before starting the read.

This is my first pick because you can apply it to one known dependency and check the returned file contents. The limit governs calls the SDK executes locally. Provider-executed and client-side tools keep their own scheduling. Independent lookups can keep their existing concurrency. If the model requested the operations in the wrong order, serialization alone will preserve that mistake.

Second, let a user correct a running loop. In Vercel’s weather example, the user meant Paris, Texas. A correction belongs in the run that is already looking up the weather. A request to do another job belongs after the current task. The experimental steering object exposes both choices on generateText, streamText and ToolLoopAgent. A durable WorkflowAgent has a different interface and does not take experimental_steering. Loop control and steering

TypeScript
const steering = experimental_createSteering();
const run = agent.generate({
  prompt: 'What is the weather in Paris?',
  experimental_steering: steering,
});

await steering.steer('I meant Paris, Texas.');
const result = await run;
When a correction or a follow-up reaches the model
Application call

steering.steer('I meant Paris, Texas.')

steering.queue('Then add tests for it.')

Delivery point

Next step boundary, after the current tool calls finish.

After the current task finishes, if the loop can continue.

This is my second pick for an interactive agent because users can recover from a mistaken instruction without starting the task over. Check the delivery outcome before showing a correction as applied. A stop condition can end the loop first, and prepareStep can remove the message. A running tool completes even if the user corrects its input. When saving a chat, include each step’s experimental_steeringMessages in order with its response messages. Saving only the final response can lose the correction.

A correction can arrive while a tool is still workingWhere a steering message enters a multi-step run
Delivery
User corrects the requestThe app calls steer().
Current tool finishesIts work can already have side effects.
Next step takes the messageCheck the delivery outcome.

As of Dec 5, 2026 · Source: Vercel AI SDK, Loop Control

When another runtime should own the coding session

A model provider answers a model call. A harness adapter connects your app to a whole agent runtime with its own tools, permissions and session state. The release names Cline, Cursor, fx, GitHub Copilot and Grok Build. The Codex adapter now talks to its app server and supports mid-turn steering. The harness packages are experimental. Runtime placement matters when choosing one. For example, fx runs on the host while its built-in shell and filesystem tools work in the sandbox. Cursor, GitHub Copilot and Grok Build use a sandbox via ACP. Harness adapter comparison

How the fx example opens and closes a coding session
Application

new HarnessAgent({ harness: fx, model: 'openai/gpt-5.6-luna' })

await agent.createSession({ sandboxSession })

await session.destroy()

await sandboxSession.destroy()

Session lifecycle

await agent.getSandboxTemplate()

await agent.stream({ session, prompt: 'Check the test failures and fix the production code.' })

In that example the app imports HarnessAgent from @ai-sdk/harness/agent and fx from @ai-sdk/harness-fx. It passes the template to createVercelNetworkSandboxSession, reads text-delta events from the result and releases both sessions in a finally block. Pick a harness when you want that runtime’s session behavior. If an existing tool loop only needs shell or web access, Vercel ships createBashTool() and createWebFetchTool() separately. Bash uses the session passed as experimental_sandbox. Vercel’s fx example · First-party tools

For the deployment decision, see the fx adapter walkthrough, the ACP adapter guide and the Grok Build adapter walkthrough.

When the app needs a decision it can act on

For a support queue, the return value you need might be a department name drawn from a fixed set. With experimental_decide, you submit shared state and named questions. A choice returns a typed option key. A score uses ordered levels. A boolean gives the estimated probability of true. A box returns normalized edges for an image region on a supporting model. State can hold text, JSON or ordered multimodal parts. Both the API and its model specification are experimental and may change in a patch. Typed decisions

How a duplicate-charge message becomes a typed choice
Decision request

state: 'I was charged twice.'

instructions: 'Which team should handle this?'

criteria: { billing: 'Charges and refunds', support: 'Other requests' }

Application reads

result.answers.department.choice

TypeScript permits 'billing' or 'support'.

With the registry configured as in Vercel’s example, the call and its return type fit together like this.

TypeScript
const result = await experimental_decide({
  model: registry.decisionModel('triage:native'),
  state: 'I was charged twice.',
  questions: {
    department: {
      type: 'choice',
      instructions: 'Which team should handle this?',
      criteria: { billing: 'Charges and refunds', support: 'Other requests' },
    },
  },
});

result.answers.department.choice; // 'billing' | 'support'

The union tells you which values your router must handle. It says nothing about whether the model picked the right queue. Native providers can return a distribution for choices and scores. The documented Anthropic adapter uses structured output and omits those distributions. For a refund request, try the routing rule on tickets with known labels before choosing a cutoff. Keep an explicit review path for ambiguous cases.

When requests can wait for a background job

An overnight ticket-classification job can give every ticket its own request ID, submit the group and exit. The experimental batch API accepts independent text or image requests on supporting providers. Text requests can carry tool definitions and, where supported, different model IDs within one batch. The app still executes client tools. Choose batches when the user can come back for a result and you can store a reference. Batch processing

How a worker reconnects to an Anthropic text batch
Submit and save

import { experimental_startBatch as startBatch } from 'ai'

const batch = await startBatch({ provider, requests })

console.log(batch.id, batch.status)

Check and collect

await getBatchStatus({ provider: anthropic, batch })

for await (const item of getBatchResults({ provider: anthropic, batch }))

Here provider is anthropic, and getBatchStatus and getBatchResults alias the corresponding experimental_ exports. Each request includes an ID, a type, a model and a prompt or messages. Persist the serializable batch reference. When the status reaches completed, iterate through the items, check each status and join successes to inputs by ID. Results can arrive out of order, and completion of the batch says nothing about the success of an individual ticket. Check provider support before building a cancel button, a jobs listing or a completion webhook.

When a voice interface needs live audio

Choose the interface from the direction the audio travels. A listener hearing an agent read a story needs speech synthesis. A call taker reading captions needs transcription. An interpreter needs translated audio and text. A conversation with a live model needs a session that can receive and send events throughout the call.

JobDocumented entry pointStatus in this release
Speak generated textSend a streamText text stream to experimental_streamSpeech. Read result.audioStream.Experimental. Some providers consume all input text before synthesis.
Caption live inputGive streamTranscription raw audio and its matching inputAudioFormat. Consume result.fullStream for updates.Stable function. For a recorded file, transcribe accepts timestampGranularities and returns word timings in words where supported.
Interpret live speechGive streamSpeechTranslation audio, its format and a targetLanguage.Stable function. Language support depends on the provider.
Hold a continuous conversationUse experimental_useRealtime with OpenAI Live and a supported transport.Experimental. Choose who owns the connection and the credentials.
How a generated story reaches the speaker
Text generation

const { textStream } = streamText({ model: 'openai/gpt-5-mini', prompt: 'Tell me a short story.' })

Streaming speech

model: elevenLabs.speech('eleven_flash_v2_5')

text: textStream

for await (const chunk of result.audioStream)

The right column shows the model and text arguments to experimental_streamSpeech, imported as streamSpeech in Vercel’s example. For captions, the documented streamTranscription call uses the following input. Here audioStream carries raw PCM at the specified sample rate.

TypeScript
const result = streamTranscription({
  model: openai.transcription('gpt-realtime-whisper'),
  audio: audioStream,
  inputAudioFormat: { type: 'audio/pcm', rate: 24000 },
  providerOptions: {
    openai: { language: 'en', streaming: { delay: 'low' } },
  },
});

A transcript UI can update on transcript-partial and commit on transcript-final. For translation, Vercel’s OpenAI example uses the following call with raw PCM input. Read the single-consumer fullStream before awaiting the final translation if you need both. Streaming speech · Transcription · Translation

TypeScript
const result = streamSpeechTranslation({
  model: openai.speechTranslation('gpt-realtime-translate'),
  audio: audioStream,
  inputAudioFormat: { type: 'audio/pcm', rate: 24000 },
  targetLanguage: 'es',
});
How a continuous OpenAI Live session connects
Browser setup

const model = openai.experimental_realtime('gpt-live-1')

api: { websocket: 'wss://your-app.example/live' }

Session action

<button onClick={realtime.connect}>Connect microphone</button>

<button onClick={() => realtime.close()}>End conversation</button>

The relay in the hook example authenticates the browser and keeps provider credentials on the server. OpenAI Live also supports browser WebRTC through api.session. For a server-owned WebSocket, the app owns the connection lifetime and reconnect policy. Providers can also supply a managed transport. For a text chat that simply needs a persistent connection, new WebSocketChatTransport({ url: '/api/chat' }) works with useChat and supports cancellation and sequence-based resume. Vercel documents that transport without an experimental label. Realtime sessions · Continuous conversation example · Chat transport

When tool results are larger than the answer

An inventory assistant might need availability and demand for the same product. The person asking needs the comparison. With experimental code mode, the model can write JavaScript or TypeScript that calls both tools and returns a small JSON result. The program runs inside QuickJS. The package requires Node.js 22 or newer and does not run in a browser or edge runtime. Its TypeScript support strips types. Code mode

How the inventory example limits what generated code can call
Application configuration

code_mode: codeModeTool({ executionPolicy: { timeoutMs: 30_000 } })

experimental_toolCallers: { getInventory: ['code_mode'], getDemand: ['code_mode'] }

Tool available inside the program

await tools.getInventory({ productId: 'sku_123' })

inventory.availableUnits > 0

The app imports experimental_codeModeTool as codeModeTool from @ai-sdk/code-mode. The keys in experimental_toolCallers name the governed tools. Each value lists who may call that tool. In this example only the code-mode tool can call the inventory and demand tools. Keep actions that require user approval directly callable. A nested call inside the generated program cannot pause to collect approval.

For a concrete tool catalog, see the Vercel MCP and AI Gateway tools guide.

If finding the right tool is the problem, start with toolSearch(), which Vercel documents without an experimental label. Register a tool with deferLoading: true, add search: toolSearch() to the tool set and allow another model step. Matches become available on that next step. With code mode, toolDiscovery: 'conversation' sends discovered definitions in messages so the provider-visible tool definition stays unchanged. Actual prompt-cache reuse depends on the provider. Tool search

When video generation outlives the request

A product team rendering a clip can acknowledge submission immediately and let a worker fetch the finished video later. The experimental start call returns an opaque, JSON-serializable operation. Save the entire value. The status call takes the model as its first argument and an options object containing that operation as its second. It performs one check. Vercel’s tagged MiniMax example

How the MiniMax example resumes a video job in another process
Start invocation

const model = minimax.video('MiniMax-H3')

experimental_startVideo as startVideo

console.log(JSON.stringify(operation))

Later status invocation

await parseJSON({ text: serializedOperation })

await getVideoStatus(model, { operation, maxRetries: 0 })

The example aliases experimental_startVideo and experimental_getVideoStatus from ai. A pending operation needs a later check. The start invocation in Vercel’s example looks like this.

TypeScript
const { operation, warnings } = await startVideo({
  model,
  prompt: 'A white kitten chases a butterfly across a sunlit garden.',
  aspectRatio: '16:9',
  duration: 5,
  maxRetries: 0,
  providerOptions: { minimax: { resolution: '768P' } },
});

A provider with completion webhooks can notify your receiver so it fetches the terminal result. If art direction requires a particular opening or closing image, use frameImages on a supporting model. For source material such as a reference clip, use inputReferences and inspect the provider warnings for unsupported media. Video generation

When a stream stalls or a job needs to survive suspension

A stream can open successfully and still leave a user staring at an empty answer. Set timeout.firstChunkMs for the wait until content. Use onStepError to identify a failed step, and prepareStep to change call settings such as the output token limit for a particular step. The release documents these controls without an experimental label. Timeouts · Lifecycle callbacks · Per-step settings

What a retry keeps after streaming starts
Stream options from the docs

timeout: { firstChunkMs: 10000 }

streamRetries: 2

Effect

Limit the wait for the first content in each step.

Retry an eligible provider failure in the current model step.

Completed steps stay complete. Already emitted partial text stays visible.

Enable streamRetries deliberately. A UI that blindly appends every chunk can display a partial answer followed by the retry’s answer. For a long stream with a single consumer, experimental_streamTextLowMemory skips replay buffering and retained final content. Choose it where you consume deltas once and have no need to retrieve the whole answer afterward. Streaming retries · Low-memory streaming

A durable job has a different completion condition. A summarizer might need a final value that survives a workflow suspension, with no live UI. The documented WorkflowAgent.generate() method from @ai-sdk/workflow has no experimental label. Its default maximum is 20 steps. Return selected serializable fields from the workflow. With the durable OpenTelemetry bridge configured, model and tool spans belong to one agent operation across suspension and resumption, retaining their original timestamps. WorkflowAgent · Durable tracing

How a durable summarizer returns its result
Inside the workflow function

'use workflow'

const result = await agent.generate({ prompt: text })

Returned to the caller

return { text: result.text, usage: result.usage }

For a small team, the acceptance checks can be concrete. A dependent read should see the completed write. A user correction should either reach the next eligible step or produce an outcome the UI can act on. Once those work, pick the next feature by the job you actually have to run. For background media or batches, check the selected provider’s model support, billing and webhook behavior before committing to a route.

Published
Category
Build
Related Articles
Codex Models by Surface and Task

Codex Models by Surface and Task

Choose a Codex model for your task and plan, see where GPT-5.6 threads go, and set a default or a one-run CLI override.BuildDec 5
Claude Settings JSON

Claude Settings JSON

Find Claude Code’s settings.json, see which file wins, and copy five examples for permissions, hooks, models, the status line and compaction.BuildDec 5
How to Run Qwen 4 Locally

How to Run Qwen 4 Locally

Run Qwen4-35B-A3B with Ollama, LM Studio, llama.cpp or vLLM. Match GGUF sizes to your GPU or Mac and leave room for context.BuildDec 5
OpenRouter API Key: Create a Key and Send Your First Request

OpenRouter API Key: Create a Key and Send Your First Request

Create an OpenRouter API key, set a spending limit, and send your first request with curl or the OpenAI Python SDK. See the documented reply and error fixes.BuildDec 5
OpenAI Health Alerts

OpenAI Health Alerts

Choose an OpenAI API alert for errors, cache misses, rate limits or Fast tier spillover. Set its scope and route triggers and recoveries to the right team.BuildDec 4
Gemini Interactions API: Change an Agent's Rules and Tools Mid-Conversation

Gemini Interactions API: Change an Agent's Rules and Tools Mid-Conversation

How system_input steps on the Gemini Interactions API change an agent's rules and tools mid-conversation, why the cache survives, and where it stops.BuildDec 4
LM Studio Bionic: What It Is and How to Start

LM Studio Bionic: What It Is and How to Start

How Bionic works alongside LM Studio, where its models run and how to start a coding or document project on your computer.BuildDec 4
OpenRouter Free Models: Which to Call and What the Limits Are

OpenRouter Free Models: Which to Call and What the Limits Are

Find a free OpenRouter model for your project, make an API call, check your remaining quota, and see which providers may retain or train on prompts.BuildDec 4
Newsletter

One letter, every Sunday.Working systems, not hot takes.

Weekly. No spam. Unsubscribe anytime.