Dify is an open-source platform for building applications on large language models, combining a visual workflow editor, retrieval-augmented generation, agent tooling, prompt management and a ready-made API in a single self-hostable stack. Within AI frameworks & tools, it occupies the space between code-first libraries and finished chat products: teams assemble an application in a browser, then publish it as a web app or call it as a backend-as-a-service endpoint.
The project is developed by LangGenius and sits in the LLMOps category of artificial intelligence tooling. Unlike LangChain or LlamaIndex, which are programming libraries, Dify is a complete running service with its own database, user management, logs and model configuration, so the unit of work is a deployed application rather than a Python script.
How the Dify platform is built
Dify runs as a set of cooperating services rather than a single process. A Python API server handles application logic, a Next.js web console provides the editor, and Celery workers process slow jobs such as document indexing. PostgreSQL stores applications, users and logs, Redis serves as cache and message broker, and a separate vector database holds embeddings for retrieval.
Code written by users runs in an isolated sandbox service, which limits system calls and network access so that a faulty or malicious code node cannot reach the host. Since version 1.0, model providers and tools are delivered as plugins that run in their own runtime, which decouples the core release cycle from the growing list of integrations.
The table below summarizes the main components of a typical self-hosted deployment and the role each one plays.
| Component | Typical technology | Role |
|---|---|---|
| API server | Python, Flask | Runs applications, workflows and the public API |
| Web console | Next.js | Visual editor, settings, logs and annotation |
| Worker | Celery | Document parsing, embedding and background jobs |
| Metadata store | PostgreSQL | Applications, accounts, conversations and traces |
| Vector store | Weaviate, Qdrant, Milvus or pgvector | Embeddings for knowledge retrieval |
| Sandbox | Isolated code runner | Executes Python and JavaScript code nodes safely |
| Plugin daemon | Separate runtime | Hosts model providers, tools and extensions |
Application types and workflow nodes
Every Dify project starts by choosing an application type, which determines the interface and execution model. Conversational types keep session memory between turns, while the workflow type runs a single batch-style execution from inputs to outputs and suits automation, document processing and scheduled jobs.
| Application type | Interaction model | Typical use |
|---|---|---|
| Chatbot | Multi-turn chat with one prompt | Simple assistants and FAQ bots |
| Text generator | Single input, single completion | Summaries, translations, copywriting |
| Agent | Chat with autonomous tool calls | Research and multi-step lookups |
| Chatflow | Multi-turn chat driven by a graph | Support bots with routing and retrieval |
| Workflow | Single run of a node graph | Batch processing and system integrations |
Chatflow and workflow applications are built from nodes connected on a canvas. Data passes between nodes as typed variables, and each node can reference outputs of any earlier node. Important node types include:
- LLM node: sends a prompt with variables to a configured model and returns text or structured output.
- Knowledge retrieval node: queries one or more knowledge bases and returns ranked chunks.
- Question classifier and IF/ELSE nodes: route execution by intent or by explicit conditions.
- Code, template and HTTP request nodes: transform data and call external services.
- Iteration and loop nodes: repeat a subgraph over a list or until a condition holds.
- Agent and tool nodes: invoke plugins, MCP servers or custom OpenAPI tools.
Knowledge bases and retrieval in Dify
The Knowledge module is the built-in RAG pipeline of Dify. Uploaded documents are parsed, split into chunks by configurable separators and length limits, embedded with a chosen model and stored in the vector database. A parent-child chunking mode retrieves small precise chunks but passes their larger parent section to the model, which preserves context without diluting the search.
Indexing quality and retrieval strategy are separate decisions. The high-quality index uses embeddings and supports semantic search, while the economical index builds a keyword index without embedding costs. Retrieval settings then control how candidates are selected and ranked.
| Setting | What it does | When it helps |
|---|---|---|
| Vector search | Ranks chunks by embedding similarity | Paraphrased or conceptual questions |
| Full-text search | Matches exact terms and keywords | Product codes, names and identifiers |
| Hybrid search | Combines both candidate lists | Mixed corpora with varied queries |
| Rerank model | Rescores candidates with a cross-encoder | Long documents with many near matches |
| Top K and score threshold | Limit how many chunks reach the prompt | Controlling token cost and noise |
Retrieval quality depends far more on document preparation and chunk design than on the choice of vector store. Scanned PDFs, tables split across chunks and duplicated pages are the most common reasons for weak answers, and the retrieval test screen in the console is the fastest way to diagnose them.
Dify compared with code-first frameworks
Dify is best understood as a low-code orchestration platform, and it overlaps only partly with neighboring tools in the same Topic. The comparison below shows where the boundaries lie.
| Tool | Primary form | Main strength | Main limitation |
|---|---|---|---|
| Dify | Self-hosted platform with visual editor | Fast delivery with built-in API, logs and RAG | Less control over low-level logic |
| LangChain | Python and JavaScript library | Fine-grained composition in code | Operations and UI must be built separately |
| LangGraph | Graph-based agent library | Stateful, durable agent control flow | Requires engineering effort for every app |
| Open WebUI | Chat interface for models | Polished end-user chat experience | Limited workflow and API publishing |
| Langfuse | Observability service | Deep tracing and evaluation | Does not build or run applications |
In practice these tools are often combined. A team may prototype in Dify, export traces to an observability service such as Langfuse or LangSmith, and later rewrite performance-critical paths in code once requirements stabilize. Dify can also import and export applications as DSL files in YAML, which allows versioning in Git even though editing happens visually.
Deployment, licensing and operations
Dify is available as a managed cloud service and as a self-hosted edition that most teams start with Docker Compose and later move to Kubernetes. Self-hosting keeps prompts, documents and conversation logs inside the organization, which is often the decisive reason to choose it for regulated data.
The source code is published under the Dify Open Source License, which is based on Apache 2.0 but adds conditions. It restricts operating Dify as a multi-tenant service for third parties without a commercial license and forbids removing the Dify branding from the console. Legal review is therefore advisable before embedding it in a resold product.
Operational responsibilities do not disappear with a visual tool. Teams still need to manage model API keys, rate limits, backups of PostgreSQL and the vector store, upgrades between versions and monitoring of worker queues.
Limitations and common mistakes
Most problems with Dify come from treating a visual canvas as a substitute for software engineering. The table below lists frequent symptoms and their usual causes.
| Symptom | Likely cause | Remedy |
|---|---|---|
| Irrelevant answers from knowledge | Poor chunking or no reranking | Tune chunk size, enable hybrid search and rerank |
| Slow document indexing | Too few workers or large scans | Scale Celery workers and preprocess files |
| Unmaintainable canvas | Hundreds of nodes in one workflow | Split into smaller workflows called as tools |
| Breaking changes after upgrade | Skipped versions and no backup | Upgrade step by step after a database backup |
| Uncontrolled token spending | High top K and long memory windows | Lower limits and monitor usage per application |
A further limitation is testing. Workflows can be run node by node in the console, but systematic regression testing of prompts and branches requires external evaluation tooling, so quality assurance should be planned before an application reaches production users.
A plain-language summary
Dify is a workshop for building AI helpers. You connect a language model, add your own documents and draw the steps on a screen. No large program has to be written. When the helper works, Dify gives it a web page and an address that other software can call.
Think of it as building blocks for AI applications. One block asks the model a question. Another block searches your files. A third block decides which path to follow. You can run it on your own servers, so your data stays with you.
An example from practice
A mid-sized insurance company wants an internal assistant that answers claims handlers’ questions about policy conditions. The IT team installs the self-hosted edition with Docker Compose on a company server, connects an approved language model through its API and uploads about 2,000 pages of policy documents into a knowledge base with hybrid search and reranking.
They build a chatflow in which a question classifier separates policy questions from requests about claim status. Policy questions go to knowledge retrieval and an LLM node that must cite the clause it used, while status questions trigger an HTTP request node that queries the claims system. After two weeks of testing with ten handlers and adjusting chunk sizes, the assistant is published inside the intranet, and all prompts and logs remain on company infrastructure for compliance review.