content/docs/03-ai-sdk-core/65-devtools.mdx
AI SDK DevTools gives you full visibility over your AI SDK calls with generateText, streamText, and ToolLoopAgent. It helps you debug and inspect LLM requests, responses, tool calls, and multi-step interactions through a web-based UI.
DevTools is composed of two parts:
Install the DevTools package:
pnpm add @ai-sdk/devtools
ai@^6.0.0-beta.0)Wrap your language model with the DevTools middleware using wrapLanguageModel:
import { wrapLanguageModel, gateway } from 'ai';
import { devToolsMiddleware } from '@ai-sdk/devtools';
const model = wrapLanguageModel({
model: gateway('anthropic/claude-sonnet-4.5'),
middleware: devToolsMiddleware(),
});
The wrapped model can be used with any AI SDK Core function:
import { generateText } from 'ai';
const result = await generateText({
model, // wrapped model with DevTools
prompt: 'What cities are in the United States?',
});
Start the DevTools viewer:
npx @ai-sdk/devtools
Open http://localhost:4983 to view your AI SDK interactions.
The DevTools middleware captures the following information from your AI SDK calls:
DevTools organizes captured data into runs and steps:
generateText or streamText call)Multi-step interactions, such as those created by tool calling or agent loops, are grouped together as a single run with multiple steps.
The DevTools middleware intercepts all generateText and streamText calls through the language model middleware system. Captured data is stored locally in a JSON file (.devtools/generations.json) and served through a web UI built with Hono and React.
DevTools stores all AI interactions locally in plain text files, including:
Only use DevTools in local development environments. Do not enable DevTools in production or when handling sensitive data.