Let’s build some examples to see Agentic Search in action.
Agentic RAG
When we add a knowledge base to an Agent, behind the scenes, we give the model a tool to search that knowledge base for the information it needs. The Model generates a set of keywords and calls thesearch_knowledge_base() tool to retrieve the relevant information or few-shot examples.
Here’s a working example that uses Hybrid Search + Reranking:
agentic_rag.py
Agentic RAG with Reasoning
We can further improve the Agents search capabilities by giving it the ability to reason about the search results. By adding reasoning, the Agent “thinks” first about what to search and then “analyzes” the results of the search. Here’s an example of an Agentic RAG Agent that uses reasoning to improve the quality of the search results.agentic_rag_reasoning.py