The metadata filtering of the knowledge base does not work in the Agent application. #13292

Closed
opened 2026-02-21 19:11:30 -05:00 by yindo · 5 comments
Owner

Originally created by @shaunsyb on GitHub (Apr 24, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.1.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

There is a knowledge base configured with metadata project_name, containing multiple document files, each assigned a different project_name. Testing shows that in a chat application, when this knowledge base is added and metadata filtering is set to manual, queries will only reference the filtered knowledge base files. However, in an Agent application, this metadata filtering does not work, and queries will reference all files in the knowledge base.

Image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @shaunsyb on GitHub (Apr 24, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.1.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce There is a knowledge base configured with metadata project_name, containing multiple document files, each assigned a different project_name. Testing shows that in a chat application, when this knowledge base is added and metadata filtering is set to manual, queries will only reference the filtered knowledge base files. However, in an Agent application, this metadata filtering does not work, and queries will reference all files in the knowledge base. ![Image](https://github.com/user-attachments/assets/e71d5a7f-0bfe-47f7-ae8c-03a47b6fd360) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 19:11:30 -05:00
yindo closed this issue 2026-02-21 19:11:30 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 24, 2025):

Hello @shaunsyb! I'm Dosu, a bot here to help you with any bugs, questions, or contributions you might have while you wait for a human maintainer. Let's get started!

The issue you're experiencing with metadata filtering in the Agent application is a known limitation. The Agent application currently only supports external data tools and does not include code for knowledge base retrieval in its implementation. This functionality is available in the Chat Assistant but not in the Agent application [1].

Additionally, there was a known bug in Dify v1.1.3 affecting metadata filtering conditions when using Milvus as a vector store. This issue has been addressed in a later version through a pull request, so upgrading to a newer version of Dify may resolve the problem [2][3].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 24, 2025): <!-- Greeting --> Hello @shaunsyb! I'm [Dosu](https://dosu.dev), a bot here to help you with any bugs, questions, or contributions you might have while you wait for a human maintainer. Let's get started! <!-- Answer --> The issue you're experiencing with metadata filtering in the Agent application is a known limitation. The Agent application currently only supports external data tools and does not include code for knowledge base retrieval in its implementation. This functionality is available in the Chat Assistant but not in the Agent application <sup>[[1]](https://github.com/langgenius/dify/issues/16964)</sup>. Additionally, there was a known bug in Dify v1.1.3 affecting metadata filtering conditions when using Milvus as a vector store. This issue has been addressed in a later version through a pull request, so upgrading to a newer version of Dify may resolve the problem <sup>[[2]](https://github.com/langgenius/dify/issues/16466)</sup><sup>[[3]](https://github.com/langgenius/dify/issues/16679)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=other)</sup>
Author
Owner

@shaunsyb commented on GitHub (Apr 24, 2025):

Hello @shaunsyb! I'm Dosu, a bot here to help you with any bugs, questions, or contributions you might have while you wait for a human maintainer. Let's get started!

The issue you're experiencing with metadata filtering in the Agent application is a known limitation. The Agent application currently only supports external data tools and does not include code for knowledge base retrieval in its implementation. This functionality is available in the Chat Assistant but not in the Agent application [1].

Additionally, there was a known bug in Dify v1.1.3 affecting metadata filtering conditions when using Milvus as a vector store. This issue has been addressed in a later version through a pull request, so upgrading to a newer version of Dify may resolve the problem [2][3].

To continue talking to Dosu, mention @dosu.

Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosu. I also conducted tests in version 1.3.0, and this issue still persists.

@shaunsyb commented on GitHub (Apr 24, 2025): > Hello [@shaunsyb](https://github.com/shaunsyb)! I'm [Dosu](https://dosu.dev), a bot here to help you with any bugs, questions, or contributions you might have while you wait for a human maintainer. Let's get started! > > The issue you're experiencing with metadata filtering in the Agent application is a known limitation. The Agent application currently only supports external data tools and does not include code for knowledge base retrieval in its implementation. This functionality is available in the Chat Assistant but not in the Agent application [[1]](https://github.com/langgenius/dify/issues/16964). > > Additionally, there was a known bug in Dify v1.1.3 affecting metadata filtering conditions when using Milvus as a vector store. This issue has been addressed in a later version through a pull request, so upgrading to a newer version of Dify may resolve the problem [[2]](https://github.com/langgenius/dify/issues/16466)[[3]](https://github.com/langgenius/dify/issues/16679). > > _To continue talking to [Dosu](https://dosu.dev), mention [@dosu](https://github.com/dosu)._ > > Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/51fd5359-9597-413b-9370-d342bf31fbb6?feedback_type=other) @dosu. I also conducted tests in version 1.3.0, and this issue still persists.
Author
Owner

@dosubot[bot] commented on GitHub (Apr 24, 2025):

This issue seems complex and requires your expertise, @crazywoola, could you please take a look?

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 24, 2025): <!-- Answer --> This issue seems complex and requires your expertise, @crazywoola, could you please take a look? <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/383e867a-7861-4181-80ec-117b00eb79c8?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/383e867a-7861-4181-80ec-117b00eb79c8?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/383e867a-7861-4181-80ec-117b00eb79c8?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/383e867a-7861-4181-80ec-117b00eb79c8?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/383e867a-7861-4181-80ec-117b00eb79c8?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/383e867a-7861-4181-80ec-117b00eb79c8?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/383e867a-7861-4181-80ec-117b00eb79c8?feedback_type=other)</sup>
Author
Owner

@kingsant commented on GitHub (Apr 28, 2025):

https://github.com/langgenius/dify/pull/19020 i fix it temporary

@kingsant commented on GitHub (Apr 28, 2025): https://github.com/langgenius/dify/pull/19020 i fix it temporary
Author
Owner

@IthacaDream commented on GitHub (Apr 30, 2025):

#19020 i fix it temporary

I think it only works for external datasets, is that right?

@IthacaDream commented on GitHub (Apr 30, 2025): > [#19020](https://github.com/langgenius/dify/pull/19020) i fix it temporary I think it only works for `external` datasets, is that right?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13292