> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-export-1767976498-81c8aa9.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a prompt

Navigate to the  in the left-hand sidebar or from the application homepage.

<img src="https://mintcdn.com/langchain-5e9cc07a-preview-export-1767976498-81c8aa9/FgzzEHwMR2qHYiyq/langsmith/images/empty-playground.png?fit=max&auto=format&n=FgzzEHwMR2qHYiyq&q=85&s=5b596e7c920c0024c35c07c0b18166aa" alt="Empty playground" width="1747" height="1285" data-path="langsmith/images/empty-playground.png" />

## Compose your prompt

On the left is an editable view of the prompt.

The prompt is made up of messages, each of which has a "role" - including `system`, `human`, and `ai`.

### Template format

The default template format is `f-string`, but you can change the prompt template format to `mustache` by clicking on the settings icon next to the model -> prompt format -> template format. Learn more about template formats [here](/langsmith/prompt-engineering-concepts#f-string-vs-mustache).

<img src="https://mintcdn.com/langchain-5e9cc07a-preview-export-1767976498-81c8aa9/I-Qb-8KDEEAG9cPi/langsmith/images/template-format.png?fit=max&auto=format&n=I-Qb-8KDEEAG9cPi&q=85&s=76a880b97722233982895c91cb80c268" alt="Template format" width="938" height="352" data-path="langsmith/images/template-format.png" />

### Add a template variable

The power of prompts comes from the ability to use variables in your prompt. You can use variables to add dynamic content to your prompt. Add a template variable in one of two ways:

1. Add `{{variable_name}}` to your prompt (with one curly brace on each side for `f-string` and two for `mustache`). <img src="https://mintcdn.com/langchain-5e9cc07a-preview-export-1767976498-81c8aa9/ibdckmyv9ObjCoke/langsmith/images/prompt-with-variable.png?fit=max&auto=format&n=ibdckmyv9ObjCoke&q=85&s=c5b3b844f7b4023e54d18ef2e68f41e8" alt="Prompt with variable" width="726" height="169" data-path="langsmith/images/prompt-with-variable.png" />

2. Highlight text you want to templatize and click the tooltip button that shows up. Enter a name for your variable, and convert. <img src="https://mintlify.s3.us-west-1.amazonaws.com/langchain-5e9cc07a-preview-export-1767976498-81c8aa9/langsmith/images/convert-to-variable.gif" alt="Convert to variable" />

When we add a variable, we see a place to enter sample inputs for our prompt variables. Fill these in with values to test the prompt. <img src="https://mintcdn.com/langchain-5e9cc07a-preview-export-1767976498-81c8aa9/ibdckmyv9ObjCoke/langsmith/images/prompt-inputs.png?fit=max&auto=format&n=ibdckmyv9ObjCoke&q=85&s=9f9d8249851e3e66b569394a5ee3e643" alt="Prompt inputs" width="775" height="134" data-path="langsmith/images/prompt-inputs.png" />

### Structured output

Adding an output schema to your prompt will get output in a structured format. Learn more about structured output [here](/langsmith/prompt-engineering-concepts#structured-output). <img src="https://mintcdn.com/langchain-5e9cc07a-preview-export-1767976498-81c8aa9/4zKi-VaVSNGgm-cP/langsmith/images/structured-output.png?fit=max&auto=format&n=4zKi-VaVSNGgm-cP&q=85&s=8e6b065babf12f1f7034a93831bca4be" alt="Structured output" width="814" height="574" data-path="langsmith/images/structured-output.png" />

### Tools

You can also add a tool by clicking the `+ Tool` button at the bottom of the prompt editor. See [here](/langsmith/use-tools) for more information on how to use tools.

<Callout type="info" icon="bird">
  Use **[Polly](/langsmith/polly)** in the Playground to generate tools, create output schemas, and optimize your prompts with AI assistance.
</Callout>

## Run the prompt

Click "Start" to run the prompt.

<img src="https://mintcdn.com/langchain-5e9cc07a-preview-export-1767976498-81c8aa9/y97xRK1u_5JYOMaU/langsmith/images/create-a-prompt-run.png?fit=max&auto=format&n=y97xRK1u_5JYOMaU&q=85&s=1aa7e1e02d18948eb4500c7820a06896" alt="Create a prompt run" width="1525" height="766" data-path="langsmith/images/create-a-prompt-run.png" />

## Save your prompt

To save your prompt, click the "Save" button, name your prompt, and decide if you want it to be "private" or "public". Private prompts are only visible to your workspace, while public prompts are discoverable to anyone.

The model and configuration you select in the Playground settings will be saved with the prompt. When you reopen the prompt, the model and configuration will automatically load from the saved version. <img src="https://mintcdn.com/langchain-5e9cc07a-preview-export-1767976498-81c8aa9/4zKi-VaVSNGgm-cP/langsmith/images/save-prompt.png?fit=max&auto=format&n=4zKi-VaVSNGgm-cP&q=85&s=01474b8d60b26cca879b78504a6f7c4d" alt="Save prompt" width="465" height="306" data-path="langsmith/images/save-prompt.png" />

<Check>
  The first time you create a public prompt, you'll be asked to set a LangChain Hub handle. All your public prompts will be linked to this handle. In a shared workspace, this handle will be set for the whole workspace.
</Check>

<img src="https://mintcdn.com/langchain-5e9cc07a-preview-export-1767976498-81c8aa9/ibdckmyv9ObjCoke/langsmith/images/public-handle.png?fit=max&auto=format&n=ibdckmyv9ObjCoke&q=85&s=71af27fafb5672ec6ee853ebcd6f60bf" alt="Public handle" width="575" height="357" data-path="langsmith/images/public-handle.png" />

## View your prompts

You've just created your first prompt! View a table of your prompts in the prompts tab.

<img src="https://mintcdn.com/langchain-5e9cc07a-preview-export-1767976498-81c8aa9/ibdckmyv9ObjCoke/langsmith/images/prompt-table.png?fit=max&auto=format&n=ibdckmyv9ObjCoke&q=85&s=d4f138aa86d9f95ed53e8fd2f0e622c8" alt="Prompt table" width="1508" height="309" data-path="langsmith/images/prompt-table.png" />

## Add metadata

To add metadata to your prompt, click the prompt and then click the "Edit" pencil icon next to the name. This brings you to where you can add additional information about the prompt, including a description, a README, and use cases. For public prompts this information will be visible to anyone who views your prompt in the LangChain Hub.

<img src="https://mintcdn.com/langchain-5e9cc07a-preview-export-1767976498-81c8aa9/t7nc8hzp-fFlTh6Q/langsmith/images/pencil.png?fit=max&auto=format&n=t7nc8hzp-fFlTh6Q&q=85&s=9af59a6d817f1576d34f764cdd80f191" alt="Pencil" width="1167" height="1067" data-path="langsmith/images/pencil.png" />

<img src="https://mintcdn.com/langchain-5e9cc07a-preview-export-1767976498-81c8aa9/FgzzEHwMR2qHYiyq/langsmith/images/edit-prompt.png?fit=max&auto=format&n=FgzzEHwMR2qHYiyq&q=85&s=2d05364ef10658631aaa6a4833777d73" alt="Edit prompt" width="1508" height="1084" data-path="langsmith/images/edit-prompt.png" />

# Next steps

Now that you've created a prompt, you can use it in your application code. See [how to pull a prompt programmatically](/langsmith/manage-prompts-programmatically#pull-a-prompt).

***

<Callout icon="pen-to-square" iconType="regular">
  [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/langsmith/create-a-prompt.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
</Callout>

<Tip icon="terminal" iconType="regular">
  [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
</Tip>
