How ldgen404/gpt-researcher works
GPT Researcher is a web- and local-document research agent that produces cited reports. Its documented workflow plans research questions, gathers and summarizes sources, then filters and aggregates findings into a report; the repository also exposes this through a web application and supports multi-agent research, MCP data sources, images, and report chat. The graph combines documented capabilities with source-index relationships; unsampled implementation details and links are omitted where evidence is limited.
Main entry points: agent.py Research agent · orchestrator.py Agent orchestration · app.py API routes · query_processing.py Query planning
Components 29
User interfaces
- Research UI
frontend/nextjs/app/page.tsx - API routes
backend/server/app.py - WebSocket runner
backend/server/websocket_manager.py
Research runtime
- Research agent
gpt_researcher/agent.py - Query planning
gpt_researcher/actions/query_processing.py - Research config
gpt_researcher/config/config.py - Prompt library
gpt_researcher/prompts.py - LLM interface
gpt_researcher/utils/llm.py - LLM provider
gpt_researcher/llm_provider/generic/base.py - Research types
gpt_researcher/utils/enum.py - Context retrieval
gpt_researcher/context/retriever.py - Context management
gpt_researcher/skills/context_manager.py - Report generation
gpt_researcher/actions/report_generation.py
Research sources
- Search retrievers
gpt_researcher/retrievers - Web scraping
gpt_researcher/scraper/scraper.py - Local documents
gpt_researcher/document/document.py - MCP retrieval
gpt_researcher/retrievers/mcp/retriever.py
Multi-agent research
- Multi-agent dispatch
backend/server/multi_agent_runner.py - Agent orchestration
multi_agents/agents/orchestrator.py - Research agent
multi_agents/agents/researcher.py - Writer agent
multi_agents/agents/writer.py - Review and revision
multi_agents/agents/reviewer.py - Report publisher
multi_agents/agents/publisher.py
Output and services
- Report store
backend/server/report_store.py - Image generation
gpt_researcher/llm_provider/image/image_generator.py
Other components
- Researcher
- Web sources
- LLM service
- MCP servers
Connections 29
- Researcher → Research UI: submits research
README.md - Research UI → API routes: calls API
- API routes → WebSocket runner: starts research
backend/server/app.py - WebSocket runner → Research agent: runs agent
backend/server/websocket_manager.py - Research agent → Query planning: plans questions
- Query planning → Prompt library: builds prompts
gpt_researcher/actions/query_processing.py - Query planning → LLM interface: generates queries
gpt_researcher/actions/query_processing.py - LLM interface → LLM provider: creates provider
gpt_researcher/utils/llm.py - Research agent → Research config: uses settings
- Research agent → Search retrievers: gathers sources
README.md - Search retrievers → Web sources: searches web
README.md - Research agent → Web scraping: scrapes pages
README.md - Web scraping → Web sources: fetches pages
README.md - Research agent → Local documents: reads local files
README.md - Research agent → MCP retrieval: uses MCP sources
README.md - MCP retrieval → MCP servers: queries tools
README.md - Research agent → Context retrieval: retrieves context
- Research agent → Context management: manages context
- Research agent → Report generation: writes report
README.md - Research agent → LLM interface: requests completions
- LLM provider → LLM service: generates text
- API routes → Multi-agent dispatch: dispatches workflow
backend/server/app.py - Multi-agent dispatch → Agent orchestration: runs agents
backend/server/multi_agent_runner.py - Agent orchestration → Research agent: coordinates research
multi_agents/agents/orchestrator.py - Agent orchestration → Writer agent: coordinates writing
multi_agents/agents/orchestrator.py - Agent orchestration → Review and revision: routes review
- Agent orchestration → Report publisher: coordinates publishing
multi_agents/agents/orchestrator.py - API routes → Report store: reads reports
backend/server/app.py - Research agent → Image generation: generates illustrations
README.md