A sophisticated RAG system that demonstrates an AI agent's step-by-step reasoning process using Agno, Claude and OpenAI. This implementation allows users to upload documents, add web sources, ask questions, and observe the agent's thought process in real-time.
- Interactive Knowledge Base Management
- Upload documents to expand the knowledge base
- Add URLs dynamically for web content
- Persistent vector database storage using LanceDB
- Transparent Reasoning Process
- Real-time display of the agent's thinking steps
- Side-by-side view of reasoning and final answer
- Clear visibility into the RAG process
- Advanced RAG Capabilities
- Vector search using OpenAI embeddings for semantic matching
- Source attribution with citations
- Claude 3.5 Sonnet for language processing
- OpenAI embedding model for vector search
- ReasoningTools for step-by-step analysis
- Customizable agent instructions
You'll need the following API keys:
- Anthropic API Key
- Sign up at console.anthropic.com
- Navigate to API Keys section
- Create a new API key
- OpenAI API Key
- Sign up at platform.openai.com
- Navigate to API Keys section
- Generate a new API key
-
Clone the Repository:
git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git cd rag_tutorials/agentic_rag_with_reasoning -
Install the dependencies:
pip install -r requirements.txt
-
Run the Application:
streamlit run rag_reasoning_agent.py
-
Configure API Keys:
- Enter your Anthropic API key in the first field
- Enter your OpenAI API key in the second field
- Both keys are required for the app to function
- Use the Application:
- Add Knowledge Sources: Use the sidebar to add URLs to your knowledge base
- Ask Questions: Enter queries in the main input field
- View Reasoning: Watch the agent's thought process unfold in real-time
- Get Answers: Receive comprehensive responses with source citations
The application uses a sophisticated RAG pipeline:
- Documents are loaded from URLs using WebBaseLoader
- Text is chunked and embedded using OpenAI's embedding model
- Vectors are stored in LanceDB for efficient retrieval
- Vector search enables semantic matching for relevant information
- User queries trigger the agent's reasoning process
- ReasoningTools help the agent think step-by-step
- The agent searches the knowledge base for relevant information
- Claude 4 Sonnet generates comprehensive answers with citations
- Enter API keys → Add knowledge sources → Ask questions
- Reasoning process and answer generation displayed side-by-side
- Sources cited for transparency and verification