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

# Quickstart

> Create, run, and evaluate your first prompt.

PromptLayer helps you manage prompts outside your code and evaluate changes before they reach production. In this quickstart, you will create a prompt, run it in the dashboard and from code, then build an evaluation for it.

## Prerequisites

Before you start, make sure you have a [PromptLayer account](https://dashboard.promptlayer.com/create-account).

<Tip>
  **Using a coding agent?**

  Copy the following prompt to add the PromptLayer **skill** and **MCP servers** for better results when working with PromptLayer.
</Tip>

<Prompt description="Install the PromptLayer skill and MCP servers." icon="sparkles" actions={["copy", "cursor"]}>
  Install the PromptLayer skill for context on project structure, SDKs, prompts, evaluations, observability, and PromptLayer best practices:

  npx skills add [https://docs.promptlayer.com](https://docs.promptlayer.com)

  Add the PromptLayer Docs MCP server for documentation search:

  [https://docs.promptlayer.com/mcp](https://docs.promptlayer.com/mcp)

  Add the PromptLayer MCP server for PromptLayer workspace access and content management:

  [https://mcp.promptlayer.com/mcp](https://mcp.promptlayer.com/mcp)
</Prompt>

## Create a prompt

From the PromptLayer dashboard, click **New** -> **Prompt**.

<Frame>
  <img src="https://mintcdn.com/promptlayer/Uwb3ZGD7ch34XkjE/new-quickstart-images/prompt-creation-access.png?fit=max&auto=format&n=Uwb3ZGD7ch34XkjE&q=85&s=34382dd2de9bd6798c863d02f02e7c37" alt="Creating a new prompt" width="2880" height="1624" data-path="new-quickstart-images/prompt-creation-access.png" />
</Frame>

Name the prompt `cake-recipe`, then replace the default messages with the following content.

```markdown System theme={null}
You are a Michelin-star pastry chef. Generate cake recipes with:

**Overview**: One paragraph about the cake
**Ingredients**: Bullet points with metric and US measurements
**Instructions**: Numbered steps with temperatures and timing
**Variations**: Optional frostings or substitutions
```

```markdown User theme={null}
Create a recipe for {{cake_type}} that serves {{serving_size}} people.
```

`{{cake_type}}` and `{{serving_size}}` are [input variables](/features/prompt-registry/template-variables). PromptLayer fills them in each time you run the prompt.

<Frame>
  <img src="https://mintcdn.com/promptlayer/Uwb3ZGD7ch34XkjE/new-quickstart-images/variables-explained.png?fit=max&auto=format&n=Uwb3ZGD7ch34XkjE&q=85&s=3b2d6c2203652e7937090e8d9abfcc1a" alt="Input variables in prompt" width="5760" height="3240" data-path="new-quickstart-images/variables-explained.png" />
</Frame>

### Write prompts with AI

Click the magic wand icon to open the AI prompt writer. It can help rewrite or improve your prompts based on your instructions. Try asking it to add allergy warnings to the recipe generator.

<Frame>
  <img src="https://mintcdn.com/promptlayer/Uwb3ZGD7ch34XkjE/new-quickstart-images/ai-prompt-writer-zoomed.png?fit=max&auto=format&n=Uwb3ZGD7ch34XkjE&q=85&s=c064bd7d0af96a73a21845d129cd10a9" alt="AI prompt writer" width="1430" height="1004" data-path="new-quickstart-images/ai-prompt-writer-zoomed.png" />
</Frame>

### Run your prompt

To test the prompt in the playground:

1. Click **Define input variables** in the right panel.
2. Set `cake_type` to `Chocolate Cake`.
3. Set `serving_size` to `8`.
4. Click **Run**.

<Frame>
  <img src="https://mintcdn.com/promptlayer/Uwb3ZGD7ch34XkjE/new-quickstart-images/running-in-playground.gif?s=ed164d69a23135b28ff76f7bd8f425ea" alt="Running a prompt in the playground" width="800" height="453" data-path="new-quickstart-images/running-in-playground.gif" />
</Frame>

When the response looks right, click **Save Template**.

### View logs

Open **Logs** in PromptLayer and search for `cake-recipe`. The log should show the input variables, generated output, model, and latency.

<Frame>
  <img src="https://mintcdn.com/promptlayer/2Nw4D0YQ3AERsqEA/new-quickstart-images/request-log.png?fit=max&auto=format&n=2Nw4D0YQ3AERsqEA&q=85&s=c5117daff77c9f9be39e854f409a696e" alt="Log from prompt run" width="2620" height="1266" data-path="new-quickstart-images/request-log.png" />
</Frame>

### Run from code

To run the prompt from code, make sure you have:

* A PromptLayer API key from your workspace
* A provider API key for the model you plan to use, such as `OPENAI_API_KEY`

Set your API keys as environment variables before running the example.

```bash theme={null}
export PROMPTLAYER_API_KEY="pl_your_promptlayer_api_key"
export OPENAI_API_KEY="sk_your_provider_api_key"
```

Install the PromptLayer SDK for your runtime.

<CodeGroup>
  ```bash Python theme={null}
  pip install promptlayer
  ```

  ```bash JavaScript theme={null}
  npm install promptlayer
  ```
</CodeGroup>

Run the saved prompt with the same input variables.

<CodeGroup>
  ```python Python theme={null}
  from promptlayer import PromptLayer

  client = PromptLayer()

  response = client.run(
      prompt_name="cake-recipe",
      input_variables={
          "cake_type": "Chocolate Cake",
          "serving_size": "8"
      },
      tags=["quickstart"],
      metadata={"source": "quickstart"}
  )

  print(response["prompt_blueprint"]["prompt_template"]["messages"][-1]["content"])
  ```

  ```javascript JavaScript theme={null}
  import { PromptLayer } from "promptlayer";

  const client = new PromptLayer({
    apiKey: process.env.PROMPTLAYER_API_KEY,
  });

  const response = await client.run({
    promptName: "cake-recipe",
    inputVariables: {
      cake_type: "Chocolate Cake",
      serving_size: "8",
    },
    tags: ["quickstart"],
    metadata: { source: "quickstart" },
  });

  console.log(response.prompt_blueprint.prompt_template.messages.slice(-1)[0].content);
  ```
</CodeGroup>

## Evaluate a prompt

Before deploying a prompt, you want to know if it is actually good. PromptLayer lets you build evaluation pipelines that score your prompt's outputs automatically.

### Create a dataset

Evaluations run against a dataset: a collection of test cases with inputs and expected outputs. Create one for the cake recipe prompt.

Click **New** -> **Dataset** and name it `cake-recipes-test`.

<Frame>
  <img src="https://mintcdn.com/promptlayer/2Nw4D0YQ3AERsqEA/new-quickstart-images/creating-dataset.png?fit=max&auto=format&n=2Nw4D0YQ3AERsqEA&q=85&s=f25ab2f03a4d257e3f08c42e15217fde" alt="Creating a dataset" width="2634" height="1512" data-path="new-quickstart-images/creating-dataset.png" />
</Frame>

Add a few test cases. Each row needs the input variables your prompt expects, `cake_type` and `serving_size`, plus an optional expected output to compare against.

<Accordion title="Sample CSV for cake recipe dataset">
  ```csv theme={null}
  cake_type,serving_size,expected_output
  Chocolate Cake,8,"Should include cocoa or chocolate, have clear measurements"
  Vanilla Birthday Cake,12,"Should be festive, mention frosting options"
  Gluten-Free Lemon Cake,6,"Must not include wheat flour, should use alternatives"
  Vegan Carrot Cake,10,"No eggs or dairy, should suggest substitutes"
  ```

  <a href="/onboarding-guides/example-dataset/cake-recipes.csv" download>Download this CSV</a> or add rows manually in the UI.
</Accordion>

Learn more about [datasets](/features/evaluations/datasets-overview).

### Create an eval pipeline

Now build a pipeline that runs your prompt against each test case and scores the results.

Click **New** -> **Evaluation** and select your dataset.

First, add a **Prompt Template** column. This runs your prompt against each row in the dataset, using the column values as input variables. The output appears in a new column.

Next, add an **LLM-as-judge** scoring column. This uses AI to score each output against criteria you define. For the recipe prompt, check whether:

* The recipe includes the required sections: Overview, Ingredients, Instructions, and Variations
* Measurements are provided in both metric and US units
* The serving size is correct

<Frame>
  <img src="https://mintcdn.com/promptlayer/2Nw4D0YQ3AERsqEA/new-quickstart-images/llm_assertion_config.png?fit=max&auto=format&n=2Nw4D0YQ3AERsqEA&q=85&s=bdecef2c970e8dcea390e6e1032ec713" alt="LLM as judge" width="1656" height="878" data-path="new-quickstart-images/llm_assertion_config.png" />
</Frame>

You can also add an **Equality Comparison** column to compare the prompt output against the `expected_output` column in your dataset.

<Frame>
  <img src="https://mintcdn.com/promptlayer/2Nw4D0YQ3AERsqEA/new-quickstart-images/eval-pipeline.png?fit=max&auto=format&n=2Nw4D0YQ3AERsqEA&q=85&s=eed60b03742320f061499f0fc8e0a7bd" alt="Eval pipeline setup" width="2488" height="1314" data-path="new-quickstart-images/eval-pipeline.png" />
</Frame>

Run the evaluation to see scores across all test cases. Learn more about [evaluations](/features/evaluations/overview).

<Accordion title="Other evaluation types">
  Beyond LLM-as-judge, PromptLayer supports:

  * **Human grading**: Collect scores from domain experts
  * **Equality Comparison**: Compare outputs to expected results
  * **Cosine similarity**: Measure semantic similarity between outputs
  * **Code evaluators**: Write custom Python scoring functions

  Workflow nodes work the same way in eval pipelines.
</Accordion>

### CI/CD evaluations

Attach an evaluation pipeline to run automatically every time you save a new prompt version, similar to GitHub Actions running tests on each commit.

When saving a prompt, the commit dialog lets you select an evaluation pipeline. Choose one and click **Next**.

From then on, each new version you create will run through the eval and show its score in the version history. This makes it easier to spot regressions before they reach production.

<Frame>
  <img src="https://mintcdn.com/promptlayer/2Nw4D0YQ3AERsqEA/new-quickstart-images/ci-cd-scores.png?fit=max&auto=format&n=2Nw4D0YQ3AERsqEA&q=85&s=4bdb7f891c07768c7c0fc41157030456" alt="Eval scores by version" width="1320" height="1152" data-path="new-quickstart-images/ci-cd-scores.png" />
</Frame>

Learn more about [continuous integration](/features/evaluations/continuous-integration).

## Learn more

* [Release Labels](/features/prompt-registry/release-labels) - Deploy the right prompt version without code changes
* [Evaluations](/features/evaluations/overview) - Learn how evaluation pipelines work
* [Deployment strategies](/onboarding-guides/deployment-strategies) - Choose a production integration pattern
