---
title: How to manage different environments in Langfuse?
description: Learn how to separate production, staging, and development in Langfuse using built-in environments or separate projects, including how to sync prompts and configurations.
tags: [platform, self-hosting, cloud, observability, administration]
---

# How to manage different environments in Langfuse?

Langfuse offers two approaches to manage environments like production, staging, and development: built-in environments or separate projects.

## Which Approach Should I Use?

Use the **built-in Environments feature** if your team can share access across all environments. This is the recommended approach because prompts, datasets, evaluators, and other configurations are automatically shared within the project, eliminating the need to sync anything between environments.

Use **separate projects** if you need different access controls per environment, such as restricting production data to a smaller group of team members. This requires additional setup to sync prompts and configurations between projects, but provides full isolation.

## Environments (Recommended)

The recommended approach for managing different environments in Langfuse is to use the built-in [Environments](/docs/observability/features/environments) feature. This allows you to organize your traces, observations, and scores from different contexts such as production, staging, or development within the same project.

You can configure the environment by setting the `LANGFUSE_TRACING_ENVIRONMENT` environment variable or by using the `environment` parameter in the client initialization.
In the Python SDK, use `propagate_attributes(environment="...", as_baggage=True)` when a shared service, such as an LLM proxy, should inherit the caller's environment per request.

## Separate Projects

If you need to specify different [role-based access controls](/docs/rbac) for each environment, consider using separate projects for each environment. You can still group all environments within the same organization to simplify access management. Each project will have its own set of members, prompts, and API keys.

### Syncing Prompts Between Projects

When using separate projects for each environment, prompts and other configurations are not automatically shared. You have two options to keep them in sync.

The [GitHub Integration](/docs/prompt-management/features/github-integration) allows you to store prompts in a repository and automatically deploy them to different Langfuse projects. This enables a CI/CD workflow where prompts are version-controlled and promoted from development to staging to production through your existing Git workflow.

For custom workflows, you can use the [Prompt Management API](/docs/prompt-management) to programmatically read prompts from one project and write them to another. This is useful if you want to build your own promotion scripts or integrate with internal tooling.

<!-- 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/faq/all/managing-different-environments.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>.
