How simo2610/gpt-researcher works
Main System Components
• Frontend Applications:
• A lightweight static version (plain HTML/CSS/JS) and a production-ready NextJS application (found in the frontend/nextjs folder). They provide the user interface for entering research queries, displaying research progress, and viewing final reports.
• Backend Server:
• Located in the backend/server folder, this component (with app.py, server.py, logging, and WebSocket management) handles API requests, manages client connections, and coordinates research queries.
• Core Research Engine:
• The gpt_researcher directory holds key modules such as agent creation, configuration, document processing (loaders and scrapers), LLM provider integrations, memory management, retrievers, and report generation.
• Multi-Agent System:
• The multi_agents directory implements an orchestration of different agents (planner, researchers, reviewers, etc.) for a coordinated deep research process using LangGraph. This module is designed to work concurrently, managing different specialized agents.
• Utilities and Supporting Libraries:
• Additional directories like backend/chat, backend/memory, backend/report_type, and docs provide extra components for chat interactions, data retention, different report formats, and documentation.
• External Integration and Deployment:
• The Dockerfile, docker-compose.yml, and Procfile indicate containerization and deployment practices.
• Environment configuration files (.env.example) and CI/CD (GitHub workflows) signal automated build and deployment pipelines.
Relationships & Interactions
• NextJS-based frontend along with the lightweight static version.
• Backend API and Server:
• Backend server as a central hub that accepts requests from the frontend and manages task orchestration.
• Backend server to the core research engine (gpt_researcher) and, optionally, to the multi_agents module.
• Research Engine & Agent Workflow:
• Inside the core research engine, illustrate separate modules:
▪ Planner Agent: Generates the research questions.
▪ Execution Agents & Scrapers: Fetch and process data from web or local sources.
▪ Aggregator/Publisher: Combines the gathered information into a coherent report.
• External Services:
• Data Flow & Local Document Integration:
• Support for processing local documents (PDF, Markdown, Excel, etc.) that are loaded and parsed via document loaders (located in gpt_researcher/document) and routed through the research process.
Important Architectural Patterns
• Modular Design:
• Separation of concerns with directories clearly separating the backend server, research logic (agents, planners, and scrapers), and frontend operations.
• Agent-Based & Pipeline Workflow:
• “planner – executor – publisher” pattern, showing parallelized execution (concurrent processing in deep research).
• Extensibility:
• Areas (like multiple retriever integrations and multi-agent orchestration) that allow easy extension or plugging of additional agents or data sources.
Relevant Technologies & Frameworks
• Languages & Frameworks:
• Python is used on the backend; Node/NextJS for the frontend.
• Docker for containerization and deployment.
• Libraries & Tools:
• Mention LangGraph (for multi-agent orchestration), Uvicorn (for the FastAPI server), and Tailwind (in the NextJS frontend).
• Testing frameworks evidenced by the tests directory.