Dify Plugin Development Cheatsheet
A comprehensive reference guide for Dify plugin development, including environment requirements, installation methods, development process, plugin categories and types, common code snippets, and solutions to common issues. Suitable for developers to quickly consult and reference.
Environment Requirements
- Python version ≥ 3.12
- Dify plugin scaffold tool (dify-plugin-daemon)
Learn more: Initializing Development Tools
Obtaining the Dify Plugin Development Package
Installation Methods for Different Platforms
macOS Brew (Global Installation):
After installation, open a new terminal window and enter the dify version
command. If it outputs the version information, the installation was successful.
macOS ARM (M Series Chips):
macOS Intel:
Linux:
Global Installation (Recommended):
Running the Development Package
Here we use dify
as an example. If you are using a local installation method, please replace the command accordingly, for example ./dify-plugin-darwin-arm64 plugin init
.
Plugin Development Process
1. Create a New Plugin
Follow the prompts to complete the basic plugin information configuration
Learn more: Dify Plugin Development: Hello World Guide
2. Run in Development Mode
Configure the .env
file, then run the following command in the plugin directory:
Learn more: Remote Debugging Plugins
4. Packaging and Deployment
Package the plugin:
Learn more: Publishing Overview
Plugin Categories
Tool Labels
Category tag
class ToolLabelEnum(Enum)
Plugin Type Reference
Dify supports the development of various types of plugins:
- Tool plugins: Integrate third-party APIs and services
Learn more: Tool Plugin Development
- Model plugins: Integrate AI models
Learn more: Model Plugin Introduction, Quick Integration of a New Model
- Agent Strategy plugins: Customize Agent thinking and decision-making strategies
Learn more: Agent Strategy Plugins
- Extension plugins: Extend Dify platform functionality, such as Endpoints and WebAPP
Learn more: Extension Plugins