Skip to content

Devtools not capturing AI SDK calls executed inside external tRPC package #124

@brunowego

Description

@brunowego

Hi team — we’re integrating @ai-sdk-tools/devtools into a Next.js application that uses tRPC for backend logic, but we’ve found a limitation that seems to prevent Devtools from capturing any AI SDK activity executed inside our shared tRPC backend package.

Context

Our architecture:
• Next.js app (frontend + API routes)
• Shared backend package (@switeco/trpc)
• Contains all business logic
• Uses ai SDK (generateText, streamText, etc.)
• Devtools initialized in the Next.js app:

The Issue

Devtools correctly captures LLM operations when they happen directly inside the Next.js app.

However — any LLM calls executed inside our external tRPC package (e.g. inside resolvers, routers, or service modules) do not appear in Devtools.

This happens even though:
• Both the app and the package share the same version of the ai SDK
• There is no separate bundling or isolated runtime
• All LLM calls are ultimately executed on the server of the Next.js app

Expected Behavior

Devtools should capture all AI SDK calls, regardless of whether they originate:
• directly inside the Next.js project
• or inside imported backend packages using the same SDK instance

Actual Behavior

Only calls made inside the Next.js app are captured.

Calls made inside the external tRPC package are silently ignored, making Devtools incomplete/unusable for debugging our actual backend behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions