.prompt.mdx
files into model-specific formats while maintaining a unified interface.
Processing Pipeline
1. MDX Processing
Your.prompt.mdx
file contains:
- Frontmatter configuration
- Message components (
<System>
,<User>
,<Assistant>
) - Dynamic content (props, components)
2. AST Generation
TheLoader
class has a method called load
that parses your MDX into an Abstract Syntax Tree (AST), which:
- Validates syntax
- Processes imports
- Provides an AST that the SDK can use to generate prompts
3. Transformations
Two transformations occur:3a. AgentMark Format
Agentmark client compiles the AST into default agentmark format.- Standardized message structure
- Normalized model configuration
- Evaluates props
3b. Adapter translation
Adapter converts AgentMark format into adapter-specific formats:- Message formatting
- Parameter mapping
- Tool/function calling adaptations
Implementation Example with Vercel AI SDK adapter
TypeScript
Key Benefits
- Abstraction: Developers work with a single, unified format
- Portability: Prompts can be easily switched between models
- Extensibility: New model support via plugin system
- Type Safety: Full type-safety support throughout pipeline
- Tooling: We can support a rich ecosystem of development tools
Have Questions?
We’re here to help! Choose the best way to reach us:
- Join our Discord community for quick answers and discussions
- Email us at hello@agentmark.co for support
- Schedule an Enterprise Demo to learn about our business solutions