AgentMark combines markdown-like syntax with JSX components to create powerful, dynamic prompts. It provides a flexible way to structure prompts while supporting advanced features like conditionals, loops, and dynamic content.

Basic Structure

Every AgentMark file (.prompt.mdx) consists of:

example.prompt.mdx
---
name: example-prompt
metadata:
  model:
    name: gpt-4
    settings:
      temperature: 0.7
---

<System>You are a helpful assistant.</System>
<User>Hello!</User>
<Assistant>Hi there! How can I help you today?</Assistant>

Learn more about the basic structure and components.

Dynamic Content

Props and Variables

Access variables using the props object:

<System>
Respond in {props.language} at a {props.difficulty} level.
</System>

Learn more about using props.

Conditional Logic

Use <If>, <ElseIf>, and <Else> for dynamic content:

<If condition={props.userType === "admin"}>
  Include technical details.
</If>

Learn more about conditionals.

Loops

Iterate over arrays using <ForEach>:

<ForEach arr={props.items}>
  {(item) => <User>{item.message}</User>}
</ForEach>

Learn more about loops.

Model Settings

Configure model behavior in the frontmatter:

metadata:
  model:
    name: gpt-4
    settings:
      temperature: 0.7
      max_tokens: 1000

Learn more about model settings.

Advanced Features

Structured Output

Define expected response formats using JSON Schema:

settings:
  schema:
    type: object
    properties:
      result:
        type: string

Learn more about object schemas.

Tools and Agents

Extend functionality with custom tools:

settings:
  max_llm_calls: 3
  tools:
    calculate:
      description: "Performs calculations"
      parameters:
        type: object
        properties:
          expression:
            type: string

Learn more about tools and agents.

Reusable Components

Import and reuse prompt components:

import MathInstructions from './math-instructions.mdx';

<System>
  <MathInstructions level={props.difficulty} />
</System>

Learn more about reusable components.

Filter Functions

Transform values using built-in or custom filters:

Your name is {capitalize(props.name)}

Learn more about filter functions.

Have Questions?

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