> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentmark.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Build

> Create, run, and version prompts in code or in the Dashboard

Create prompts as `.prompt.mdx` files in your editor, or use the visual editor in the Dashboard. Both produce the same format and are fully interchangeable. Run them via SDK, CLI, or the Dashboard Playground.

## Write prompts as `.prompt.mdx` files

An AgentMark prompt is a `.prompt.mdx` file: Markdown for the prompt text, JSX tags for structure and logic. You write it once and reuse it across your app, version it in git next to your code, and type-check the inputs and outputs against your schema.

* **Readable**: syntax that's easy to review and understand
* **Reusable**: share components across prompts and use variables for dynamic content
* **Type-safe**: full TypeScript support for props and outputs
* **Version-controlled**: store prompts in git alongside your code
* **Testable**: run experiments with datasets and automated evaluations

## Basic structure

Every AgentMark prompt consists of two parts:

### 1. Frontmatter (YAML)

Defines the prompt's metadata and configuration:

```mdx agentmark/greeting.prompt.mdx theme={null}
---
name: greeting
text_config:
  model_name: openai/gpt-5-mini
  temperature: 0.7
---
```

### 2. Template content

The actual prompt using message tags and dynamic content:

```mdx theme={null}
<System>
You are a friendly assistant.
</System>

<User>
Say hello to {props.name} and tell them something interesting.
</User>
```

## Creating prompts

<Tabs>
  <Tab title="Cloud">
    Use the Dashboard's visual editor to create and edit prompts. No coding or git knowledge required.

    <video src="https://mintcdn.com/puzzlet-9ba7bb98/xNzpVKgBdOYuvrcl/images/platform/prompt-management/create-a-prompt/run-prompt.mp4?fit=max&auto=format&n=xNzpVKgBdOYuvrcl&q=85&s=f20a565324812a584f5f7d0cc39eb9fc" aria-label="Creating a prompt in the Dashboard visual editor" autoPlay muted loop playsInline className="w-full rounded-xl border border-gray-800 shadow-2xl mb-12" data-path="images/platform/prompt-management/create-a-prompt/run-prompt.mp4" />

    The visual editor shows the frontmatter and message-tag body, a model selector, input-variable fields, and a streaming output pane. Everything it edits is the same `.prompt.mdx` format you edit locally in your own editor.

    * Write and edit prompts with syntax highlighting
    * Test prompts directly in the editor
    * Configure model settings through visual controls
    * Preview outputs in real-time

    [Step-by-step guide →](/build/creating-prompts)
  </Tab>

  <Tab title="Local">
    Create `.prompt.mdx` files in your project's `agentmark/` directory. The [Basic structure](#basic-structure) above is a complete, runnable prompt. Run it from the CLI:

    ```bash theme={null}
    agentmark run-prompt agentmark/greeting.prompt.mdx
    ```

    <Note>
      Requires the development server running (`agentmark dev`).
    </Note>

    See [Create a prompt](/build/creating-prompts) for the step-by-step walkthrough, or [Running prompts](/build/running-prompts) to execute prompts from your application.
  </Tab>
</Tabs>

## Key features

### Message tags

Structure conversations with role tags:

* `<System>`: system-level instructions
* `<User>`: user messages
* `<Assistant>`: assistant responses (for few-shot examples)

### Dynamic variables

Access runtime data using props:

```mdx theme={null}
<User>
Hello {props.userName}, you have {props.messageCount} new messages.
</User>
```

[Learn about Props →](/templatedx/variables)

### Conditional logic and loops

```mdx theme={null}
<User>
  <If condition={props.isPremium}>
    You have access to premium features.
  </If>

  Products:
  <ForEach arr={props.products}>
    {(product) => (
      <>
        * {product.name}: ${product.price}
      </>
    )}
  </ForEach>
</User>
```

Put the `<>` and `</>` fragment markers on their own lines, as shown. With `props.isPremium = true` and `props.products = [{ name: "Widget", price: 10 }, { name: "Gadget", price: 20 }]`, the `<User>` message renders as:

```text theme={null}
You have access to premium features.

Products:

* Widget: $10
* Gadget: $20
```

[Learn about TemplateDX syntax →](/templatedx/tags)

## Generation types

AgentMark supports multiple output formats:

* **[Text](/build/generation-types/overview#text-generation)**: natural language responses
* **[Object](/build/generation-types/object)**: structured JSON with schema validation
* **[Image](/build/generation-types/overview#image-generation)**: image generation
* **[Speech](/build/generation-types/overview#speech-generation)**: audio generation

[Explore generation types →](/build/generation-types/overview)

## Advanced features

* **[Tools & agents](/build/tools-and-agents)**: extend prompts with function calling and multi-step agent workflows
* **[Components](/build/components)**: create shared, reusable components across prompts
* **[Schema references](/build/schema-references)**: reuse JSON schema definitions across prompts
* **[File attachments](/build/file-attachments)**: include images and documents in prompts
* **[MCP integration](/build/mcp)**: connect to Model Context Protocol servers
* **[Playground](/build/playground)**: compare prompts across multiple models side-by-side
* **[Version control](/build/version-control)**: track and manage prompt versions

## Next steps

<CardGroup cols={2}>
  <Card title="Running prompts" icon="play" href="/build/running-prompts">
    Execute prompts in your application via SDK
  </Card>

  <Card title="Generation types" icon="sparkles" href="/build/generation-types/overview">
    Explore text, object, image, and speech generation
  </Card>

  <Card title="Tools & agents" icon="robot" href="/build/tools-and-agents">
    Build multi-step agents with function calling
  </Card>

  <Card title="TemplateDX syntax" icon="brackets-curly" href="/templatedx/syntax">
    Learn the full template syntax
  </Card>
</CardGroup>

<div className="mt-8 rounded-lg bg-blue-50 p-6 dark:bg-blue-900/30">
  <h3 className="font-semibold mb-3">Have questions?</h3>
  <p className="mb-4">Reach out any time:</p>

  <ul>
    <li>
      Email the team at <a href="mailto:hello@agentmark.co" className="text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-200">[hello@agentmark.co](mailto:hello@agentmark.co)</a> for support
    </li>

    <li>
      Schedule an <a href="https://cal.com/ryan-randall/enterprise" className="text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-200">Enterprise Demo</a> to learn about AgentMark's business solutions
    </li>
  </ul>
</div>
