Skip to main content
You already have a prompt. It’s just living in your application code: an inline 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:
  1. Extract the prompt into agentmark/<name>.prompt.mdx. The system / user / assistant turns become message tags, and the template variables become {props.*}. See Creating prompts for the shape.
  2. Load + render it at the call site: client.loadTextPrompt(...) then prompt.format({ props }) gives you back messages (and text_config).
  3. Keep your model call. You are replacing where the prompt comes from, not your SDK. Feed the rendered messages to whatever you already call (generateText, openai.chat.completions.create, model.invoke, …), then delete the inline prompt.
The prompt file is the same in every case. For the examples below:
agentmark/summarize.prompt.mdx

Raw OpenAI / Anthropic SDK

An inline messages array (or system + messages) moves straight into the prompt file; the create call stays.
The Anthropic SDK is the same idea: load + 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

A ChatPromptTemplate is a prompt, so 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)

A PromptTemplate (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 doesn’t change: same SDK, same function signature, same behavior. All that moved is where the prompt comes from: editing the prompt 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: