
CLI Usage
Quick Start
- Prompt file created (
.prompt.mdx) - Development server running (
npm run dev)
Passing Props
Inline JSON:Output Examples
Text generation:.agentmark-outputs/:
SDK Usage
AgentMark works with multiple AI SDKs through adapters. Examples below use Vercel AI SDK, but the pattern is the same for all adapters.Text Generation
Object Generation
generateObject, Mastra uses agent.generate(), etc.
Image Generation
Audio Generation
Using Other Adapters
The pattern is always the same:- Load prompt with
client.loadTextPrompt()/loadObjectPrompt()/ etc. - Format with props:
await prompt.format({ props: {...} }) - Pass to your adapter’s generation function
generateText(), generateObject()
Mastra: agent.generate() or similar
Custom: Your own generation function
Learn more about adapters →
Development Workflow
CLI Development
1. Start dev server - Runnpm run dev in one terminal
2. Create/edit prompt - Write your .prompt.mdx file
3. Test with CLI - Run npm run prompt to see output
4. Iterate - Edit prompt, re-run command (auto-reloads)
SDK Integration
1. Import SDK - Add@agentmark/sdk to your project
2. Load prompt - Use appropriate loader for generation type
3. Run with props - Pass dynamic data to your prompt
4. Handle results - Process text, objects, images, or audio
When to Use Each
Use CLI when:- Quick testing during development
- Iterating on prompt design
- Debugging prompt behavior
- Manual verification
- Integrating prompts into your application
- Building production features
- Automated workflows
- Dynamic runtime execution
Troubleshooting
CLI Issues
Server connection error:- Ensure
npm run devis running - Check ports 9417 and 9418 are available
- Verify file path is correct
- Ensure file has
.prompt.mdxextension
- Use valid JSON with double quotes
- Escape quotes in shell:
'{\"key\":\"value\"}'
SDK Issues
Module not found:- Install SDK:
npm install @agentmark/sdk - Check import path is correct
- Verify prompt file exists
- Check file path is relative to project root
- Ensure you’re using the correct loader for your prompt type
- Use TypeScript for better type safety