Skip to main content
AgentMark generates structured objects with prompts that declare object_config in frontmatter and a JSON schema for the expected output. Object prompts use the same message-role tags as text prompts.

Example configuration

example.prompt.mdx
OpenAI strict structured output requires additionalProperties: false on every object in your schema (the root and each nested object) and a required list naming all of that object’s properties. Zod’s z.object().strict() emits this for you; a hand-written or migrated JSON-schema schema block doesn’t, so it’s the most common Zod→frontmatter migration trap. Omit it and OpenAI rejects the request with a strict-schema validation error. (Providers without strict mode ignore the field, so it’s always safe to add.)

Tags

TagDescription
<System>System-level instructions
<User>User message
<Assistant>Assistant message (optional; include for few-shot examples)

Using schema references

Instead of writing a full schema inline, you can extract it into a .json file and use $ref to reference it. AgentMark resolves the reference at build time.
extract-event.prompt.mdx
See Schema references for full documentation on $ref syntax, transitive references, and JSON Pointer fragments.

Available configuration

PropertyTypeDescriptionRequired
model_namestringThe name of the model to use for object generation.Yes
schemaJSONSchemaSchema defining the expected structure of the model’s output. Supports $ref for reusable definitions.Yes
max_tokensnumberMaximum number of tokens to generate.No
temperaturenumberControls the randomness of the output; higher values are more random.No
max_callsnumberMaximum number of LLM calls allowed.No
top_pnumberCumulative probability for nucleus sampling.No
top_knumberLimits next-token selection to the top k tokens.No
presence_penaltynumberPenalizes tokens based on presence in the text so far.No
frequency_penaltynumberPenalizes tokens based on frequency in the text so far.No
stop_sequencesstring[]Strings that, if encountered, stop generation.No
seednumberRandom-number seed for reproducibility.No
max_retriesnumberMaximum number of retries on failure.No
schema_namestringName sent with the schema (used by OpenAI structured outputs).No
schema_descriptionstringDescription sent with the schema.No
toolsstring[]List of tool names or MCP URIs available to the model. You resolve these names to implementations at your call site (see Tools and agents).No

Running an object prompt

See the SDK usage section of Running prompts (under the Local tab) for the object-generation SDK code patterns: render the prompt with prompt.format(), then make your own structured-output call (generateObject / streamObject in TypeScript, the OpenAI client in Python).

Have questions?

Reach out any time: