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
---
name: example
object_config:
  model_name: gpt-4
  schema:
    type: object
    properties:
      event:
        type: object
        properties:
          name: 
            type: string
            description: The name of the event
          date:
            type: string
            description: The date of the event
          attendees:
            type: array
            items:
              type: object
              properties:
                name:
                  type: string
                  description: The name of the attendee
                role:
                  type: string
                  description: The role of the attendee
              required:
                - name
                - role
        required: 
          - name
          - date
          - attendees
---

<System>You are an event planner that creates detailed event objects with attendees and their roles.</System>
<User>Create an event for a team meeting next Friday with John as the facilitator and Sarah as the note-taker.</User>

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
---
name: extract-event
object_config:
  model_name: gpt-4
  schema:
    $ref: ./schemas/event.json
---

<System>You are an event planner that creates detailed event objects.</System>
<User>Create an event for a team meeting next Friday with John as the facilitator.</User>
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.No

Running an object prompt

See Running prompts → Object generation for the SDK code patterns for generateObject / streamObject (TypeScript) and run_object_prompt (Python).

Have Questions?

We’re here to help! Choose the best way to reach us: