"""1. Run: `pip install openai agno cohere lancedb tantivy sqlalchemy pandas` to install the dependencies2. Export your OPENAI_API_KEY and CO_API_KEY3. Run: `python cookbook/agent_concepts/rag/agentic_rag_with_reranking.py` to run the agent"""from agno.agent import Agentfrom agno.knowledge.embedder.openai import OpenAIEmbedderfrom agno.knowledge.knowledge import Knowledgefrom agno.knowledge.reranker.cohere import CohereRerankerfrom agno.models.openai import OpenAIChatfrom agno.vectordb.lancedb import LanceDb, SearchTypeknowledge = Knowledge( # Use LanceDB as the vector database and store embeddings in the `agno_docs` table vector_db=LanceDb( uri="tmp/lancedb", table_name="agno_docs", search_type=SearchType.hybrid, embedder=OpenAIEmbedder( id="text-embedding-3-small" ), # Use OpenAI for embeddings reranker=CohereReranker( model="rerank-multilingual-v3.0" ), # Use Cohere for reranking ),)knowledge.add_content_sync( name="Agno Docs", url="https://docs.agno.com/introduction.md")agent = Agent( model=OpenAIChat(id="gpt-5-mini"), # Agentic RAG is enabled by default when `knowledge` is provided to the Agent. knowledge=knowledge, markdown=True,)if __name__ == "__main__": # Load the knowledge base, comment after first run # agent.knowledge.load(recreate=True) agent.print_response("What are Agno's key features?")