Skip to main content
For production type safety, see Type safety in the SDK Reference. That page documents npx agentmark generate-types, which produces AgentmarkTypes from your prompt schemas and feeds into createAgentMarkClient<AgentmarkTypes>(). That’s the pipeline AgentMark actually uses at runtime.This page is a supplement for editor-level hints on raw .mdx files opened outside an AgentMark project (e.g. via the vscode-mdx extension). TemplateDX itself does not evaluate TypeScript types — comments are stripped at bundle time per bundler.ts:150.

Editor setup for standalone .mdx files

If you’re editing .mdx files outside an AgentMark project and want props autocomplete from your editor, add JSDoc @typedef comments:
hello.mdx
{/**
  * @typedef Props
  * @property {string} name - Who to greet.
  */
}

# Hello {props.name}
The vscode-mdx extension (and similar editor plugins) read these comments to populate autocomplete. AgentMark’s runtime does not use them — they’re stripped before rendering.

Custom filters and tags (editor-level)

To get autocomplete for custom filters and tags you’ve registered, create a types/global.d.ts:
import type { BaseMDXProvidedComponents, FilterFunction } from '@agentmark-ai/templatedx';

interface MyCustomTagProps {
  label: string;
  max?: number;
}

declare global {
  const myCustomFilter: FilterFunction<string, string>;

  interface MDXProvidedComponents extends BaseMDXProvidedComponents {
    MyCustomTag: React.FC<MyCustomTagProps>;
  }
}

export {};
Again, these types only help the editor — at runtime your filter/tag is looked up by name in the registry.

Production type safety

For compile-time enforcement of prompt props + outputs in your application code, use the AgentMark type generator:
npx agentmark generate-types --root-dir ./agentmark > agentmark.types.ts
Then:
import type AgentmarkTypes from "./agentmark.types";

const client = createAgentMarkClient<AgentmarkTypes>({ loader, modelRegistry });
const prompt = await client.loadObjectPrompt("my/prompt.mdx");
// props and output are now fully typed from the prompt's input_schema + object_config.schema
See SDK Reference → Type safety for the full flow including generator output format.