Back to templates

Template details

AI SDK Multi-Steps Preview

Next.js example using the AI SDK's streamText function to handle automatic multi-step generations with reasoning steps.

About this template

AI SDK Multi-Steps Preview is a Next.js example template maintained by Vercel Labs that shows how to handle automatic multi-step generations using the AI SDK's streamText function. It sits in the boilerplate category and demonstrates a chatbot-style flow where a reasoning tool lets the model work through a query across several steps.

What is AI SDK Multi-Steps Preview?

AI SDK Multi-Steps Preview is a Next.js starter that wires the AI SDK's streamText function into a chat application so the model can run multi-step generations automatically. The template takes a user query as input and produces a streamed answer that walks through intermediate reasoning steps, rendered by the Next.js front end. It is published under the vercel-labs GitHub organization and depends on provider API keys such as OpenAI's.

Key Features

  • AI SDK streamText — streams model output to the client and handles multi-step generation automatically rather than a single completion.
  • Reasoning tool — a tool definition that lets the model reason over user queries across steps before answering.
  • Next.js framework — built on Next.js and bootstrapped with create-next-app, so it follows standard Next.js routing and development commands.
  • One-click deploy — a Vercel deploy button clones the repository and prompts for an OPENAI_API_KEY environment variable.
  • Environment-based configuration — provider keys are set through a .env file modeled on the included .env.example.
  • Multi-provider support — the docs point to accounts with AI providers such as OpenAI and Anthropic, each requiring its own API key.
  • Simple local workflow — install dependencies with npm install and start the dev server with npm run dev.

How does AI SDK Multi-Steps Preview work?

The template follows a short onboarding path. Bootstrap it with create-next-app using the repository URL, or clone it directly via the Vercel deploy button. Then sign up with an AI provider, obtain an API key, copy .env.example to .env with the required values, run npm install, and finally npm run dev to launch the development server. Once running, the streamText call drives multi-step generations behind the chat UI.

Who is it for?

  • Next.js developers exploring AI features: a working reference for adding multi-step generation to an app with the AI SDK.
  • Developers building reasoning or tool-calling flows: a starting point for wiring a reasoning tool into a chat loop.
  • Teams prototyping AI chat products: a deployable template that goes from clone to running app in a few commands.

Use cases

  • Building a reasoning chatbot: adapt the streamed multi-step output into an interface that shows the model working through a user query step by step.
  • Learning multi-step generation: inspect how streamText chains steps and a reasoning tool inside a Next.js app.
  • Prototyping on Vercel: deploy a prefilled clone of the repository and plug in an OpenAI key to test the flow.

The repository has 120 GitHub stars.

Screenshot of AI SDK Multi-Steps Preview