---
title: Playground
seoTitle: "LLM Playground"
description: Test, iterate, and compare different prompts and models within the LLM Playground.
sidebarTitle: Playground
---

# LLM Playground

Test and iterate on your prompts directly in the Langfuse Prompt Playground. Tweak the prompt and model parameters to see how different models respond to these input changes. This allows you to quickly iterate on your prompts and optimize them for the best results in your LLM app without having to switch between tools or use any code.

  ![Langfuse Playground comparing two executed support-prompt variants with completed model outputs](/images/docs/playground-overview.png)

## Core features

### Side-by-Side Comparison View

Compare multiple prompt variants alongside each other. Execute them all at once or focus on a single variant. Each variant keeps its own LLM settings, variables, tool definitions, and placeholders so you can immediately see the impact of every change.

_[Video: Compare prompts side by side in the playground](https://static.langfuse.com/docs-videos/playground-side-by-side-comparison.mp4): Playground with one window. Click “New split window” to copy it, open the copy's “Variables” and change language from typescript to go, then click “Run All” to run both windows at once and compare their outputs. Close the copy with “Remove window”._

### Open your prompt in the playground

You can open a prompt you created with [Langfuse Prompt Management](/docs/prompt-management/get-started) in the playground.

_[Video: Open a prompt in the playground](https://static.langfuse.com/docs-videos/playground-open-prompt.mp4): Prompts > movie-critic, version 3. Click “Playground” > “Fresh playground”, fill the variables criticlevel (expert) and movie (Dune: Part Two) in the Variables panel and click “Submit” to get the model's answer in Output._

### Save your prompt to Prompt Management

When you're satisfied with your prompt, you can save it to Prompt Management by clicking the save button.

_[Video: Save a playground prompt to Prompt Management](https://static.langfuse.com/docs-videos/playground-save-prompt.mp4): Playground with a chat prompt. Click “Save as prompt” in the window header > “Save as new prompt”. The new-prompt form opens with the playground's messages; enter the name movie-critic-chat, keep “Set the production label” checked and click “Create prompt”. It lands on version 1 with the production and latest labels._

### Open a generation in the playground

You can open a generation from [Langfuse Observability](/docs/observability) in the playground: select the generation in a trace, then choose **Add to** → **Playground** → **Fresh playground**. The playground opens with the generation's messages and model settings.

_[Video: Open a generation in the playground](https://static.langfuse.com/docs-videos/playground-open-generation.mp4): Trace detail with a qa-answer generation selected. Click “Add to” in the observation header > “Playground” > “Fresh playground”; the playground opens with the generation's system and user messages and model settings. Click “Submit” to rerun it._

### Tool calling and structured outputs

The Langfuse Playground supports tool calling and structured output schemas, enabling you to define, test, and validate LLM executions that rely on tool calls and enforce specific response formats.

  Currently, Langfuse supports opening tool-type observations in the playground
  only when they are in the OpenAI ChatML format. If you’d like to see support
  for additional formats, feel free to add your request to our [public
  roadmap](https://langfuse.com/ideas).

_[Video: Call a tool from the playground](https://static.langfuse.com/docs-videos/playground-tool-calling.mp4): Playground with a support system message and a customer question. Open “Tools” > “Create new tool”, define get_order_status with a description and a JSON schema for order_id, and save it; the tool is attached to the window. Click “Submit”: the Output shows the tool call with order_id A-21007._

**Tool Calling**

- Define custom tools with JSON schema definitions
- Test prompts relying on tools in real-time by mocking tool responses
- Save tool definitions to your project

**Structured Output**

- Enforce response formats using JSON schemas
- Save schemas to your project
- Jump into the playground from your OpenAI generation using structured output

### Add prompt variables

You can add prompt variables in the playground to simulate different inputs to your prompt.

  ![Playground variables panel with context and customer-question values for a support prompt](/images/docs/playground-variables.png)

### Use your favorite model

You can use your favorite model by adding the API key for the model you want to use in the Langfuse project settings. Learn how to [set up an LLM connection](/docs/administration/llm-connection).

  ![Playground model advanced settings for temperature, output token limit, Top P, and additional provider options](/images/docs/playground-model-selection.png)

Optionally, many LLM providers allow for additional parameters when invoking a model. You can pass these parameters in the playground when toggling "Additional Options" in the model selection dropdown. [Read this documentation about additional provider options](/docs/administration/llm-connection#advanced-configurations) for more information.

## Related Resources

- For structured regression testing of prompt and model variants on datasets, use [Experiments](/docs/evaluation/core-concepts#experiments).

## GitHub Discussions

<!-- agent-instructions -->

---

## Agent Instructions

This page is part of the [Langfuse](https://langfuse.com) documentation, published as plain Markdown for AI agents. Every page is available as Markdown by appending `.md` to its URL, or by sending an `Accept: text/markdown` header. This page: `https://langfuse.com/docs/prompt-management/features/playground.md`.

### Querying these docs

If the answer is not on this page, query the documentation instead of guessing:

- **Semantic search** across all Langfuse docs, returning an answer with the relevant pages and excerpts. Ask a specific, self-contained question:

  ```bash
  curl -sG "https://langfuse.com/api/search-docs" --data-urlencode "query=How do I trace a LangGraph agent?"
  ```

- **Index of every page**: <https://langfuse.com/llms.txt>, with per-section indexes [llms-docs.txt](https://langfuse.com/llms-docs.txt), [llms-integrations.txt](https://langfuse.com/llms-integrations.txt), and [llms-self-hosting.txt](https://langfuse.com/llms-self-hosting.txt).

### Before writing Langfuse code

- **Install the [Langfuse Agent Skill](https://langfuse.com/docs/api-and-data-platform/features/agent-skill).** It encodes Langfuse's own best practices for instrumentation, prompt management, and evaluation, and materially improves results.
- **Read [What does a good trace look like?](https://langfuse.com/docs/observability/best-practices.md)** before instrumenting an application.
- **Verify endpoints, parameters, and response fields** against the [API reference](https://api.reference.langfuse.com) instead of inferring them from code examples.
- **Use the [Langfuse CLI](https://langfuse.com/docs/api-and-data-platform/features/cli)** (`npx @langfuse/cli api <resource> <action>`) to read or write traces, prompts, datasets, and scores from the terminal.

Found an error in these docs? Please open an issue at <https://github.com/langfuse/langfuse-docs/issues>.
