Registry / llm-agents / dify-plugin

dify-plugin

JSON →
library0.10.2pypypi✓ verified 24d ago

The Dify Plugin SDK allows developers to build custom plugins for the Dify platform. It provides classes and decorators to define plugin metadata, inputs, outputs, and API endpoints, enabling seamless integration with Dify AI applications. Currently at version 0.7.4, the library is under active development with frequent releases.

pip install dify-plugin
INSTALL
IMPORT
SIG · DIFY-PLUGIN
D
dify-plugin
llm-agentspythonv0.10.2
Install
9.0s avg
Import
2426ms
Disk
75MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.1b44 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 1.986s · 84.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 9.0s · import 1.896s · 81MB
75MB installed
● package 75MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Plugin
from dify_plugin import Plugin
from dify_plugin import DifyPlugin

This quickstart demonstrates how to define a basic Dify plugin with metadata, inputs, outputs, and a single API endpoint. The `plugin.run()` call starts a local server for development and testing, exposing the plugin's OpenAPI specification.

import os from dify_plugin import DifyPlugin, PluginMetadata, Category, Input, Output plugin = DifyPlugin( metadata=PluginMetadata( name="Hello Dify", description="A simple plugin that says hello.", icon="https://dify.ai/favicon.ico", category=Category.TOOLS, inputs=[ Input(name="name", type="string", required=True, description="Your name"), ], outputs=[ Output(name="greeting", type="string"), ], ) ) @plugin.api("hello") def hello_world_api(name: str): return {"greeting": f"Hello, {name}!"} if __name__ == "__main__": # In a real Dify environment, the plugin would be served externally. # For local testing, run this script and access at http://127.0.0.1:PORT/.well-known/ai-plugin.json plugin.run()
Debug
Known issues
breakingThe library is under rapid development. API changes, including breaking ones, may occur frequently between minor versions (e.g., 0.x.x to 0.y.x) as the project matures.
fix
Refer to the official GitHub repository's release notes and README for the latest API specifications and migration guides when upgrading.
affects: <1.0.0
gotchaPlugins require Python 3.11 or higher. Using older Python versions will result in installation failures or runtime errors.
fix
Ensure your development environment and deployment target use Python 3.11 or a newer compatible version.
affects: All versions
gotchaTo expose functionality, plugin methods must be decorated with `@plugin.api("endpoint_name")`. Forgetting this decorator or using an incorrect endpoint name will prevent Dify from discovering and invoking your plugin's capabilities.
fix
Always use `@plugin.api()` on functions intended to be called by Dify, matching the endpoint name defined in your Dify plugin configuration.
affects: All versions
gotchaThe `PluginMetadata` object requires essential fields like `name`, `description`, `icon`, `category`, `inputs`, and `outputs` to be correctly and completely defined. Incomplete or incorrect metadata can lead to the plugin not being recognized or functioning improperly within Dify.
fix
Carefully review and provide all required fields in `PluginMetadata`, ensuring they accurately reflect your plugin's purpose and interface.
affects: All versions
Upgrade
Version history
0.10.2latest on PyPI · released Aug 10, 2026
Audit
Dependencies
fastapirequiredWeb framework for API endpoints
pydanticrequiredData validation and settings management
uvicornrequiredASGI server for running the plugin API
logururequiredLogging utility
python-dotenvrequiredEnvironment variable management
requestsrequiredHTTP client for making external requests
Agent activity
35 hits · last 30 days
node
32
OpenAI (training)
1
Resources
dify-plugin — pip install dify-plugin · libregistry