Debugging Vercel AI SDK workflows in production is painful.Documentation Index
Fetch the complete documentation index at: https://docs.tracepilotai.com/llms.txt
Use this file to discover all available pages before exploring further.
console.log disappears into serverless cold starts. Streaming responses have no visibility past the first token. Tool calls fail silently. npm install tracepilot-vercel gives you structured traces, replay, and full span visibility — in under five minutes.
Why traditional logs fail for Vercel AI SDK
Serverless functions on Vercel have hard limits that make conventional debugging brittle:| Problem | What you see | What you need |
|---|---|---|
| Cold start truncation | First log entry missing | Full execution timeline |
| Streaming black box | No visibility mid-stream | Per-token span capture |
| Silent tool failures | No error, no output | Structured error spans |
| Retry loops | Duplicate output, rising cost | Loop detection + replay |
| No request correlation | Logs scattered across invocations | Single trace per agent run |
Real-world debugging scenario
You ship a RAG pipeline usinggenerateText with two tool calls. It works in staging. In production, 12% of requests return empty outputs. No errors in Vercel logs.
With TracePilot, you open the dashboard, filter for failed traces, and immediately see:
- Span 1 (
generateText) completed in 1.2s ✓ - Span 2 (
fetchDocument) timed out at 3.0s ✗ - Span 3 (
generateText) never fired — skipped due to empty tool output
Installation
yarn
Environment variables
.env.local
Instrumenting generateText()
Wrap your generateText call with TracePilot. Your existing code stays unchanged — the wrapper captures input, output, token usage, and latency as a span.
Instrumenting streamText()
Streaming is where most Vercel AI SDK debugging tools fall short. TracePilot captures the full stream — start time, first token latency, full output, and any mid-stream errors.
wrapStream does not buffer the stream. It taps it transparently — your time-to-first-token is unaffected.Wrapper instrumentation for multi-tool pipelines
Chain spans withparentSpanId to build a full execution tree across multiple generateText and tool calls.
Replay AI execution
Once a trace is captured, you can fork any span and re-run it with modified inputs — directly from the dashboard. No redeployment. No code changes. How to replay a failing Vercel AI SDK span:Open the trace
Go to tracepilotai.com/dashboard and find the failing trace. Traces are sorted by recency and filterable by status.
Select the failing span
Click into the span where the failure occurred. You’ll see the exact input messages, model parameters, token count, and error output.
Fork & Rerun
Click Fork & Rerun. Edit the prompt, adjust the model, or change tool parameters. Hit Run — TracePilot re-executes the span and shows you the new output side-by-side.

Vercel AI SDK observability checklist
generateText not capturing output
generateText not capturing output
Make sure you’re passing the result of
tp.wrapGenerate() and not calling generateText() directly. The wrapper must intercept the call to record the span.streamText span shows no output
streamText span shows no output
wrapStream captures the full stream asynchronously. If the trace shows an empty output, the stream may have been consumed before TracePilot could read it. Ensure you’re passing the wrapped stream to StreamingTextResponse, not the raw one.Spans not appearing in dashboard
Spans not appearing in dashboard
Verify
TRACEPILOT_API_KEY is set in your Vercel project environment variables — not just in .env.local. Local env files are not deployed.Serverless function timeout before trace ships
Serverless function timeout before trace ships
TracePilot batches and ships spans before the function returns. If your function hits the Vercel timeout limit (default 10s), increase it in
vercel.json or use Edge Runtime.Next steps
Quickstart: tracepilot-vercel
Go from install to live trace in under 5 minutes.
Time-travel debugging
Learn the full Fork & Rerun flow for fixing broken spans.
Multi-step agents
Build nested span trees across complex pipelines.
Cost tracking
Monitor token spend per span across all your AI SDK calls.