# Custom retriever for knowlege

**URL:** <https://community.crewai.com/t/custom-retriever-for-knowlege/4345>\
**Category:** CrewAI Community Support\
**Created:** [March 3, 2025, 2:26pm UTC](https://community.crewai.com/t/custom-retriever-for-knowlege/4345 "2025-03-03T14:26:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steitcher](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/steitcher/32/2741_2.png) [@Steitcher](https://community.crewai.com/u/Steitcher)\
**Post date:** [March 3, 2025, 2:26pm UTC](https://community.crewai.com/t/custom-retriever-for-knowlege/4345/1 "2025-03-03T14:26:28Z")

</div>

I’m migrating my project to CrewAI. I already have a retriever for RAG implemented with LangChain that works well for me. The default functionality of CrewAI Knowledge does not seem sufficient for my use case (using `EnsembleRetriever`, `ParentDocumentRetriever`, etc.), so I plan to bring my existing retriever code.

What is the recommended way to do this? Should I create a new class that inherits from `BaseKnowledgeSource`? Implement my retriever as a tool? Or is there another recommended approach?

---

<div class="post-metadata">

**Author:** ![zinyando](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/zinyando/32/4435_2.png) [@zinyando](https://community.crewai.com/u/zinyando)\
**Post date:** [March 3, 2025, 2:31pm UTC](https://community.crewai.com/t/custom-retriever-for-knowlege/4345/2 "2025-03-03T14:31:54Z")

</div>

Extending `BaseKnowledgeSource` is the way to go. You can see the docs here [Knowledge - CrewAI](https://docs.crewai.com/concepts/knowledge#custom-knowledge-sources)
