Introduction to Dify

What is Dify?

Dify is an open-source platform for building LLM applications, maintained by LangGenius. In Studio you drag-and-drop agents, agentic workflows, and chatbots grounded on your own data, then publish them as a web app or a REST API (and, if you want, as an MCP server).

Official one-liner: build AI apps on your data, then put them in users' hands. The name Dify comes from Do It For You.

┌─────────────────────────────────────────────────────────────┐
│                      Dify platform                           │
└─────────────────────────────────────────────────────────────┘
   Model providers   Knowledge (RAG)     Studio
   OpenAI /          chunk · embed        Chatbot / Agent
   DeepSeek /        hybrid retrieve      Workflow / Chatflow
   Ollama …          citations
         │                 │                    │
         └─────────────────┴─────────┬──────────┘

                      Web App  ·  REST API  ·  MCP

App types (official picture)

When you create an app, current docs recommend Workflow or Chatflow (visual graph, reusable nodes). Three simpler “basic” types still exist:

TypeInteractionTypical use
ChatbotMulti-turn chatPrompt + optional knowledge Q&A
AgentMulti-turn + autonomyModel picks tools and plans steps
WorkflowSingle runBatch jobs, fixed pipelines, schedule/webhook
ChatflowOne graph per chat turnChat UI + structured orchestration
Text GeneratorOne-shotSummaries, forms, one-off copy

This tutorial goes Chatbot → knowledge → workflow → agent, the visual twin of the code path in the LangChain tutorial.


Dify vs LangChain vs Coze

All three combine models, tools, and knowledge. The split is who writes the orchestration, where data lives, and whether you can self-host.

DifyLangChainCoze (扣子)
ShapeVisual studio + self-hostable platformPython / JS code frameworkCloud visual bot platform
On-rampNodes, little codecreate_agent, you own depsBrowser-first, ByteDance ecosystem
RAGUpload, chunk, embeddings, hybrid searchLoaders / splitters / vector storesBuilt-in knowledge, similar flow
AgentTools + Function Calling / ReActTools + middleware in codePlugins / workflows
PublishWeb App, /v1/chat-messages, MCPYou write the service and authHosted publish + channels
Self-hostCommunity Edition (Docker Compose)Framework is open; no full studio boxMostly cloud

When to pick which:

  • Ship a knowledge-grounded assistant in days, and let non-engineers edit prompts → Dify
  • Fine-grained state, tests, deep Python integration → LangChain (same RAG / agent loop)
  • Stay inside a China-cloud bot ecosystem and channels → evaluate Coze; keep data on-prem → self-host Dify

They compose: Dify orchestrates and publishes; an HTTP or code node can call your LangChain service.


Good fit / caveats

Good fit: internal FAQ and policy Q&A (knowledge + citations); fixed classify/generate pipelines (Workflow / Chatflow); tool-using assistants (Agent); one app for both browser users and backends (Web App + API).

Watch out: very complex typed state machines belong in LangChain / LangGraph; ultra-low latency pays a studio/sandbox tax; self-host needs CPU/RAM/disk and real volumes backups (see Installation).


How you run it

OptionNotes
Dify CloudManaged platform, free Sandbox, no install
Community EditionOpen-source self-host; official path is Docker Compose

Repo: github.com/langgenius/dify. Pair local models with the Ollama tutorial. To expose a Dify app to an IDE, see the MCP tutorial.

A workspace is the unit of sharing: models, knowledge, and apps live together. Only Owner / Admin can add provider keys; everyone else consumes whatever is already configured. Export DSL (YAML) when you copy an app between instances, and keep secrets in environment variables so the file stays safe to share.


Next steps

评论