Dify

On this page 8

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.

ComponentTypical technologyRole
API serverPython, FlaskRuns applications, workflows and the public API
Web consoleNext.jsVisual editor, settings, logs and annotation
WorkerCeleryDocument parsing, embedding and background jobs
Metadata storePostgreSQLApplications, accounts, conversations and traces
Vector storeWeaviate, Qdrant, Milvus or pgvectorEmbeddings for knowledge retrieval
SandboxIsolated code runnerExecutes Python and JavaScript code nodes safely
Plugin daemonSeparate runtimeHosts model providers, tools and extensions
Core components of a Dify deployment

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 typeInteraction modelTypical use
ChatbotMulti-turn chat with one promptSimple assistants and FAQ bots
Text generatorSingle input, single completionSummaries, translations, copywriting
AgentChat with autonomous tool callsResearch and multi-step lookups
ChatflowMulti-turn chat driven by a graphSupport bots with routing and retrieval
WorkflowSingle run of a node graphBatch processing and system integrations
Dify application types and their typical uses

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.

SettingWhat it doesWhen it helps
Vector searchRanks chunks by embedding similarityParaphrased or conceptual questions
Full-text searchMatches exact terms and keywordsProduct codes, names and identifiers
Hybrid searchCombines both candidate listsMixed corpora with varied queries
Rerank modelRescores candidates with a cross-encoderLong documents with many near matches
Top K and score thresholdLimit how many chunks reach the promptControlling token cost and noise
Retrieval settings in a Dify knowledge base

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.

ToolPrimary formMain strengthMain limitation
DifySelf-hosted platform with visual editorFast delivery with built-in API, logs and RAGLess control over low-level logic
LangChainPython and JavaScript libraryFine-grained composition in codeOperations and UI must be built separately
LangGraphGraph-based agent libraryStateful, durable agent control flowRequires engineering effort for every app
Open WebUIChat interface for modelsPolished end-user chat experienceLimited workflow and API publishing
LangfuseObservability serviceDeep tracing and evaluationDoes not build or run applications
How Dify differs from related tools

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.

SymptomLikely causeRemedy
Irrelevant answers from knowledgePoor chunking or no rerankingTune chunk size, enable hybrid search and rerank
Slow document indexingToo few workers or large scansScale Celery workers and preprocess files
Unmaintainable canvasHundreds of nodes in one workflowSplit into smaller workflows called as tools
Breaking changes after upgradeSkipped versions and no backupUpgrade step by step after a database backup
Uncontrolled token spendingHigh top K and long memory windowsLower limits and monitor usage per application
Frequent problems in Dify projects

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.