Skip to main content

Framework Integrations

The mutagent integrate command generates ready-to-use SDK integration code for your framework. This is the recommended way for AI coding assistants to integrate MutagenT into any project.
For AI Agents: Use mutagent integrate <framework> --raw to get clean markdown that can be directly applied to a codebase.

Quick Start

# Interactive - auto-detects your framework
mutagent integrate

# Direct - specify framework
mutagent integrate mastra

# Save to file
mutagent integrate langchain --output INTEGRATION.md

# Raw output for AI agents
mutagent integrate vercel-ai --raw

Supported Frameworks

FrameworkCommandDescription
Mastramutagent integrate mastraModern AI agent framework with built-in observability
LangChainmutagent integrate langchainMost popular LLM application framework
LangGraphmutagent integrate langgraphGraph-based agent workflow framework
Vercel AImutagent integrate vercel-aiAI SDK for streaming chat UIs
Claude Codemutagent integrate claude-codeNative Anthropic Claude integration
Genericmutagent integrate genericOpenAI-compatible API endpoint

How It Works

The CLI:
  1. Detects your framework from package.json and config files
  2. Generates framework-specific callback handler code
  3. Provides step-by-step integration instructions
  4. Optionally verifies the integration works

Framework Examples

Mastra

mutagent integrate mastra
Generates:
import { Mastra } from '@mastra/core';
import { MutagentPlugin } from '@mutagent/mastra';

const mastra = new Mastra({
  plugins: [
    new MutagentPlugin({
      apiKey: process.env.MUTAGENT_API_KEY,
    }),
  ],
});

LangChain

mutagent integrate langchain
Generates:
import { ChatOpenAI } from '@langchain/openai';
import { MutagentCallbackHandler } from '@mutagent/langchain';

const handler = new MutagentCallbackHandler({
  apiKey: process.env.MUTAGENT_API_KEY,
});

const llm = new ChatOpenAI({
  callbacks: [handler],
});

Vercel AI SDK

mutagent integrate vercel-ai
Generates:
import { openai } from '@ai-sdk/openai';
import { streamText } from 'ai';
import { withMutagent } from '@mutagent/vercel-ai';

const result = await streamText({
  model: withMutagent(openai('gpt-5.1'), {
    apiKey: process.env.MUTAGENT_API_KEY,
  }),
  prompt: 'Hello!',
});

Options

OptionDescription
-o, --output <path>Save integration guide to file
--rawOutput raw markdown without terminal formatting
--verifyTest the integration after generation

Auto-Detection

When run without arguments, the CLI scans your project:
mutagent integrate
It checks:
  • package.json dependencies
  • Common config files (mastra.config.ts, langchain.config.js, etc.)
  • Import patterns in source files
And suggests the most likely framework with a confidence score.

List Available Frameworks

mutagent integrate list
Output:
Available frameworks:
  mastra      Modern AI agent framework
  langchain   Popular LLM framework
  langgraph   Agent workflow framework
  vercel-ai   AI SDK for streaming chat
  claude-code Native Anthropic integration
  generic     OpenAI-compatible endpoint