A modern web interface for the Research Agent with real-time streaming responses, document management, and conversation history.
- Document Management: Upload PDF, TXT, and MD files with drag-and-drop
- Real-time Streaming: See AI responses as they're generated
- Conversation History: Manage multiple research sessions
- Source Citations: View and explore document sources used in answers
- Modern UI: Clean, responsive interface built with React and Tailwind CSS
# Install Python dependencies
pip install -r requirements.txt
# Start the FastAPI server
python -m backend.mainThe API will run at: http://localhost:8000
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Start the development server
npm run devThe UI will run at: http://localhost:5173
Navigate to http://localhost:5173 and start researching!
Agent/
├── backend/ # FastAPI backend
│ ├── api/ # API routes and schemas
│ ├── services/ # Business logic
│ ├── database/ # SQLAlchemy models and CRUD
│ └── middleware/ # CORS and error handling
├── frontend/ # React frontend
│ └── src/
│ ├── components/ # UI components
│ ├── hooks/ # Custom React hooks
│ ├── stores/ # Zustand state management
│ ├── lib/ # API client and utilities
│ └── types/ # TypeScript types
├── src/ # Original agent code (unchanged)
└── main.py # Original CLI (unchanged)
- Click on the "Documents" tab in the left sidebar
- Drag and drop files or click to browse
- Wait for documents to be ingested
- Click "New Chat" in the left sidebar
- Type your research question
- Watch as the AI streams its response
- Click on sources to see which documents were used
- Create multiple conversations for different topics
- Each session maintains its own message history
- Archive or delete sessions as needed
Located in the root directory:
GEMINI_API_KEY=your_api_key_here
CHROMA_PERSIST_DIRECTORY=./data/chroma_db
CHUNK_SIZE=1000
CHUNK_OVERLAP=200
MAX_FILE_SIZE_MB=50
RETRIEVAL_TOP_K=5
RELEVANCE_THRESHOLD=7.0
GEMINI_MODEL=gemini-1.5-flash-latestLocated in frontend/.env:
VITE_API_URL=http://localhost:8000/api/v1POST /api/v1/documents/upload- Upload a documentGET /api/v1/documents- List all documentsDELETE /api/v1/documents/{id}- Delete a document
POST /api/v1/chat/sessions- Create a new sessionGET /api/v1/chat/sessions- List all sessionsGET /api/v1/chat/sessions/{id}- Get session detailsDELETE /api/v1/chat/sessions/{id}- Delete a session
GET /api/v1/chat/sessions/{id}/stream- Stream research responses (SSE)
GET /api/v1/health- Check API status
The streaming endpoint emits these events:
node_start- Workflow node begins executionnode_complete- Workflow node finishestoken- Individual token from the LLMsynthesis_complete- Final answer with sources and metadatacomplete- Message saved to databaseerror- Error occurred during processing
SQLite database at data/research_agent.db with tables:
sessions- Chat conversationsmessages- Individual messagesdocuments- Uploaded file metadatasession_documents- Links between sessions and documents
- FastAPI - Modern, fast Python web framework
- SQLAlchemy - SQL ORM
- SSE-Starlette - Server-Sent Events support
- Existing LangChain/LangGraph workflow (unchanged)
- React 18 + TypeScript
- Vite - Fast build tool
- Tailwind CSS - Utility-first CSS
- Zustand - State management
- Axios - HTTP client
- React Markdown - Markdown rendering
- Lucide React - Icon library
- Check that
GEMINI_API_KEYis set in.env - Ensure port 8000 is not in use
- Verify Python dependencies are installed
- Check that
node_modulesis installed (npm install) - Ensure port 5173 is not in use
- Verify
.envfile exists infrontend/directory
- Check browser console for errors
- Verify backend is running and accessible
- Ensure CORS is properly configured
- Check file size (max 50MB)
- Verify file type (PDF, TXT, MD only)
- Check backend logs for errors
# Install production server
pip install gunicorn
# Run with gunicorn
gunicorn backend.main:app -w 4 -k uvicorn.workers.UvicornWorker# Build for production
cd frontend
npm run build
# Serve with nginx or any static file server
# Built files will be in frontend/dist/- The original CLI (
python main.py) still works - Vector store (Chroma) is shared between CLI and web UI
- All existing agent functionality is preserved
- No changes to core agent code in
src/directory
This is built on top of the original Research Agent. Any improvements to the core agent automatically benefit the web UI.
MIT License
Built with ❤️ using Claude Code