mirror of
https://github.com/langgenius/dify-plugin-daemon.git
synced 2026-07-22 17:56:00 -04:00
dbbc4a29cc
* feat: update template * feat: update ja_JP * feat: update GUIDE.md
3.6 KiB
3.6 KiB
Dify Plugin Development Guide
Welcome to Dify plugin development! This guide will help you get started quickly.
Plugin Types
Dify plugins extend three main capabilities:
| Type | Description | Example |
|---|---|---|
| Tool | Perform specific tasks | Google Search, Stable Diffusion |
| Model | AI model integrations | OpenAI, Anthropic |
| Endpoint | HTTP services | Custom APIs, integrations |
You can create:
- Tool: Tool provider with optional endpoints (e.g., Discord bot)
- Model: Model provider only
- Extension: Simple HTTP service
Setup
Requirements
- Python 3.11+
- Dependencies:
pip install -r requirements.txt
Development Process
1. Manifest Structure
Edit manifest.yaml to describe your plugin:
version: 0.1.0 # Required: Plugin version
type: plugin # Required: plugin or bundle
author: YourOrganization # Required: Organization name
label: # Required: Multi-language names
en_US: Plugin Name
zh_Hans: 插件名称
created_at: 2023-01-01T00:00:00Z # Required: Creation time (RFC3339)
icon: assets/icon.png # Required: Icon path
# Resources and permissions
resource:
memory: 268435456 # Max memory (bytes)
permission:
tool:
enabled: true # Tool permission
model:
enabled: true # Model permission
llm: true
text_embedding: false
# Other model types...
# Other permissions...
# Extensions definition
plugins:
tools:
- tools/my_tool.yaml # Tool definition files
models:
- models/my_model.yaml # Model definition files
endpoints:
- endpoints/my_api.yaml # Endpoint definition files
# Runtime metadata
meta:
version: 0.0.1 # Manifest format version
arch:
- amd64
- arm64
runner:
language: python
version: "3.12"
entrypoint: main
Restrictions:
- Cannot extend both tools and models
- Must have at least one extension
- Cannot extend both models and endpoints
- Limited to one supplier per extension type
2. Implementation Examples
Study these examples to understand plugin implementation:
- OpenAI - Model provider
- Google Search - Tool provider
- Neko - Endpoint group
3. Testing & Debugging
-
Copy
.env.exampleto.envand configure:INSTALL_METHOD=remote REMOTE_INSTALL_URL=debug.dify.ai:5003 REMOTE_INSTALL_KEY=your-debug-key -
Run your plugin:
python -m main -
Refresh your Dify instance to see the plugin (marked as "debugging")
4. Publishing
Manual Packaging
dify-plugin plugin package ./YOUR_PLUGIN_DIR
Automated GitHub Workflow
Configure GitHub Actions to automate PR creation:
- Create a Personal Access Token for your forked repository
- Add it as
PLUGIN_ACTIONsecret in your source repo - Create
.github/workflows/plugin-publish.yml
When you create a release, the action will:
- Package your plugin
- Create a PR to your fork
Privacy Policy
If publishing to the Marketplace, provide a privacy policy in PRIVACY.md.