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

AgentMark files (.prompt.mdx) can be configured for multiple generation types. Read more about generation types.

Here’s an example of a text generation prompt:

example.prompt.mdx
---
name: example
text_config:
  model_name: gpt-4
  temperature: 0.7
  max_tokens: 1000
---

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

Here’s an example of an object generation prompt:

example.prompt.mdx
---
name: example
object_config:
  model_name: gpt-4
  schema:
    type: object
    properties:
      result:
        type: string
        description: The generated result
    required: ["result"]
---

<System>You are a helpful assistant.</System>
<User>Hello!</User>

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.

Tools and Agents

Extend functionality with custom tools:

text_config:
  max_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.

File Attachments

Include files and images in your prompts:

<User>
  <ImageAttachment image={props.imageLink} />
  <FileAttachment data={props.fileUrl} mimeType={props.fileMimeType} />
</User>

Learn more about file attachments.

Have Questions?

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