messages array, a system string, a ChatPromptTemplate, a PromptTemplate. Migrating it to AgentMark means moving that text into a versioned .prompt.mdx and loading it at the call site, so the prompt is editable, type-safe, and traceable instead of hard-coded.
The pattern
It’s the same three moves regardless of which SDK or framework the prompt currently lives in:- Extract the prompt into
agentmark/<name>.prompt.mdx— thesystem/user/assistantturns become message tags, and the template variables become{props.*}. See Creating prompts for the shape. - Load + render it at the call site:
client.loadTextPrompt(...)thenprompt.format({ props })gives you backmessages(andtext_config). - Keep your model call — you are replacing where the prompt comes from, not your SDK. Feed the rendered
messagesto whatever you already call (generateText,openai.chat.completions.create,model.invoke, …), then delete the inline prompt.
agentmark/summarize.prompt.mdx
Raw OpenAI / Anthropic SDK
An inlinemessages array (or system + messages) moves straight into the prompt file; the create call stays.
format, then pass messages (and split the system turn out as Anthropic requires) to anthropic.messages.create.
Vercel AI SDK
generateText’s system + prompt/messages come from the rendered prompt; the generateText call stays.
LangChain
AChatPromptTemplate is a prompt — migrate it. The template’s messages move into the .prompt.mdx; you drop the ChatPromptTemplate + .pipe() and keep the chat model, because LangChain chat models accept a message array directly.
LlamaIndex (Python)
APromptTemplate (or ChatPromptTemplate) moves into the .prompt.mdx; you render with AgentMark and call the LLM with the resulting messages.
After you migrate
Your model call is unchanged — same SDK, same function signature, same behavior. All that moved is where the prompt comes from: editing it is now a versioned, reviewable.prompt.mdx change instead of a code edit, and every run is traceable.
Run agentmark doctor to confirm the prompt parses, then run it to confirm the call site still works.
Have questions?
Reach out any time:
- Email us at hello@agentmark.co for support
- Schedule an Enterprise Demo to learn about our business solutions