Chonkie DeepResearch
Run deep research queries from your agent and get comprehensive reports with citations.
Setup
Before using, check if chdr is installed (which chdr). If not:
- 1. Install: INLINECODE2
- If
cargo isn't available, install Rust first:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- 2. Authenticate:
chdr auth login (opens browser to get an API key)
- Or set
CHONKIE_API_KEY environment variable
- Get a key at https://labs.chonkie.ai/settings/api-keys
Usage
IMPORTANT: Research takes 2-10 minutes. Always spawn a sub-agent to avoid blocking the main thread.
Running research (recommended: sub-agent)
Use sessions_spawn to run the research in a sub-agent. The sub-agent handles the long-running query and announces the result when done, so your main agent stays responsive.
CODEBLOCK0
Replace <QUERY> with the research query and <TIMESTAMP> with $(date +%s).
Monitoring research status
Do NOT poll continuously for status. Instead, set up a cron job to check periodically (every 2-3 minutes):
CODEBLOCK1
Or simply wait for the sub-agent to announce completion — it will report back automatically when the research finishes. The sub-agent approach is preferred over cron for one-off research queries.
After research completes
When the sub-agent announces completion:
- 1. The web URL is: INLINECODE11
- The full report is saved at INLINECODE12
- Read only the first 100 lines for a summary — NEVER load the entire file
- Tell the user you can answer questions about the report
Answering follow-up questions
- - Grep the
.md file to find relevant sections before reading - Use offset/limit to read only the matching section
- NEVER read the entire file into context — reports can be 20,000+ lines
Fallback: running without sub-agent
If sub-agents are unavailable, run the research command directly but warn the user it will block for several minutes:
CODEBLOCK2
Other commands
CODEBLOCK3
All commands that take an ID support prefix matching — chdr view 3a6b works if unambiguous.
Chonkie DeepResearch
从您的智能体运行深度研究查询,获取带有引用的全面报告。
设置
使用前,请检查是否已安装 chdr(which chdr)。若未安装:
- 1. 安装:cargo install chdr
- 如果 cargo 不可用,请先安装 Rust:curl --proto =https --tlsv1.2 -sSf https://sh.rustup.rs | sh
- 2. 认证:chdr auth login(将打开浏览器获取 API 密钥)
- 或设置 CHONKIE
APIKEY 环境变量
- 在 https://labs.chonkie.ai/settings/api-keys 获取密钥
使用方法
重要提示:研究过程需要 2-10 分钟。请始终生成子智能体以避免阻塞主线程。
运行研究(推荐:子智能体)
使用 sessions_spawn 在子智能体中运行研究。子智能体负责处理长时间运行的查询,并在完成后通知结果,这样您的主智能体就能保持响应状态。
json
{
tool: sessions_spawn,
task: 运行 chdr 研究并保存结果。步骤:\n1. 运行:chdr research --type report --no-stream --json \<查询内容>\ > /tmp/chdr-research-<时间戳>.json\n2. 提取 ID 和标题:python3 -c \import json; d=json.load(open(/tmp/chdr-research-<时间戳>.json)); print(d[id]); print(d.get(title,未命名))\\n3. 提取正文:python3 -c \import json; d=json.load(open(/tmp/chdr-research-<时间戳>.json)); print(d.get(content,{}).get(body,))\ > /tmp/chdr-research-<时间戳>.md\n4. 报告标题、ID 和 URL:https://labs.chonkie.ai/research/{id}
}
将 <查询内容> 替换为研究查询,将 <时间戳> 替换为 $(date +%s)。
监控研究状态
不要持续轮询状态。 而是设置一个定时任务定期检查(每 2-3 分钟):
bash
添加一个定时任务条目,每 2 分钟检查研究状态
定时任务应运行:chdr view --json | python3 -c import json,sys; d=json.load(sys.stdin); s=d.get(status,unknown); print(s)
并在状态变为 completed 或 failed 时通知您
或者直接等待子智能体宣布完成——研究完成后它会自动回传结果。对于一次性研究查询,子智能体方法优于定时任务。
研究完成后
当子智能体宣布完成时:
- 1. 网页 URL 为:https://labs.chonkie.ai/research/{id}
- 完整报告保存在 /tmp/chdr-research-<时间戳>.md
- 仅读取前 100 行获取摘要——切勿加载整个文件
- 告知用户您可以回答关于报告的问题
回答后续问题
- - 在读取前使用 grep 搜索 .md 文件找到相关章节
- 使用偏移量/限制仅读取匹配的章节
- 切勿将整个文件读入上下文——报告可能超过 20,000 行
备用方案:不使用子智能体运行
如果子智能体不可用,直接运行研究命令,但需警告用户这将阻塞几分钟:
bash
chdr research --type report --no-stream --json <查询内容> > /tmp/chdr-research.json
其他命令
bash
chdr ls # 列出最近的研究
chdr ls --limit 20 # 列出更多
chdr view # 查看报告(支持部分 ID 前缀)
chdr open # 在浏览器中打开
chdr delete # 删除报告
所有接受 ID 的命令都支持前缀匹配——如果无歧义,chdr view 3a6b 即可生效。