JavaScript APIopeninference-tanstack-ai

Core

Instrumentation

Integrations

JavaScript · Integration

@arizeai/openinference-tanstack-ai

OpenInference middleware for TanStack AI

Version
0.3.6
Peer dependencies
@tanstack/ai >=0.10.0

Install

npm install @arizeai/openinference-tanstack-ai

@arizeai/openinference-tanstack-ai

openInferenceMiddleware

functionSource ↗
function openInferenceMiddleware(
  options?: OpenInferenceTanStackAIMiddlewareOptions,
): ChatMiddleware

Creates a TanStack AI middleware that emits OpenInference-compatible AGENT, LLM, and TOOL spans.

The middleware is intentionally stateful per chat request so it can shape a single agent run into a readable span tree while preserving LLM inputs and outputs in the form Phoenix expects.

OpenInferenceTanStackAIMiddlewareOptions

type aliasSource ↗
type OpenInferenceTanStackAIMiddlewareOptions = 

Configuration for the TanStack AI middleware.

tracer lets consumers opt into a specific OTel tracer while still using the shared OpenInference span shaping in this package.