agentmark generate-types compiles those schemas to TypeScript types you can pass to createAgentMark<T>() for compile-time validation and IDE autocomplete.
Defining types
Define input and output types in your prompt files using JSON Schema:math/addition.prompt.mdx
Generating types
Generate TS types with the CLI:agentmark.types.ts
- The wrapper (
Math$Addition) is atypealias, whileMath$AdditionIn/Math$AdditionOutareinterfaces. - Each prompt gets three key aliases: the full path with
.prompt.mdx, the path ending in.prompt, and the bare name. Any of the three resolves to the same type when you callloadTextPrompt/loadObjectPrompt.
Using generated types
Pass the generatedAgentmarkTypes interface as the generic parameter to createAgentMark<AgentmarkTypes>({ loader }). TypeScript then type-checks prompt names, props, and outputs on the neutral render. The client returns AgentMark’s neutral shape ({ messages, object_config } for object prompts); you pass that to your own model call or an executor.
- TypeScript
- Python
Benefits
- Compile-time safety: TypeScript flags prop-shape mismatches before runtime.
- IDE support: autocomplete and inline descriptions on
propsand outputs. - Consistent interfaces: the same
AgentmarkTypesdrives both the loader and the caller. - Documentation: JSON Schema descriptions flow through to TS JSDoc comments.
Best practices
- Define both
input_schemaandobject_config.schema(when the prompt is an object prompt) in your prompt files. - Use descriptive property names and add
descriptionfields; they become JSDoc comments. - Mark required properties using
required. - Regenerate types after any schema edit:
agentmark generate-types --root-dir ./agentmark > agentmark.types.ts. - Commit
agentmark.types.tsto version control so CI type-checks the contract.
Have questions?
Reach out any time:
- Email the team at hello@agentmark.co for support
- Schedule an Enterprise Demo to learn about AgentMark’s business solutions