### Successful Install Output Example Source: https://github.com/langgenius/dify-docs/blob/main/en/cli/reference/skills.mdx Example output after a successful installation with the --yes flag, confirming the files that were written. ```text wrote /Users/you/.claude/skills/difyctl/SKILL.md wrote /Users/you/.cursor/skills/difyctl/SKILL.md ``` -------------------------------- ### Local Preview Setup with Mintlify CLI Source: https://github.com/langgenius/dify-docs/blob/main/README.md Installs the Mintlify CLI globally and starts a local development server for previewing documentation changes. ```bash npm i -g mintlify mintlify dev ``` -------------------------------- ### Example Setup Steps for Stock Investment Analysis Copilot Source: https://github.com/langgenius/dify-docs/blob/main/en/cloud/use-dify/publish/publish-to-marketplace.mdx Details the step-by-step process for setting up the template. Follows a numbered Markdown list format, starting with a verb, and includes UI navigation and configuration details. ```markdown 1. Click **Use template** to copy the "Investment Analysis Copilot (Yahoo Finance)" agent into your workspace. 2. Go to **Settings** > **Model Provider** and add your LLM API key. For example, OpenAI, Anthropic, or another supported provider. 3. Open the agent's **Orchestrate** page and make sure the Yahoo Finance tools are enabled in the **Tools** section: - `yahoo Analytics` - `yahoo News` - `yahoo Ticker` 4. (Optional) Customize the analysis style: - In the **INSTRUCTIONS** area, adjust the system prompt to match your target users. For example, tone, report length, preferred language, or risk preference. - Update the suggested questions in the **Debug & Preview** panel if you want different example queries. 5. Click **Publish** to make the agent available, then use the preview panel to test it: - Enter a company name or ticker (e.g., `Nvidia`, `AAPL`, `TSLA`). - Confirm that the copilot calls the Yahoo Finance tools and returns a structured investment analysis report. ``` -------------------------------- ### View Previous Documentation Versions Source: https://github.com/langgenius/dify-docs/blob/main/README.md Clones the repository, checks out a specific release branch, installs Mintlify, and starts a local development server to preview historical documentation. ```bash git clone https://github.com/langgenius/dify-docs.git cd dify-docs git checkout release/1.14.x # replace with the version you want npm i -g mintlify mintlify dev ``` -------------------------------- ### Start Dify Middlewares with Docker Compose Source: https://github.com/langgenius/dify-docs/blob/main/en/self-host/deploy/advanced-deployments/local-source-code.mdx Navigate to the docker directory, copy the example environment file, and start the required middleware services using Docker Compose. Customize the middleware.env file if you are not using the default PostgreSQL and Weaviate configurations. ```bash cd docker cp envs/middleware.env.example middleware.env # Change DB_TYPE or COMPOSE_PROFILES in middleware.env if you are not using PostgreSQL and Weaviate. docker compose --env-file middleware.env -f docker-compose.middleware.yaml -p dify up -d ``` -------------------------------- ### Install Dependencies and Run Plugin Source: https://github.com/langgenius/dify-docs/blob/main/en/develop-plugin/dev-guides-and-walkthroughs/develop-flomo-plugin.mdx Installs necessary Python dependencies and runs the main script to start the plugin in debug mode. ```bash pip install -r requirements.txt python -m main ``` -------------------------------- ### No Agents Detected Output Example Source: https://github.com/langgenius/dify-docs/blob/main/en/cli/reference/skills.mdx Example output when no agents are detected by the CLI, providing alternative installation methods. ```text No agents detected (looked for ~/.claude, ~/.codex, ~/.config/opencode, ~/.cursor, ~/.pi). Install into a directory manually with `difyctl skills install `, or print the skill with `difyctl skills install --stdout`. ``` -------------------------------- ### Get Top-Level Help Overview Source: https://github.com/langgenius/dify-docs/blob/main/en/cli/reference/help.mdx Use these commands to display the top-level help overview, which lists all available commands, global flags, and guide topics. ```bash difyctl difyctl help difyctl --help difyctl -h ``` -------------------------------- ### Agent End-to-End Test Example Source: https://github.com/langgenius/dify-docs/blob/main/en/cli/integrate-agents/install-the-difyctl-skill.mdx This sequence demonstrates an agent listing Dify apps and then running one, involving commands like `difyctl get app -o json` followed by a describe/run operation. ```bash difyctl get app -o json ``` -------------------------------- ### Install Dependencies Source: https://github.com/langgenius/dify-docs/blob/main/en/develop-plugin/dev-guides-and-walkthroughs/develop-md-exporter.mdx Install all necessary Python packages listed in the requirements.txt file before running the plugin. ```bash pip install -r requirements.txt ``` -------------------------------- ### JSON Workspace Output Example Source: https://github.com/langgenius/dify-docs/blob/main/en/cli/reference/workspaces.mdx Provides an example of the JSON output for `difyctl get workspace -o json`, detailing the structure of the workspaces array and its elements. ```json { "workspaces": [ { "id": "b4e8d2a6-7c3f-4a1e-9d5b-8f2c6e0a4d7b", "name": "Acme Team", "role": "owner", "status": "normal", "current": true } ] } ``` -------------------------------- ### Install Skill (Dry Run) Source: https://github.com/langgenius/dify-docs/blob/main/en/cli/reference/skills.mdx Preview where the skill would be installed without writing any files. This is the default behavior. ```bash difyctl skills install ``` -------------------------------- ### Example: Retrieving and Converting Data Source: https://github.com/langgenius/dify-docs/blob/main/en/develop-plugin/features-and-specs/plugin-types/persistent-storage-kv.mdx Shows how to retrieve string and JSON data using the `get` method and then decode/deserialize it back to its original format. Always check if the retrieved data is not `None`. ```python # Retrieving string data name_bytes = storage.get("user_name") if name_bytes: name = name_bytes.decode('utf-8') print(f"Retrieved name: {name}") # Retrieving JSON data import json user_data_bytes = storage.get("user_data") if user_data_bytes: user_data = json.loads(user_data_bytes.decode('utf-8')) print(f"User preferences: {user_data['preferences']}") ``` -------------------------------- ### Python Script for Local Translation Setup Source: https://github.com/langgenius/dify-docs/blob/main/tools/translate/README.md Sets up a Python virtual environment, installs dependencies, and configures the Dify API key for local development. Essential for running translation tasks and testing reconciliation features. ```bash # Create virtual environment python -m venv venv source venv/bin/activate # macOS/Linux # venv\Scripts\activate # Windows # Install dependencies pip install -r tools/translate/requirements.txt # Configure API key echo "DIFY_API_KEY=your_key" > tools/translate/.env ``` -------------------------------- ### Start Web Service Source: https://github.com/langgenius/dify-docs/blob/main/en/self-host/deploy/advanced-deployments/local-source-code.mdx Launch the Dify web service using PNPM. This command starts the Next.js development server. ```bash pnpm start ``` -------------------------------- ### Install Web Dependencies Source: https://github.com/langgenius/dify-docs/blob/main/en/self-host/deploy/advanced-deployments/local-source-code.mdx Install all necessary project dependencies using PNPM, ensuring a consistent build by freezing the lockfile. ```bash pnpm install --frozen-lockfile ``` -------------------------------- ### Frontend WebSocket URL Example Source: https://github.com/langgenius/dify-docs/blob/main/en/self-host/deploy/configuration/environments.mdx Example of configuring the browser-side WebSocket endpoint for real-time collaboration. ```text wss://dify.example.com ``` -------------------------------- ### Initialize Ngrok Source: https://github.com/langgenius/dify-docs/blob/main/en/cloud/use-dify/workspace/api-extension/api-extension.mdx Unzip the Ngrok file and add your authentication token to configure it. ```shell unzip /path/to/ngrok.zip ./ngrok config add-authtoken your-token ``` -------------------------------- ### Set Up Debug Environment Source: https://github.com/langgenius/dify-docs/blob/main/en/develop-plugin/dev-guides-and-walkthroughs/develop-md-exporter.mdx Copy the example .env file and configure it with your Dify environment details for remote debugging. This is crucial for testing your plugin locally. ```bash cp .env.example .env ``` ```dotenv INSTALL_METHOD=remote REMOTE_INSTALL_URL=debug-plugin.dify.dev:5003 REMOTE_INSTALL_KEY=your_debug_key ``` -------------------------------- ### Complete Weaviate Configuration Example Source: https://github.com/langgenius/dify-docs/blob/main/en/self-host/deploy/troubleshooting/weaviate-v4-migration.mdx A comprehensive example of environment variables for configuring Weaviate, including HTTP endpoint, authentication, gRPC settings, and batch import parameters. ```bash # docker/.env or environment configuration VECTOR_STORE=weaviate # HTTP Endpoint (required) WEAVIATE_ENDPOINT=http://weaviate:8080 # Authentication (if enabled on your Weaviate instance) WEAVIATE_API_KEY=your-secret-api-key # gRPC Configuration (recommended for performance) WEAVIATE_GRPC_ENABLED=true WEAVIATE_GRPC_ENDPOINT=weaviate:50051 # Batch Import Settings WEAVIATE_BATCH_SIZE=100 ``` -------------------------------- ### Start Worker Service (Windows) Source: https://github.com/langgenius/dify-docs/blob/main/en/self-host/deploy/advanced-deployments/local-source-code.mdx Starts the Celery worker service on Windows systems using the solo pool and disabling gossip/mingle for a simpler setup. This worker handles asynchronous tasks. ```bash uv run celery -A app.celery worker -P solo --without-gossip --without-mingle --loglevel INFO -Q dataset,dataset_summary,priority_dataset,priority_pipeline,pipeline,mail,ops_trace,app_deletion,plugin,workflow_storage,conversation,workflow,schedule_poller,schedule_executor,triggered_workflow_dispatcher,trigger_refresh_executor,retention,workflow_based_app_execution ``` -------------------------------- ### Setup and Run Translation Tests Source: https://github.com/langgenius/dify-docs/blob/main/tools/translate-test-dify/README.md Commands to initialize the environment and execute translation tests. ```bash # Setup (first time) ./setup.sh source venv/bin/activate # Run test python run_test.py # Compare results python compare.py results// ``` -------------------------------- ### Navigate to Web Directory Source: https://github.com/langgenius/dify-docs/blob/main/en/self-host/deploy/advanced-deployments/local-source-code.mdx Change your current directory to the 'web' folder to begin the build process. ```bash cd web ``` -------------------------------- ### Direct Reply for Irrelevant Questions Source: https://github.com/langgenius/dify-docs/blob/main/en/learn/tutorials/customer-service-bot.mdx Configure a Direct Reply node for user questions classified as irrelevant. This example shows how to guide users to help documentation using Markdown. ```text I'm sorry, I can't answer your question. If you need more help, please check the [help documentation](https://docs.dify.ai). ``` -------------------------------- ### Globally Install Dify CLI Source: https://github.com/langgenius/dify-docs/blob/main/en/develop-plugin/dev-guides-and-walkthroughs/cheatsheet.mdx Moves the downloaded Dify plugin CLI binary to a system path for global access. This example uses macOS ARM, adjust the source filename as needed. ```bash # Rename and move to system path # Example (macOS ARM) mv dify-plugin-darwin-arm64 dify sudo mv dify /usr/local/bin/ dify version ``` -------------------------------- ### Clone Example Repository and Configure Wrangler Source: https://github.com/langgenius/dify-docs/blob/main/en/cloud/use-dify/workspace/api-extension/cloudflare-worker.mdx Clone the example repository and copy the wrangler configuration file. Modify the 'name' and 'compatibility_date' in wrangler.toml. ```bash git clone https://github.com/crazywoola/dify-extension-workers.git cp wrangler.toml.example wrangler.toml ``` ```toml name = "dify-extension-example" compatibility_date = "2023-01-01" [vars] TOKEN = "bananaiscool" ``` -------------------------------- ### Loop Prompt Example for Poem Refinement Source: https://github.com/langgenius/dify-docs/blob/main/en/cloud/use-dify/nodes/loop.mdx This LLM prompt references both the current verse and iteration context to guide poem refinement. It instructs the LLM to act as a European literary figure and improve the poem based on previous work. ```text You are a European literary figure creating poetic verses. Current verse: {{verse}} Refine and improve this poem based on your previous work. ``` -------------------------------- ### Verify difyctl installation Source: https://github.com/langgenius/dify-docs/blob/main/en/cli/install.mdx Run this command after installation to check if difyctl is installed correctly and to see its version information. ```bash difyctl version ``` -------------------------------- ### Initialize New Dify Plugin Project (General) Source: https://github.com/langgenius/dify-docs/blob/main/en/develop-plugin/dev-guides-and-walkthroughs/tool-plugin.mdx Run this command to create a new Dify plugin project if the binary is renamed and in the system's PATH. ```bash dify plugin init ``` -------------------------------- ### Install PNPM with npm Source: https://github.com/langgenius/dify-docs/blob/main/en/self-host/deploy/advanced-deployments/local-source-code.mdx Use this command to install PNPM globally using npm if you prefer not to use the official installation guidance. ```bash npm i -g pnpm ``` -------------------------------- ### Install difyctl with a specific Dify version on macOS/Linux Source: https://github.com/langgenius/dify-docs/blob/main/en/cli/install.mdx Customize the installation by setting the DIFY_VERSION environment variable before running the install script. ```bash curl -fsSL https://raw.githubusercontent.com/langgenius/dify/main/cli/scripts/install-cli.sh | DIFY_VERSION= sh ``` -------------------------------- ### Dify Plugin Initialization Prompts Source: https://github.com/langgenius/dify-docs/blob/main/en/develop-plugin/getting-started/cli.mdx Example of prompts encountered during 'dify plugin init', including setting plugin details, selecting languages, and choosing plugin type. ```bash Edit profile of the plugin Plugin name (press Enter to next step): hello-world Author (press Enter to next step): langgenius Description (press Enter to next step): hello world example Repository URL (Optional) (press Enter to next step): Repository URL (Optional) Enable multilingual README: [✔] English is required by default Languages to generate: English: [✔] (required) → 简体中文 (Simplified Chinese): [✔] 日本語 (Japanese): [✘] Português (Portuguese - Brazil): [✘] Controls: ↑/↓ Navigate • Space/Tab Toggle selection • Enter Next step ``` ```bash Select the type of plugin you want to create, and press `Enter` to continue Before starting, here's some basic knowledge about Plugin types in Dify: - Tool: Tool Providers like Google Search, Stable Diffusion, etc. Used to perform specific tasks. - Model: Model Providers like OpenAI, Anthropic, etc. Use their models to enhance AI capabilities. - Endpoint: Similar to Service API in Dify and Ingress in Kubernetes. Extend HTTP services as endpoints with custom logic. - Trigger: Webhook-based providers that turn third-party platform events into workflow start signals. - Agent Strategy: Implement your own agent strategies like Function Calling, ReAct, ToT, CoT, etc. Based on the ability you want to extend, Plugins are divided into six types: Tool, Model, Extension, Agent Strategy, Datasource, and Trigger. - Tool: A tool provider that can also implement endpoints. For example, building a Discord Bot requires both sending and receiving messages. - Model: Strictly for model providers, no other extensions allowed. - Extension: For simple HTTP services that extend functionality. - Agent Strategy: Implement custom agent logic with a focused approach. - Datasource: Provide datasource for Dify Knowledge Pipeline. - Trigger: Build webhook integrations that emit events to kick off workflows. We've provided templates to help you get started. Choose one of the options below: -> tool agent-strategy llm text-embedding rerank tts speech2text moderation extension datasource trigger ``` ```bash Edit minimal Dify version requirement, leave it blank by default Minimal Dify version (press Enter to next step): ``` -------------------------------- ### Install difyctl on Windows Source: https://github.com/langgenius/dify-docs/blob/main/en/cli/install.mdx Use this PowerShell command to install difyctl on Windows systems. The script handles the download and installation of the binary. ```powershell irm https://raw.githubusercontent.com/langgenius/dify/main/cli/scripts/install.ps1 | iex ``` -------------------------------- ### OAuth Client Configuration Example Source: https://github.com/langgenius/dify-docs/blob/main/en/develop-plugin/dev-guides-and-walkthroughs/tool-oauth.mdx This example shows the typical format for a Dify redirect URI used in OAuth client configuration. Ensure 'your-dify-domain' matches your self-hosted Dify's CONSOLE_WEB_URL. ```bash https://{your-dify-domain}/console/api/oauth/plugin/{plugin-id}/{provider-name}/{tool-name}/callback ``` -------------------------------- ### Install difyctl with a specific Dify version on Windows Source: https://github.com/langgenius/dify-docs/blob/main/en/cli/install.mdx Customize the installation by setting the DIFY_VERSION environment variable in PowerShell before running the install script. ```powershell # PowerShell has no inline form; this applies for the rest of your session $env:DIFY_VERSION = "" irm https://raw.githubusercontent.com/langgenius/dify/main/cli/scripts/install.ps1 | iex ``` -------------------------------- ### Install Dependencies with uv Source: https://github.com/langgenius/dify-docs/blob/main/en/self-host/deploy/advanced-deployments/local-source-code.mdx Installs project dependencies using the 'uv' package manager. For macOS users, ensure 'libmagic' is installed via Homebrew. ```bash uv sync --dev ``` -------------------------------- ### Complete Agent Strategy Plugin Example Source: https://github.com/langgenius/dify-docs/blob/main/en/develop-plugin/dev-guides-and-walkthroughs/agent-strategy-plugin.mdx A comprehensive example demonstrating the integration of model invocation, tool handling, and logging for multi-round conversations within an agent strategy plugin. It includes necessary imports and a basic parameter model. ```python import json import time from collections.abc import Generator from typing import Any, cast from dify_plugin.entities.agent import AgentInvokeMessage from dify_plugin.entities.model.llm import LLMModelConfig, LLMResult, LLMResultChunk from dify_plugin.entities.model.message import ( PromptMessageTool, UserPromptMessage, ) from dify_plugin.entities.tool import ToolInvokeMessage, ToolParameter, ToolProviderType from dify_plugin.interfaces.agent import AgentModelConfig, AgentStrategy, ToolEntity from pydantic import BaseModel class BasicParams(BaseModel): maximum_iterations: int model: AgentModelConfig tools: list[ToolEntity] query: str ``` -------------------------------- ### Install difyctl on macOS or Linux Source: https://github.com/langgenius/dify-docs/blob/main/en/cli/install.mdx Use this command to install difyctl on macOS and Linux systems. The script automatically detects your platform and installs the binary. ```bash curl -fsSL https://raw.githubusercontent.com/langgenius/dify/main/cli/scripts/install-cli.sh | sh ``` -------------------------------- ### Initialize Git and Push Plugin Source Source: https://github.com/langgenius/dify-docs/blob/main/en/develop-plugin/publishing/marketplace-listing/release-to-individual-github-repo.mdx Initialize a Git repository in your plugin project and push the source code to a remote GitHub repository. Ensure your GitHub handle matches the 'author' field in your manifest for successful installation. ```bash cd your_plugin_project git init git add . git commit -m "initial commit" git branch -M main git remote add origin https://github.com//.git git push -u origin main ``` -------------------------------- ### Install Dify CLI via Homebrew Source: https://github.com/langgenius/dify-docs/blob/main/en/develop-plugin/dev-guides-and-walkthroughs/cheatsheet.mdx Installs the Dify plugin scaffold tool globally on macOS using Homebrew. Ensure Homebrew is installed and updated. ```bash brew tap langgenius/dify brew install dify ``` -------------------------------- ### Install Weaviate Client v4 Source: https://github.com/langgenius/dify-docs/blob/main/en/self-host/deploy/troubleshooting/weaviate-v4-migration.mdx Use this command to install the Weaviate client v4 for source installations. For Docker, ensure you are running the correct Dify version and restart the services. ```bash docker compose pull docker compose down docker compose up -d ``` ```bash pip uninstall weaviate-client pip install weaviate-client==4.17.0 ``` -------------------------------- ### Initialize New Plugin Source: https://github.com/langgenius/dify-docs/blob/main/en/develop-plugin/dev-guides-and-walkthroughs/cheatsheet.mdx Creates a new Dify plugin project. Follow the on-screen prompts to configure the plugin's basic information. ```bash ./dify plugin init ``` -------------------------------- ### Access Guide Topics Source: https://github.com/langgenius/dify-docs/blob/main/en/cli/reference/help.mdx Use `difyctl help ` to access long-form documentation on various topics built into the CLI, such as account management or environment variables. ```bash difyctl help ``` -------------------------------- ### Environment Variables Configuration Source: https://github.com/langgenius/dify-docs/blob/main/en/self-host/deploy/advanced-deployments/local-source-code.mdx Create and configure the .env.local file by copying from .env.example and setting environment variables for deployment. ```dotenv # For production release, change this to PRODUCTION NEXT_PUBLIC_DEPLOY_ENV=DEVELOPMENT # The deployment edition, SELF_HOSTED or CLOUD NEXT_PUBLIC_EDITION=SELF_HOSTED # The base URL of console application, refers to the Console base URL of WEB service if console domain is different from api or web app domain. # example: http://cloud.dify.ai/console/api NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api # The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from console or api domain. # example: http://udify.app/api NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api # When the frontend and backend run on different subdomains, set NEXT_PUBLIC_COOKIE_DOMAIN=1. NEXT_PUBLIC_COOKIE_DOMAIN= # SENTRY NEXT_PUBLIC_SENTRY_DSN= NEXT_PUBLIC_SENTRY_ORG= NEXT_PUBLIC_SENTRY_PROJECT= ```