What Dify can do
Dify is an open-source platform for AI applications. In one interface you build agents, chatbots and workflows, connect documents and read the log of answers.
A workflow here means a chain of steps that you set in advance. An agent works differently: the model itself decides which step to take and which tool to call.
When you create an app, Dify asks for its type. The two main types, “Workflow” and “Chatflow”, are drawn as a diagram of blocks. Three simpler types, “Chatbot”, “Agent” and “Text Generator”, are set up with a form and no diagram.
An app of the “Agent” type is a chat where the model reasons and calls tools by itself: web search, requests to services and databases. You do not need to draw a diagram of steps for it; instructions and a list of tools are enough.
In the same interface you find the knowledge base, the conversation log and annotations. The knowledge base works by the RAG principle: before answering, the model searches for passages in your documents and answers from them, with no fine-tuning of the model.
In beta, Dify has a new type of agent with its own sandbox: it runs commands and works with files by itself. In the guide below we build the stable “Agent” app, to which the knowledge base connects directly. A similar visual builder, Flowise, is covered separately.
Installation
Dify installs on your computer or server through Docker. Docker is a program that runs an application in ready containers with all its dependencies, so you do not have to set anything up by hand.
Requirements from the documentation: at least 2 CPU cores and 4 GiB of RAM, and recent versions of Docker and Docker Compose. On a Mac, give the virtual machine at least 2 processors and 8 GiB of memory in the Docker Desktop settings. The first command needs the git, curl and jq programs.
1. Download the code of the latest Dify release with the command from the documentation: git clone --branch “$(curl -s https://api.github.com/repos/langgenius/dify/releases/latest | jq -r .tag_name)” https://github.com/langgenius/dify.git. If it gives the error “Remote branch null not found”, take the version number from the releases page: git clone --branch <version> https://github.com/langgenius/dify.git.
2. Go to the folder with the launch settings: cd dify/docker.
3. Create a settings file from the sample: cp .env.example .env.
4. Start the containers: docker compose up -d.
5. Check that everything is running: docker compose ps. Each container shows the status “Up” or “healthy”, and the init_permissions container shows “Exited”, which is how it should be.
6. Open http://localhost/install in the browser (on a server, http://server_address/install) and create an administrator account. After that you log in to Dify at http://localhost.
7. Connect a model: “Integrations” > “Model Provider”. Install a provider, press “Setup” on its card and enter the key. Dify apps do not work without at least one provider.
To keep data from going to outside services, the Dify marketplace has a verified Ollama plugin. It connects open models that run on your computer or server. In the “Model Name” field, give the model, and in “Base URL” the Ollama address that the Dify container can reach; a local installation needs no key.
The agent and the knowledge base
First you build the knowledge base, then the agent. The order from the Dify documentation:
1. Open “Knowledge” > “Create” > “Create a ready-to-use knowledge base” and upload files: procedures, the price list and answers to frequent questions.
2. Set up how the text is cut into chunks (“chunk settings”): the separator and the maximum chunk length. You cannot change the chunking mode after you create the base, but you can change the separator and the length.
3. Choose the indexing method. “High Quality” turns chunks into vectors, numeric descriptions of meaning, and searches by meaning. “Economical” takes 10 keywords per chunk and spends no tokens, but searches less accurately.
4. Wait until processing ends and test the search: the “Retrieval Testing” icon in the base’s left panel. Ask the questions your clients will ask and see which chunks it finds.
5. In the “Studio” section, create an app and choose the “Agent” type.
6. Write the instructions (prompt): who the agent is, in what format it answers, what it does not do and when it calls each tool. Name the tools in the text.
7. Add Dify tools and the knowledge base. Describe the base in detail: from the description, the model decides whether to search it for the answer to a question.
8. In “Agent Settings”, set “Maximum Iterations”: how many times the agent may repeat the loop “think, call a tool, read the result” per request. The mode is also shown there: “Function Calling” if the model can call tools by itself, or “ReAct” if Dify guides it with prompts.
9. Test the agent in the preview panel on the right and press “Publish”. A published app works as a web page, through an API or as a widget on your website.
If client data gets into the knowledge base or the conversations, 152-FZ, Russia’s personal data law, applies: the data of Russian citizens is collected and stored in databases in Russia, and a transfer abroad needs a notice to Roskomnadzor, the Russian data regulator. So with such data, Dify goes on a server in Russia with a local model. How we set this up is described on the page about data security.
Log and answer ratings
Every Dify app keeps a log on the “Logs” tab: what people asked, what the agent answered and how the answer was rated. The log includes conversations from the web page, through the API and from the app list on the home screen.
The “User Rate” column counts users’ likes and dislikes, and “Op. Rate” your team’s ratings. Open a conversation and hover over an answer: you see the tokens used, the response time and the agent’s steps with tool calls. A token is a piece of text that the model vendor charges for.
Mark a wrong answer with a dislike and a comment, or fix it at once with an annotation. An annotation is an answer you approved: when a new question is closer to a saved one than the set threshold, Dify returns your answer instead of the model’s.
Annotations are turned on in “Orchestrate” > “Add Features”, where you also set the similarity threshold. You can upload ready question-and-answer pairs as a list by a template, and the statistics show which of them fire.
By default the log is kept forever, and it holds full conversations. The Dify documentation warns about this directly: you need a data processing policy and user consent where the law requires it. Cleanup of old records is turned on with environment variables, and the default retention period is 30 days.
The log shows errors after launch. How to test an agent on a set of questions before launch, we covered in the article on agent testing.
License terms
Dify is distributed under a modified Apache 2.0 license. Apache 2.0 itself is open: you can install, change and use the code in a business. Dify directly allows commercial use, including as a base for your services and as a development platform inside the company.
The first condition: without Dify’s written permission, you may not run a multi-tenant environment on its code. One tenant, in the license’s terms, is one Dify workspace. If you want to give several clients their own workspace in one installation, like a cloud service, you need a commercial license.
The second condition: in the Dify interface you may not remove or change the logo and the copyright information in the console and the apps. The condition does not apply when you use Dify without its interface, for example only through the API.
For an agent inside your own company, neither condition usually gets in the way: one workspace, logo in place. If the agent becomes a product for your clients, check the setup with a lawyer before launch, not after.