Markdown for the AI Era
Develop type-safe prompts and agents using readable Markdown and JSX.
AgentMark supports:
- Markdown: 📝
- Type Safety: 🛡️
- Unified model config: 🔗
- JSX components, props, & plugins: 🧩
- Loops, Conditionals, and Filter Functions: ♻️
- Custom SDK Adapters: 🛠️
- JSON Output: 📦
- Tools & Agents: 🕵️
- Text, Object, and Image output. Audio/Video coming soon.
Read our docs to learn more.
Below is a basic example to help you get started with AgentMark:
example.prompt.mdx
---
name: basic-prompt
model:
name: gpt-4o-mini
test_settings:
props:
num: 3
---
<System>You are a math expert</System>
<User>What's 2 + {props.num}?</User>
By default, AgentMark doesn't support any models or calling any LLM providers. Instead, we format the input of your prompt through an adapter to match the input of the SDK you're using.
Adapter | Supported | Supports Type-Safety |
---|---|---|
Default | ✅ | ✅ |
Custom | ✅ | ✅ |
Vercel (Recommended) | ✅ | ✅ |
Mastra | ||
LangChain | ❌ | |
OpenAI Compatible | ❌ |
Want to add support for another adapter? Open an issue.
Prompt Type | Supported |
---|---|
Object | ✅ |
Text | ✅ |
Image | ✅ |
Audio | |
Video |
Refer to our docs to learn how to add custom adapter support.
We plan on providing support for AgentMark across a variety of languages.
Language | Support Status |
---|---|
TypeScript | ✅ Supported |
JavaScript | ✅ Supported |
Python | |
Others | Need something else? Open an issue |
You can run AgentMark using any of the following methods:
Run .prompt.mdx files directly within your VSCode editor. Note: You can test props by using test_settings
in your prompts.
Run AgentMark files from your file system. Below is a sample implementation using the Vercel adapter to generate an object:
import { VercelAdapter, VercelModelRegistry, FileLoader, createAgentMark } from "../src";
import { generateObject } from 'ai';
import { openai } from '@ai-sdk/openai';
// Import/Register any Vercel compatible models
const modelRegistry = new VercelModelRegistry();
modelRegistry.registerModel(['gpt-4o', 'gpt-4o-mini'], (name: string, options: any) => {
return openai(name);
});
// Specify a file loader + vercel adapter
const fileLoader = new FileLoader('./puzzlet/templates');
const adapter = new VercelAdapter(modelRegistry);
const agentMark = createAgentMark({
loader: fileLoader,
adapter,
});
const prompt = await agentMark.loadObjectPrompt('test/math2.prompt.mdx');
const props = {
num1: 2,
num2: 3,
};
// Adapt to the Vercel SDK
const vercelInput = await prompt.format(props);
// Call the Vercel SDK directly
const result2 = await generateObject(vercelInput);
console.log(result2.object);
Puzzlet is a platform for managing, versioning, and monitoring your LLM prompts in production, with built-in observability, evaluations, prompt management, alerts, and more.
// Specify the puzzlet loader instead of file loader
const puzzletLoader = new PuzzletLoader({
apiKey: process.env.PUZZLET_API_KEY!,
appId: process.env.PUZZLET_APP_ID!,
baseUrl: process.env.PUZZLET_BASE_URL!,
});
const agentMark = createAgentMark({
loader: puzzletLoader,
// rest stays the same...
});
AgentMark & Puzzlet supports automatic type generation from your prompt schemas. Define input (input_schema
) and output (schema
) types in your prompt files:
---
name: math-addition
model:
name: gpt-4o
schema:
type: "object"
properties:
sum:
type: "number"
description: "The sum of the two numbers"
required: ["sum"]
input_schema:
type: "object"
properties:
num1:
type: "number"
description: "First number to add"
num2:
type: "number"
description: "Second number to add"
required: ["num1", "num2"]
---
<System>You are a helpful math assistant that performs addition.</System>
Then generate types using the CLI:
# From local files
npx @puzzlet/cli generate-types --root-dir ./prompts > puzzlet.types.ts
# From local Puzzlet server
npx @puzzlet/cli generate-types --local 9002 > puzzlet.types.ts
Use the generated types with FileLoader:
import { VercelAdapter, VercelModelRegistry, FileLoader, createAgentMark } from "../src";
import { generateObject } from 'ai';
import { openai } from '@ai-sdk/openai';
import PuzzletTypes from './puzzlet.types';
const modelRegistry = new VercelModelRegistry();
modelRegistry.registerModel(['gpt-4o', 'gpt-4o-mini'], (name: string, options: any) => {
return openai(name);
});
// Add the puzzlet types
const fileLoader = new FileLoader<PuzzletTypes>('./puzzlet/templates');
const adapter = new VercelAdapter<PuzzletTypes>(modelRegistry);
const agentMark = createAgentMark({
loader: fileLoader,
adapter,
});
const prompt = await agentMark.loadObjectPrompt('test/math2.prompt.mdx');
const props = {
num1: 2,
num2: 3,
};
const vercelInput = await prompt.format(props);
const result2 = await generateObject(vercelInput);
console.log(result2.object.sum);
Or with Puzzlet:
// ...
const puzzletLoader = new PuzzletLoader<PuzzletTypes>({
apiKey: process.env.PUZZLET_API_KEY!,
appId: process.env.PUZZLET_APP_ID!,
baseUrl: process.env.PUZZLET_BASE_URL!,
});
// Rest stays the same...
AgentMark is also type-safe within markdown files. Read more here.
We welcome contributions! Please check out our contribution guidelines for more information.
Join our community to collaborate, ask questions, and stay updated:
This project is licensed under the MIT License.