Skip to main content
AgentMark works with multiple AI SDKs through adapters. Choose the adapter that fits your tech stack, or build your own.

What Are Adapters?

Adapters connect AgentMark prompts to AI SDKs. They translate AgentMark’s prompt format into the format your AI SDK expects. The pattern is always the same:
  1. Load prompt: client.loadTextPrompt() / loadObjectPrompt()
  2. Format with props: await prompt.format({ props: {...} })
  3. Pass to your AI SDK’s generation function

Available Adapters

Vercel AI SDK

The most popular adapter for Next.js and Node.js applications.
import { createAgentMarkClient, VercelAIModelRegistry } from "@agentmark/ai-sdk-v4-adapter";
import { openai } from '@ai-sdk/openai';
import { generateText } from 'ai';

const modelRegistry = new VercelAIModelRegistry()
  .registerModels(["gpt-4o"], (name) => openai(name));

const client = createAgentMarkClient({ loader: fileLoader, modelRegistry });

// Use with Vercel AI SDK functions
const prompt = await client.loadTextPrompt('greeting.prompt.mdx');
const input = await prompt.format({ props: {...} });
const result = await generateText(input);
Learn more →

Mastra

Built for agentic workflows and multi-step LLM applications.
import { createAgentMarkClient, MastraModelRegistry } from "@agentmark/mastra-v0-adapter";

const client = createAgentMarkClient({ loader: fileLoader, modelRegistry });

// Use with Mastra's generation functions
const prompt = await client.loadTextPrompt('greeting.prompt.mdx');
const input = await prompt.format({ props: {...} });
const result = await agent.generate(input);
Learn more →

Custom Adapter

Build your own adapter for any AI SDK by implementing the model registry interface. Learn more →

How to Choose

Use Vercel AI SDK if you’re building with Next.js or want broad model support (OpenAI, Anthropic, Google, etc.) Use Mastra if you’re building complex agentic workflows or need advanced orchestration Build custom if you’re using a different AI SDK or have specific requirements

Switching Adapters

Switch between adapters without changing your prompts. Only your agentmark.client.ts changes:
// Switch from Vercel AI SDK to Mastra
import { createAgentMarkClient, MastraModelRegistry } from "@agentmark/mastra-v0-adapter";
// Your prompts stay exactly the same

Next Steps