Plugin backwards invocation for knowledge base operations (documents, metadata, pipeline runs)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
Research direction
Start by reading the plugin SDK backwards invocation code and manifest permission handling, then trace the knowledge pipeline and dataset service APIs mentioned in the issue. Map how tenant scope, document metadata, indexing status, chunk retrieval, and in-place pipeline runs are exposed today. Done means a permission-gated plugin namespace supports the listed operations within the installed tenant; the issue does not identify specific files or tests.
Written by the indexing model from the issue text.
Description
Self Checks
- I have read the Contributing Guide and Language Policy.
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report, otherwise it will be closed.
- Please do not modify this template :) and fill in all the required fields.
1. Is this request related to a challenge you're experiencing? Tell me about your story.
We keep two pipeline knowledge bases in sync with an external system: records are added, edited and removed there, and Dify should follow (one-way) within a few minutes. The setup is entirely on the Dify side:
- an
online_documentdatasource plugin that lists the external records as pages and returns their content, - a tool plugin that compares the pages with the documents already in the knowledge base, runs the published pipeline for new or changed pages, and deletes documents whose record changed or disappeared,
- a workflow with a Schedule trigger that calls the tool every 5 minutes.
It works, but the tool cannot do any of this through the plugin SDK. Backwards invocation covers models, tools, apps, workflow nodes, storage and files, but nothing for knowledge bases. So a plugin running inside Dify has to call Dify's own Service API over HTTP:
- every tool instance needs the Dify API base URL as seen from the plugin daemon (
http://api:5001in docker compose, something else in other deployments), plus a knowledge base API key. That key is workspace-wide and has to be stored as a tool parameter. Neither should be needed for a plugin to work with the workspace it is installed in. - going through a workflow HTTP Request node instead does not help: it goes through the SSRF proxy, which blocks private addresses unless
SSRF_PROXY_ALLOW_PRIVATE_IPSis changed.
What we would like is backwards invocation for common knowledge base operations, scoped to the plugin's tenant and gated by a manifest permission like the existing tool / model / app ones. For example, a self.session.knowledge namespace offering:
- list documents of a dataset, with indexing status and metadata (paginated),
- delete a document,
- create metadata fields and set document metadata,
- run the published knowledge pipeline for a list of datasource items, and re-run it for an existing document in place (
original_document_id), - get the indexing status of a batch,
- retrieve chunks (this would also cover langgenius/dify-plugin-sdks#129).
2. Additional context or comments
Related limitations we ran into while building this, which shaped the request above:
- No in-place update through the Service API.
POST /v1/datasets/{id}/pipeline/rundoes not acceptoriginal_document_id, so every run creates a new document. The console endpointPOST /console/api/rag/pipelines/{id}/workflows/published/runaccepts it and replaces the document in place. Over the Service API, an update means: create a new document, wait for indexing, then delete the old one. To match documents to records again, we track both in custom metadata (record_id, content hash). - No re-sync for pipeline
online_documentdocuments.document_indexing_sync_taskonly handles legacynotion_importdocuments and is triggered manually. Documents imported through a datasource plugin (including the official Notion datasource) are never refreshed, so every integration needs its own sync tool. - A datasource and a tool cannot ship in one package (
datasource and tool, model, endpoint, trigger, or agent_strategy cannot be provided at the same time). The sync logic therefore lives in a second plugin. Since that plugin cannot use the datasource directly, it gets the page list by callingPOST /v1/datasets/{id}/pipeline/datasource/nodes/{node_id}/runover HTTP. - Minor, possibly a separate bug: on 1.19.0, running an
online_documentpipeline through the Service API withoutcredential_idindatasource_info_listfails withinvalid input syntax for type uuid: ""instead of using the default credential.
Environment: self-hosted Dify 1.19.0 (docker compose), plugin daemon 0.6.14, dify_plugin 0.10.2. We also checked the 1.17.1 source: the Service API endpoints above are the same there.
3. Can you help us with this feature?
- I am interested in contributing to this feature.
- Dominant language
- Python
- Stars
- 162k
- Forks
- 25.6k
- Avg merge
- 15h 9m
- Merged PRs (30d)
- 606
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from langgenius/dify
-
OpenSearch: text_exists() queries OpenSearch _id instead of metadata.doc_id, so it always returns False for indexed chunksPossibly taken @SanemIzci claimed this 1 day ago. Open🐞 bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
langgenius/dify#47109 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Log only execution identifiers when a workflow worker starts a runPossibly taken @kinglegendzzh claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langgenius/dify#47094 · 2 reactions ·
Maintainers usually reply within 1 day
-
Node.js SDK declares a response body for 204 conversation deletionPossibly taken @Wang-Zephyr claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
langgenius/dify#46883 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Provider IDs with a trailing newline are silently accepted and propagatedPossibly taken @Batianxieshen1 claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
langgenius/dify#46875 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Agent Python SDK polling rejects function-tool results that SSE acceptsPossibly taken @EndlessRoad-max claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
langgenius/dify#46868 · 1 reaction ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
micronaut-projects/micronaut-core#14585 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
langgenius/graphon#443 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
[BUG]: Management endpoints /v1/memory/stats and /v1/memory/counts bypass API key authenticationOpen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
docling-project/docling-serve#788 ·
Maintainers usually reply within 1 day
-
Mend: dependency security vulnerability untriaged
Difficulty 1/5 Under an hour Newbie friendliness 78/100
opensearch-project/cross-cluster-replication#1805 ·
Maintainers usually reply within 1 day