How arafa1974/dify works
Dify is an LLM application development platform: users configure apps and workflows, connect models and knowledge sources, then run them through chat, API, or workflow interfaces. Its major product areas include workflow and agent execution, prompt/model configuration, RAG ingestion and retrieval, and operational integrations. The graph combines README-documented capabilities with relationships visible in sampled source and the source index; unsampled implementation details are represented only where the tree supports a subsystem path.
Main entry points: advanced_chat/generate_task_pipeline.py Chat and agent runtime · app App builder · workflow/generate_task_pipeline.py Workflow runtime · rag_pipeline_run_task.py RAG pipeline tasks
Components 19
App authoring
- App builder
api/controllers/console/app - Workflow authoring
api/controllers/console/app/workflow.py - Prompt and models
api/core/app/app_config
App runtime
- Chat and agent runtime
api/core/app/apps/advanced_chat/generate_task_pipeline.py - Workflow runtime
api/core/app/apps/workflow/generate_task_pipeline.py - Invocation context
api/core/app/entities/app_invoke_entities.py - Run event queue
api/core/app/apps/pipeline/pipeline_queue_manager.py
Knowledge and RAG
- Knowledge management
api/controllers/console/datasets - RAG pipeline
api/services/rag_pipeline/rag_pipeline.py - RAG pipeline tasks
api/tasks/rag_pipeline/rag_pipeline_run_task.py - Knowledge retrieval
api/core/rag/datasource/retrieval_service.py - Dataset records
api/models/dataset.py
Platform services
- App definitions
api/services/app_definition_query_service.py - Definition repository
api/repositories/app_definition_query_repository.py - Model providers
api/controllers/console/workspace/model_providers.py - File storage
api/extensions/ext_storage.py - Observability
api/configs/observability/otel/otel_config.py
Other components
- App creator or user
- Model inference service
Connections 20
- App creator or user → App builder: configures apps
README.md - App builder → Workflow authoring: edits workflows
README.md - App builder → Prompt and models: configures prompts
README.md - Workflow authoring → App definitions: publishes definitions
- App definitions → Definition repository: queries definitions
api/repositories/app_definition_query_repository.py - App creator or user → Chat and agent runtime: runs app
README.md - App creator or user → Workflow runtime: runs workflow
README.md - Chat and agent runtime → Invocation context: uses context
api/core/app/entities/app_invoke_entities.py - Workflow runtime → Invocation context: uses context
api/core/app/entities/app_invoke_entities.py - Workflow runtime → Run event queue: publishes events
api/core/app/apps/pipeline/pipeline_queue_manager.py - Prompt and models → Model providers: selects models
- Chat and agent runtime → Model inference service: requests inference
- App creator or user → Knowledge management: manages sources
README.md - Knowledge management → RAG pipeline: configures ingestion
api/controllers/console/datasets/rag_pipeline/rag_pipeline_workflow.py - RAG pipeline → RAG pipeline tasks: schedules runs
api/tasks/rag_pipeline/rag_pipeline_run_task.py - RAG pipeline tasks → Knowledge retrieval: uses retrieval
- Knowledge retrieval → Dataset records: reads datasets
api/core/rag/datasource/retrieval_service.py - RAG pipeline tasks → File storage: uses file storage
- Chat and agent runtime → Knowledge retrieval: retrieves knowledge
- App creator or user → Observability: views operations