---
title: Observability and tracing for Dify
sidebarTitle: Dify
logo: /images/integrations/dify_icon.svg
logoAppearance: dark
description: Open source observability and prompt management for Dify applications. Automatically capture detailed traces and metrics for every request.
---

# Dify - Observability & Metrics for Your LLM Apps

**Dify** ([GitHub](https://github.com/langgenius/dify)) is an open-source LLM app development platform which is natively integrated with Langfuse. With the native integration, you can use Dify to quickly create complex LLM applications and then use Langfuse to monitor and improve them.

## Setup

1. Create project in Langfuse and get API credentials in project settings.
1. In Dify: Navigate to `Monitoring` settings of you Dify app.
1. Add Langfuse via `Third-party LLMOps provider` menu.
1. Invoke Dify application via UI or API to start capturing traces and metrics in Langfuse.

## Mapping of Dify to Langfuse

The integration automatically maps the following fields from Dify to Langfuse:

| Dify                                                                                                        | Langfuse                                     |
| ----------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
| `user`                                                                                                      | [`userId`](/docs/tracing/users)              |
| [`message_id`](https://docs.dify.ai/api-reference/completion/create-completion-message#response-message-id) | [`trace_id`](/docs/observability/data-model) |
| `conversation_id`                                                                                           | [`sessionId`](/docs/tracing/sessions)        |
|                                                                                                             | `trace.name`                                 |
| type of application, type of model                                                                          | [`tags`](/docs/tracing/tags)                 |

## Langfuse Prompt Management

The [Langfuse Prompt Management Plugin](https://github.com/gao-ai-com/dify-plugin-langfuse) (community maintained) lets you use prompts that are managed and versioned in Langfuse in your Dify applications, enhancing your LLM application development workflow. Key features include:

- **Get Prompt:** Fetch specific prompts managed in Langfuse.
- **Search Prompts:** Search for prompts in Langfuse using various filters.
- **Update Prompt:** Create new versions of prompts in Langfuse and set tags/labels.

This integration streamlines the process of managing and versioning your prompts, contributing to more efficient development and iteration cycles. You can find the plugin and installation instructions [here](https://github.com/gao-ai-com/dify-plugin-langfuse).

## About Dify

> Source: [Dify Readme](https://github.com/langgenius/dify)

Dify is an open-source LLM app development platform. Its intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production. Here's a list of the core features:

1. **Workflow**: Build and test powerful AI workflows on a visual canvas, leveraging all the following features and beyond.

2. **Comprehensive model support**: Seamless integration with hundreds of proprietary / open-source LLMs from dozens of inference providers and self-hosted solutions, covering GPT, Mistral, Llama3, and any OpenAI API-compatible models. A full list of supported model providers can be found [here](https://docs.dify.ai/getting-started/readme/model-providers).

3. **Prompt IDE**: Intuitive interface for crafting prompts, comparing model performance, and adding additional features such as text-to-speech to a chat-based app.

4. **RAG Pipeline**: Extensive RAG capabilities that cover everything from document ingestion to retrieval, with out-of-box support for text extraction from PDFs, PPTs, and other common document formats.

5. **Agent capabilities**: You can define agents based on LLM Function Calling or ReAct, and add pre-built or custom tools for the agent. Dify provides 50+ built-in tools for AI agents, such as Google Search, DELL·E, Stable Diffusion and WolframAlpha.

6. **LLMOps**: Monitor and analyze application logs and performance over time. You could continuously improve prompts, datasets, and models based on production data and annotations.

7. **Backend-as-a-Service**: All of Dify's offerings come with corresponding APIs, so you could effortlessly integrate Dify into your own business logic.

## 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/integrations/no-code/dify.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>.
