跳到主要内容

gpt-researcher 精选

GPT Researcher is an autonomous deep research agent that conducts web and local research, producing detailed reports with citations. Use this skill when helping developers understand, extend, debug, or integrate with GPT Researcher - including adding features, understanding the architecture, working with the API, customizing research workflows, adding new retrievers, integrating MCP data sources, or troubleshooting research pipelines.

研究 Codex CLIMCP 客户端 Apache-2.0 3.0 万
在 GitHub 打开

安装方式

cp -r .claude ~/.claude/skills/claude

把该 skill 目录放进客户端 skills 目录。不同客户端的目录可能不同,Claude Code 默认是 ~/.claude/skills/

整仓一次性获取:git clone --depth 1 https://github.com/assafelovic/gpt-researcher.git

依赖与权限

  • 无需 API Key
  • 无需联网
  • 依赖外部命令:npm python pip npx
  • 以上为按正文与 frontmatter 自动推断的信号,仅供参考;安装前建议先阅读原文。
触发场景
extenddebug

SKILL.md 正文

来源 assafelovic/gpt-researcher@3582a68 · 许可 Apache-2.0 · 内容未修改

GPT Researcher Development Skill

GPT Researcher is an LLM-based autonomous agent using a planner-executor-publisher pattern with parallelized agent work for speed and reliability.

Quick Start

Basic Python Usage

from gpt_researcher import GPTResearcher
import asyncio

async def main():
    researcher = GPTResearcher(
        query="What are the latest AI developments?",
        report_type="research_report",  # or detailed_report, deep, outline_report
        report_source="web",            # or local, hybrid
    )
    await researcher.conduct_research()
    report = await researcher.write_report()
    print(report)

asyncio.run(main())

Run Servers

# Backend
python -m uvicorn backend.server.server:app --reload --port 8000

# Frontend
cd frontend/nextjs && npm install && npm run dev

Key File Locations

NeedPrimary FileKey Classes
Main orchestratorgpt_researcher/agent.pyGPTResearcher
Research logicgpt_researcher/skills/researcher.pyResearchConductor
Report writinggpt_researcher/skills/writer.pyReportGenerator
All promptsgpt_researcher/prompts.pyPromptFamily
Configurationgpt_researcher/config/config.pyConfig
Config defaultsgpt_researcher/config/variables/default.pyDEFAULT_CONFIG
API serverbackend/server/app.pyFastAPI app
Search enginesgpt_researcher/retrievers/Various retrievers

Architecture Overview

User Query → GPTResearcher.__init__()
                │
                ▼
         choose_agent() → (agent_type, role_prompt)
                │
                ▼
         ResearchConductor.conduct_research()
           ├── plan_research() → sub_queries
           ├── For each sub_query:
           │     └── _process_sub_query() → context
           └── Aggregate contexts
                │
                ▼
         [Optional] ImageGenerator.plan_and_generate_images()
                │
                ▼
         ReportGenerator.write_report() → Markdown report

For detailed architecture diagrams: See [references/architecture.md](references/architecture.md)


Core Patterns

Adding a New Feature (8-Step Pattern)

  1. Config → Add to gpt_researcher/config/variables/default.py
  2. Provider → Create in gpt_researcher/llm_provider/my_feature/
  3. Skill → Create in gpt_researcher/skills/my_feature.py
  4. Agent → Integrate in gpt_researcher/agent.py
  5. Prompts → Update gpt_researcher/prompts.py
  6. WebSocket → Events via stream_output()
  7. Frontend → Handle events in useWebSocket.ts
  8. Docs → Create docs/docs/gpt-researcher/gptr/my_feature.md

For complete feature addition guide with Image Generation case study: See [references/adding-features.md](references/adding-features.md)

Adding a New Retriever

# 1. Create: gpt_researcher/retrievers/my_retriever/my_retriever.py
class MyRetriever:
    def __init__(self, query: str, headers: dict = None):
        self.query = query
    
    async def search(self, max_results: int = 10) -> list[dict]:
        # Return: [{"title": str, "href": str, "body": str}]
        pass

# 2. Register in gpt_researcher/actions/retriever.py
case "my_retriever":
    from gpt_researcher.retrievers.my_retriever import MyRetriever
    return MyRetriever

# 3. Export in gpt_researcher/retrievers/__init__.py

For complete retriever documentation: See [references/retrievers.md](references/retrievers.md)


Configuration

Config keys are lowercased when accessed:

# In default.py: "SMART_LLM": "gpt-4o"
# Access as: self.cfg.smart_llm  # lowercase!

Priority: Environment Variables → JSON Config File → Default Values

For complete configuration reference: See [references/config-reference.md](references/config-reference.md)


Common Integration Points

WebSocket Streaming

class WebSocketHandler:
    async def send_json(self, data):
        print(f"[{data['type']}] {data.get('output', '')}")

researcher = GPTResearcher(query="...", websocket=WebSocketHandler())

MCP Data Sources

researcher = GPTResearcher(
    query="Open source AI projects",
    mcp_configs=[{
        "name": "github",
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-github"],
        "env": {"GITHUB_TOKEN": os.getenv("GITHUB_TOKEN")}
    }],
    mcp_strategy="deep",  # or "fast", "disabled"
)

For MCP integration details: See [references/mcp.md](references/mcp.md)

Deep Research Mode

researcher = GPTResearcher(
    query="Comprehensive analysis of quantum computing",
    report_type="deep",  # Triggers recursive tree-like exploration
)

For deep research configuration: See [references/deep-research.md](references/deep-research.md)


Error Handling

Always use graceful degradation in skills:

async def execute(self, ...):
    if not self.is_enabled():
        return []  # Don't crash
    
    try:
        result = await self.provider.execute(...)
        return result
    except Exception as e:
        await stream_output("logs", "error", f"⚠️ {e}", self.websocket)
        return []  # Graceful degradation

Critical Gotchas

❌ Mistake✅ Correct
config.MY_VARconfig.my_var (lowercased)
Editing pip-installed packagepip install -e .
Forgetting async/awaitAll research methods are async
websocket.send_json() on NoneCheck if websocket: first
Not registering retrieverAdd to retriever.py match statement

Reference Documentation

TopicFile
System architecture & diagrams[references/architecture.md](references/architecture.md)
Core components & signatures[references/components.md](references/components.md)
Research flow & data flow[references/flows.md](references/flows.md)
Prompt system[references/prompts.md](references/prompts.md)
Retriever system[references/retrievers.md](references/retrievers.md)
MCP integration[references/mcp.md](references/mcp.md)
Deep research mode[references/deep-research.md](references/deep-research.md)
Multi-agent system[references/multi-agents.md](references/multi-agents.md)
Adding features guide[references/adding-features.md](references/adding-features.md)
Advanced patterns[references/advanced-patterns.md](references/advanced-patterns.md)
REST & WebSocket API[references/api-reference.md](references/api-reference.md)
Configuration variables[references/config-reference.md](references/config-reference.md)

质量与来源

所属仓库
assafelovic/gpt-researcher
仓库星标
3.0 万
最近更新
3 天前
采集时间
今天
commit
3582a6841fe7
内容指纹
sha256:641fed5a76d8b59
文件路径
.claude/SKILL.md

相似 Skill

更多「研究」
last30days
「最近 30 天」主题调研:跨 Reddit / X / YouTube / TikTok / Hacker News / Polymarket 抓公开讨论与互动数据,汇总成带出处的结论,并自带数据源健康检查。
精选 mvanhorn/last30days-skill 6.4 万
Claude CodeCodex CLIMCP 客户端
planning-with-files
Persistent file-based planning for multi-step AI-agent work. Keeps task_plan.md, findings.md, and progress.md on disk; lifecycle hooks inject selected project planning context. Automatic recovery reads project planning files only. Explicit session-catchup.py --metadata reads same-project local agent session records and emits aggregate counts only; --replay may emit bounded nonce-framed excerpts. Optional gated mode can request continuation only when the host supports it and never runs commands declared in Markdown. The skill has no network upload path. Use for research or work needing 5+ tool calls.
精选 OthmanAdi/planning-with-files 2.7 万 原文
Claude CodeCodex CLICursor
planning-with-files
Persistent file-based planning for multi-step AI-agent work. Keeps task_plan.md, findings.md, and progress.md on disk; lifecycle hooks inject selected project planning context. Automatic recovery reads project planning files only. Explicit session-catchup.py --metadata reads same-project local agent session records and emits aggregate counts only; --replay may emit bounded nonce-framed excerpts. Optional gated mode can request continuation only when the host supports it and never runs commands declared in Markdown. The skill has no network upload path. Use for research or work needing 5+ tool calls.
精选 OthmanAdi/planning-with-files 2.7 万 原文
Claude CodeCodex CLICursor
planning-with-files
Persistent file-based planning for multi-step AI-agent work. Keeps task_plan.md, findings.md, and progress.md on disk; Gemini lifecycle hooks inject selected project planning context. Automatic recovery reads project planning files only. Explicit session-catchup.py --metadata reads same-project local agent session records and emits aggregate counts only; --replay may emit bounded nonce-framed excerpts. The session-end hook reports status only; it does not request continuation or run commands declared in Markdown. The skill has no network upload path. Use for research or work needing 5+ tool calls.
精选 OthmanAdi/planning-with-files 2.7 万 原文
Claude CodeCodex CLICursor
planning-with-files
Persistent file-based planning for multi-step AI-agent work. Keeps task_plan.md, findings.md, and progress.md on disk; lifecycle hooks inject selected project planning context. Automatic recovery reads project planning files only. Explicit session-catchup.py --metadata reads same-project local agent session records and emits aggregate counts only; --replay may emit bounded nonce-framed excerpts. Optional gated mode can request continuation only when the host supports it and never runs commands declared in Markdown. The skill has no network upload path. Use for research or work needing 5+ tool calls.
精选 OthmanAdi/planning-with-files 2.7 万 原文
Claude CodeCodex CLICursor
planning-with-files
Persistent file-based planning for multi-step AI-agent work. Keeps task_plan.md, findings.md, and progress.md on disk; Kiro skill instructions and steering state read selected project planning context. Recovery reads project planning files and their timestamps only, not agent transcript stores. This adapter registers no Stop hook, never requests continuation, and never runs commands declared in Markdown. The skill has no network upload path. Use for research or work needing 5+ tool calls.
精选 OthmanAdi/planning-with-files 2.7 万 原文
Claude CodeCodex CLICursor