Skip to content

docs(frameworks): TanStack AI tracing (TH-8238) - #1013

Merged
nik13 merged 6 commits into
mainfrom
feat/th-8238-tanstack-ai-docs
Oct 29, 2026
Merged

nik13 merged 6 commits into
mainfrom
feat/th-8238-tanstack-ai-docs

Conversation

@nik13

@nik13 nik13 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Summary

New page src/pages/docs/integrations/frameworks/tanstack-ai.mdx: trace TanStack AI (@tanstack/ai) server-side chat() calls with TanStack's own otelMiddleware and a tracer provider from @traceai/fi-core. No traceAI package; the recipe file (tracing.mjs) is embedded in the page and is the same file as the runnable example in future-agi/traceAI#212 (typescript/examples/tanstack-ai).

Sections: install (with the SDK and adapter pins), environment, the recipe file, a traced route (abort wiring, bounded flush), run and check (span table, error shapes), what is captured (default vs captureContent: true), privacy (metadata only by default; error text and stack traces replaced by error.type; opt-in with redact; opaque session ids), apps that already run OpenTelemetry (new trace per chat, joinActiveTrace), how it behaves, limitations, troubleshooting, and how it differs from the Vercel AI SDK integration, the OpenAI instrumentor and the OpenInference TanStack middleware.

Tested

  • @tanstack/ai 0.69.0 (npm latest, 2026-10-13) with @tanstack/ai-openai 0.30.0, @tanstack/openai-base 0.14.0, OpenTelemetry SDK 2.12.0; also the earlier set @tanstack/ai 0.64.0 / ai-openai 0.26.0 / SDK 2.11.0. @traceai/fi-core 1.0.0. Node 22.18.0 and 26.8.1.
  • Real end-to-end runs against a self-hosted Future AGI (Observe UI + stored spans): a tool-calling chat, a tool that throws, an unknown model (ERROR), a chat under an app's own active span, and the content opt-in; fi_verify PASS on each project.
  • Live vendor verification (2026-10-17): the same runs with a real OpenAI key on gpt-4o-mini (provider openai, response model gpt-4o-mini-2024-07-18, per-call cost computed, 404 unknown model → ERROR model_not_found). Spend about $0.0001.
  • Privacy: a unique marker, a home path, the user name, the host name, an email address and all keys were absent from every stored column with the default; present only as documented with the opt-in; no stack trace in either mode. Details and trace ids in feat(examples): TanStack AI otelMiddleware recipe (TH-8238) traceAI#212 "Re-verification (2026-10-16)".

Build

docs_build.sh: BUILD_EXIT=0; audit-links: 0 broken nav links, 0 broken content links.

Navigation

src/lib/navigation.ts is not edited. Suggested nav: group Integrations → Frameworks, title "TanStack AI" (page /docs/integrations/frameworks/tanstack-ai), next to the other framework recipes.

Depends on

future-agi/traceAI#212 (head f2295cb): the page's tracing.mjs and the example the "Source" row links to. The link resolves once #212 is merged and released to main.

Limitations stated on the page

  • The Tracing list shows no tokens for a TanStack trace (the list reads the root span; the recipe moves the root's sum off it so trace view, sessions, dashboards and cost count each call once).
  • Input/Output panes stay empty with content on (content is in attributes).
  • chat({ stream: false }) loses failed traces (0.64.0 to 0.69.0).
  • Not tested: hosted api.futureagi.com, other adapters, media activities, browser and edge runtimes.

Linear: TH-8238.

🤖 Generated with Claude Code

Recipe page for TanStack AI (@tanstack/ai 0.69.0, also tested on 0.64.0):
TanStack's own otelMiddleware with a tracer from @traceai/fi-core,
wrapped by the tracing.mjs from future-agi/traceAI#212 (span kinds, tokens
counted once, error text and stack traces out by default, session from
threadId, a new trace per chat). Covers install and pins, a traced route,
what is captured, privacy default and the captureContent opt-in, apps
that already run OpenTelemetry, limitations and troubleshooting.

navigation.ts is not edited; suggested nav: Integrations > Frameworks,
"TanStack AI".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
nik13 and others added 5 commits October 21, 2026 15:42
…0.69.0 (TH-8238)

- route.mjs now defines a get_weather server tool with toolDefinition() and
  passes tools to chat(), so step 5's tool question produces the
  execute_tool span the table describes (same tool as the traceAI example).
  The model is read from OPENAI_MODEL, defaulting to gpt-4o-mini.
- Replace the stale "Pre-1.0 upstream" note: @tanstack/ai and
  @tanstack/ai-openai 1.0.0 shipped on 2026-10-22; list what changed in
  otelMiddleware and usage-attributes and keep the recipe pinned to 0.69.0.
- Replace the "Not tested" row and wording with the verified scope, record
  the 2026-10-29 run (fresh install of the step 1 pins, hosted
  api.futureagi.com accepted all four spans), and drop telemetry.sdk.* from
  the resource list (not present in the exported resource).
- Add the page to the integration catalog.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@nik13
nik13 marked this pull request as ready for review October 29, 2026 15:19
@nik13
nik13 merged commit 79e5298 into main Oct 29, 2026
2 checks passed
@nik13
nik13 deleted the feat/th-8238-tanstack-ai-docs branch October 29, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant