This page defines key terms, jargon, abbreviations, and domain concepts specific to the Dify codebase. Understanding these terms is crucial for onboarding engineers to quickly grasp the system's architecture, data models, APIs, and operational workflows.
A Tenant represents a workspace or organization within Dify. It acts as a logical isolation boundary for resources such as applications, datasets, and models. Each tenant has its own users, configurations, and data partitions to ensure multi-tenancy isolation.
Implementation Highlights:
App, Dataset, and Workflow.Code Pointers:
An App is a deployable AI application in Dify, such as a chatbot or completion app. Apps are owned by tenants and support multiple execution modes (Chat, Completion, Workflow, Agent-Chat, Agent).
Implementation Highlights:
Code Pointers:
A Dataset in Dify represents a collection of documents or knowledge sources for Retrieval-Augmented Generation (RAG). It is specific to a tenant and configurable on indexing, retrieval, metadata filtering, and runtime modes.
Implementation Highlights:
Code Pointers:
A Document is a single unit of content inside a Dataset. Examples include text files, webpages, or Notion pages. Documents are processed (parsed, cleaned, segmented) before indexing.
Implementation Highlights:
Code Pointers:
A Workflow is a graph-based AI execution flow in Dify. It is composed of nodes that perform operations such as calling LLMs, HTTP requests, code execution, or retrieving knowledge.
Implementation Highlights:
WORKFLOW, CHAT, RAG_PIPELINE.Code Pointers:
DatasetRetrieval is the core class orchestrating retrieval operations across one or multiple datasets. It handles filtering, reranking, and integrating multiple indexing backends (vector DBs).
Implementation Highlights:
Sources: `api/core/rag/retrieval/dataset_retrieval.py119-157 `api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py1-50 `api/core/rag/datasource/vdb/vector_factory.py1-50
A DocumentSegment is a chunk of a document generated during segmentation in indexing. These segments are indexed and used as retrieval units in RAG.
Implementation Highlights:
Code Pointers:
The ModelManager is the centralized interface for obtaining model instances for invocation and managing provider configurations.
Implementation Highlights:
Code Pointers:
The ProviderManager governs loading, configuring, and lifecycle of LLM providers. It creates ProviderConfiguration capturing credentials, endpoints, and runtime params.
Implementation Highlights:
Code Pointers:
Sources: `api/core/model_manager.py28-30 `api/core/rag/retrieval/dataset_retrieval.py102-118 `api/models/model.py227-231
The ToolManager is the registry and controller manager for all tools in Dify. It exposes APIs to get built-in, API-based, and plugin tools, managing credentials and runtime creation.
Implementation Highlights:
Code Pointers:
Controllers implement logic for managing and invoking tools depending on their provider type (builtin, API, plugin daemon).
Implementation Highlights:
Code Pointers:
TenantAccountRole is an enum defining user roles within a tenant workspace. Roles like OWNER, ADMIN, EDITOR control permissions and access rights.
Implementation Highlights:
Code Pointers:
An enum to specify dataset access control, defining who can view or modify datasets (only me, public, etc).
Code Pointers:
The MODE environment variable controls the container entrypoint mode in API service:
api to run the main web server.worker to run celery background workers.beat to run celery beat scheduler.job for one-off tasks or adhoc background jobs.Code Pointers:
Dify supports over 23 vector databases such as Weaviate, Qdrant, Milvus, PGVector etc. These are integrated via the VectorFactory abstraction allowing pluggable vector search backend switching.
Code Pointers:
An Agent is an AI entity capable of reasoning, planning, and executing tasks using tools, models, and knowledge. Agents power complex conversational workflows or autonomous actions.
Code Pointers:
A Pydantic model representing the core configuration ("soul") of an Agent. It specifies the AI model, prompts, tools, knowledge base, and memory configuration defining agent behavior.
Code Pointers:
A snapshot version of an AgentSoulConfig saved at a point in time, enabling snapshot-based stable agent configurations.
Code Pointers:
A draft version of an agent config for editing and iterative development before publishing as a snapshot.
Code Pointers:
Service managing creation, editing, validation, and saving of agent configurations for both roster agents and workflow-embedded inline agents.
Code Pointers:
Service managing lifecycle of "roster" agents — standalone reusable agents across apps/workflows, including CRUD and publishing workflows.
Code Pointers:
Represents agent configuration binding in workflows, either as a reference to a roster agent or inline direct agent config.
Code Pointers:
Sources: `api/services/agent/composer_service.py1-50 `api/services/agent/roster_service.py1-50 `api/models/agent.py100-160 `api/models/workflow.py176-210 `api/models/model.py300
A standalone FastAPI-based runtime service built on the Agenton framework. It executes Pydantic-modeled AI agents behind a REST API.
Code Pointers:
uv.lock: `api/uv.lock12-13A state management and data fetching solution used in the Dify web frontend. Combines Jotai atoms and TanStack Query.
Code Pointers:
A shared React component library used across Dify frontend projects.
Code Pointers:
Sources:
`api/models/model.py1-248
`api/models/workflow.py1-210
`api/models/account.py1-100
`api/core/rag/retrieval/dataset_retrieval.py102-157
`docker/docker-compose.yaml1-206
`api/pyproject.toml1-100
`api/.env.example1-211
`web/package.json1-200
`api/models/dataset.py1-320
`api/services/entities/agent_entities.py100
`api/tests/unit_tests/services/agent/test_agent_services.py102-156
`api/services/agent/agent_soul_state.py1-50
`api/models/agent.py100-160
`api/services/agent/roster_service.py1-50
`api/services/agent/composer_service.py1-50
Refresh this wiki
This wiki was recently refreshed. Please wait 6 days to refresh again.