AgentMark provides several tools for developing and testing prompts:
Develop Locally
Start a local server to serve your prompts:
npx @agentmark/cli@latest serve -p <port>
This creates a local CDN that serves your prompts from the agentmark/
directory.
Test your local server
You can test your local server by running the following command:
Replace <port>
with the port you are running your local server on, and <path>
with the path to the prompt you want to test.
curl http://localhost:<port>/v1/templates?path=<path>
Example:
curl http://localhost:9001/v1/templates?path=math.prompt.mdx
This will return the contents of the math.prompt.mdx
prompt as an AST.
SDK Configuration
Configure the AgentMark SDK to use your local server:
import { AgentMarkSDK } from '@agentmark/sdk';
const sdk = new AgentMarkSDK({
apiKey: process.env.AGENTMARK_API_KEY,
appId: process.env.AGENTMARK_APP_ID,
baseUrl: process.env.AGENTMARK_BASE_URL
});
# .env
AGENTMARK_API_KEY=your-api-key # This gets ignored in local development
AGENTMARK_APP_ID=your-app-id # This gets ignored in local development
AGENTMARK_BASE_URL=http://localhost:<port> # Only required for local development
Agentmark Configuration with vercel ai v4 adapter
import {
createAgentMarkClient,
VercelAIModelRegistry,
} from "@agentmark/vercel-ai-v4-adapter";
import { openai } from "@ai-sdk/openai";
const modelRegistry = new VercelAIModelRegistry();
modelRegistry.registerModels(
["gpt-4o-mini"],
(name: string) => {
return openai(name);
}
);
const agentMark = createAgentMarkClient({
loader: sdk.getFileLoader(),
modelRegistry
});
Running Prompts
Fetch and run prompts using the SDK and AgentMark:
import { generateText } from "ai";
// Fetch the prompt
const examplePrompt = await agentMark.loadTextPrompt("example.prompt.mdx");
// Format the prompt to vercel ai v4 input
const vercelInput = examplePrompt.format({
props: {
username: "Alice"
}
});
// Run the prompt
const result = await generateText(vercelInput);
Creating New Prompts
- Create new
.prompt.mdx
files in your agentmark/
directory
- Test locally using the SDK or VSCode extension
- Sync with AgentMark by committing and pushing to the connected git branch
VSCode Extension
For a more integrated development experience:
- Install the AgentMark Studio VSCode extension
- Open any
.prompt.mdx
file
- Use the built-in prompt “Run” to test your prompts directly in VSCode
Development Workflow
- Start the local server
- Create or modify prompts in your templates directory
- Test using the SDK or VSCode extension
- Sync changes to AgentMark, by committing and pushing to the connected git branch
- Ensure environment variables are set correctly in your deployed environment
This workflow allows you to develop and test prompts locally before deploying them to your production environment.
Have Questions?
We’re here to help! Choose the best way to reach us: