Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.agentmark.co/llms.txt

Use this file to discover all available pages before exploring further.

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 the result to your AI SDK’s generation function

Available adapters

AI SDK

The Vercel AI SDK adapter for Next.js and Node.js applications. Supports text, object, image, and speech generation with streaming.
import { createAgentMarkClient, VercelAIModelRegistry } from "@agentmark-ai/ai-sdk-v5-adapter";
import { openai } from "@ai-sdk/openai";
import { generateText } from "ai";

const modelRegistry = new VercelAIModelRegistry();
modelRegistry.registerProviders({ openai });

const client = createAgentMarkClient({ loader, modelRegistry });
const prompt = await client.loadTextPrompt("greeting.prompt.mdx");
const input = await prompt.format({ props: { name: "Alice" } });
const result = await generateText(input);
Learn more →

Claude Agent SDK

Run AgentMark prompts as agentic tasks with Anthropic’s Claude Agent SDK. Supports tool use, budget controls, and tracing.
import { createAgentMarkClient, ClaudeAgentModelRegistry } from "@agentmark-ai/claude-agent-sdk-v0-adapter";
import { query } from "@anthropic-ai/claude-agent-sdk";

const client = createAgentMarkClient({
  loader,
  modelRegistry: ClaudeAgentModelRegistry.createDefault(),
});

const prompt = await client.loadTextPrompt("task.prompt.mdx");
const adapted = await prompt.format({ props: { task: "Refactor auth module" } });

for await (const message of query({
  prompt: adapted.query.prompt,
  options: adapted.query.options,
})) {
  console.log(message);
}
Learn more →

Mastra

Built for agentic workflows and multi-step LLM applications with Mastra’s framework.
import { createAgentMarkClient, MastraModelRegistry } from "@agentmark-ai/mastra-v0-adapter";
import { Agent } from "@mastra/core/agent";
import { openai } from "@ai-sdk/openai";

const modelRegistry = new MastraModelRegistry();
modelRegistry.registerProviders({ openai });

const client = createAgentMarkClient({ loader, modelRegistry });
const prompt = await client.loadTextPrompt("greeting.prompt.mdx");
const agentConfig = await prompt.formatAgent({ props: { name: "Alice" } });

const agent = new Agent(agentConfig);
const [messages, options] = await agent.formatMessages(...);
const result = await agent.generate(messages, options);
Learn more →

Pydantic AI

The recommended adapter for Python applications. Supports text, object generation, streaming, and type-safe outputs via Pydantic models.
from agentmark_pydantic_ai_v0 import (
    create_pydantic_ai_client,
    PydanticAIModelRegistry,
    run_text_prompt,
)
from agentmark.prompt_core import FileLoader

model_registry = PydanticAIModelRegistry()
model_registry.register_models(
    ["gpt-4o", "gpt-4o-mini"],
    lambda name, opts=None: f"openai:{name}",
)

loader = FileLoader("./dist/agentmark")
client = create_pydantic_ai_client(model_registry=model_registry, loader=loader)

prompt = await client.load_text_prompt("greeting.prompt.mdx")
params = await prompt.format(props={"name": "Alice"})
result = await run_text_prompt(params)
Learn more →

Default (fallback)

Returns raw prompt configuration without SDK-specific formatting. Useful for mapping to any provider directly.
import { createAgentMarkClient } from "@agentmark-ai/fallback-adapter";

const client = createAgentMarkClient({ loader });
const prompt = await client.loadTextPrompt("greeting.prompt.mdx");
const result = await prompt.format({ props: { name: "Alice" } });
// Returns raw config — pass to your own provider
Learn more →

Custom adapter

Build your own adapter for any AI SDK by implementing the Adapter<D> interface. Learn more →

How to choose

AdapterBest forLanguageStreamingImage / speech
AI SDKNext.js, Node.js apps with broad model supportTypeScriptYesYes
Claude Agent SDKAgentic tasks with Claude (tool use, budget controls)TypeScript + PythonYes (async message stream)No
MastraComplex agentic workflows and orchestrationTypeScriptYesNo
Pydantic AIPython applications with type-safe outputsPythonYesNo
DefaultDirect provider mapping or unsupported SDKsTypeScriptN/AN/A
CustomAny SDK with specific requirementsTypeScriptYou decideYou decide

For Python developers

Pydantic AI — covers the common case: type-safe outputs via Pydantic models, streaming, sync and async tool functions, and all major LLM providers (OpenAI, Anthropic, Google). Claude Agent SDK — use when you need agentic capabilities with Claude (multi-turn tool use, budget controls, permission management).
Image and speech generation are not available in Python adapters. If you need these features, consider using the AI SDK adapter via a Node.js service, or use provider SDKs directly.

Switching adapters

Switch between adapters without changing your prompts. Only your client configuration changes:
// Switch from AI SDK to Mastra — your prompts stay exactly the same
import { createAgentMarkClient, MastraModelRegistry } from "@agentmark-ai/mastra-v0-adapter";
Your prompts are adapter-agnostic. The same .prompt.mdx files work with any adapter. Only your client configuration (agentmark.client.ts or agentmark_client.py) needs to change.

Package versioning

Adapter packages use a -v0 suffix (e.g., agentmark-pydantic-ai-v0, @agentmark-ai/mastra-v0-adapter). This indicates the adapter API version, not stability:
  • v0 = current stable API
  • Future breaking changes would be released as v1, v2, etc.
This lets you pin a specific adapter API version and still receive bug fixes.

Next steps

AI SDK

Next.js and Node.js apps

Claude Agent SDK

Agentic tasks with Claude

Mastra

Agentic workflows

Pydantic AI

Python type-safe integration

Default adapter

Raw config pass-through

Custom adapter

Build your own