Skip to main content

Integrations

MutagenT integration packages are thin adapters that map your framework’s events to MutagenT SDK tracing primitives. They provide automatic tracing with zero manual instrumentation — every LLM call, chain execution, tool invocation, and graph transition is captured without changing your application code.

How It Works

Each integration package sits between your AI framework and the MutagenT SDK. The adapter intercepts framework events (callbacks, middleware hooks, or client wrappers) and translates them into SDK span operations. All span lifecycle management, batching, and transport is handled by the SDK — the integration packages contain no networking code.

Supported Frameworks

FrameworkTypeScript PackagePatternStatus
LangChain@mutagent/langchainCallback handlerAvailable
LangGraph@mutagent/langchainSame callback handlerAvailable
OpenAI@mutagent/openaiProxy wrapper (observeOpenAI)Available
Vercel AI SDK@mutagent/vercel-aiOTel SpanExporter or MiddlewareAvailable
Mastra@mutagent/sdk (direct)SDK tracingComing Soon
All TypeScript packages require @mutagent/sdk >=0.1.0 as a peer dependency.

Two Ways to Integrate

The CLI can auto-detect your framework by scanning your codebase and generate configuration code:
# Auto-detect framework by scanning your codebase
mutagent explore

# Generate integration code for a specific framework
mutagent integrate langchain
mutagent integrate langgraph
mutagent integrate openai
mutagent integrate vercel-ai

# Auto-detect framework and generate integration
mutagent integrate

# Validate an existing integration setup
mutagent integrate langchain --verify
After mutagent auth login, the CLI offers a guided integration path that automatically runs mutagent explore and walks you through framework selection, package installation, and code generation.

Option 2: Manual Setup

Install the integration package and initialize tracing yourself:
1

Install the SDK and integration package

npm install @mutagent/sdk @mutagent/langchain
2

Initialize tracing at app startup

import { initTracing } from '@mutagent/sdk/tracing';

initTracing({ apiKey: process.env.MUTAGENT_API_KEY! });
3

Use the integration adapter

import { MutagentCallbackHandler } from '@mutagent/langchain';

const handler = new MutagentCallbackHandler();
const result = await chain.invoke(input, { callbacks: [handler] });

What Gets Traced

LLM Calls

Input messages, output text, model name, and provider

Token Usage

Prompt tokens, completion tokens, and total token counts

Latency

Span duration for every operation, from LLM calls to tool executions

Errors

Error messages and status propagation for failed operations

Tool Calls

Tool inputs, outputs, and execution status

Graph Topology

Node transitions, edge routing, and conditional branching decisions

Framework Guides

LangChain

Callback handler for chains, agents, tools, and retrievers

LangGraph

Automatic tracing via LangChain callback handler

OpenAI

Proxy wrapper with full SDK surface preservation

Vercel AI SDK

OTel SpanExporter or middleware for generate and stream

Mastra

SDK-direct tracing for Mastra agent framework