Skip to main content

tanze · 探赜

探赜索隐,钩深致远 ——《周易·系辞上》

轻量深研算子:把一个公开可查的研究问题,走完「规划 → 检索 → 抓取 → 成稿」, 产出带来源编号的 Markdown 报告。零第三方依赖(纯 Python 标准库),单进程运行, 内存占用几十 MB 量级,提供脚本、MCP stdio 服务两种形态。

理念致谢:编排思路提炼自 bytedance/deer-flow(MIT)的 Deep Research 多智能体设计;本仓库代码为独立重写的轻量化实现,与上游无代码血缘。

为什么轻量复刻

deer-flow 完整形态需要 FastAPI 网关、Next.js 前端、Redis、无头浏览器与容器沙箱, 内存 800MB–1.2GB。tanze 只保留其核心编排逻辑,全部由标准库实现:

deer-flow 完整形态 tanze 轻量复刻
FastAPI 网关 + LangGraph 编排 单文件状态机,函数直调
Next.js 前端 无界面,输出 Markdown
Redis 会话存储 无状态,一次一研
Playwright 无头浏览器(250–500M/实例) Bing 检索 + 按需正文抓取
Docker 沙箱体系 复用宿主现有执行边界
内存 800M–1.2G 实测峰值 22–24MB

复刻哲学:功能可以复刻、架构可以复刻、逻辑可以复刻——代码算子由自己生成完善, 达到同样的功能与能力,而资源占用降低一个数量级。

用法

export TANZE_LLM_KEY=<密钥,不入档>
python3 tanze.py --mem "研究问题"

环境变量:TANZE_LLM_BASE(默认 ModelScope 推理 API,任何 OpenAI 兼容接口均可)、 TANZE_LLM_MODEL、TANZE_FETCH_LIMIT(正文抓取页数上限,默认 3)。

MCP stdio 服务

python3 mcp_server.py

JSON-RPC 2.0 over stdio,工具 research(question),任何 MCP 客户端可接。

流程

  1. plan:问题拆成 3 个互补搜索查询(LLM,JSON;严禁年份开头,避免命中日历类页面);
  2. search:逐查询 Bing 中国检索,取标题、链接、摘要;
  3. fetch:按序抓取正文(去脚本样式,单页截断 4000 字符,总量受 TANZE_FETCH_LIMIT 约束);
  4. report:材料汇总成稿,只用材料内信息,不足处明确标注,引用带来源编号。

边界

  • 搜索依赖 Bing 中国页面结构(b_algo 结果块),结构变更时需适配;
  • 正文抓取为单次拉取,无渲染引擎,动态页面拿不到的内容以摘要代替;
  • 仅适合公开可查的事实题;私有概念、需登录的数据不适用;
  • LLM 密钥经环境变量注入,不写入任何存储。

许可

MIT。

安装(PyPI)

pip install tanze          # 算子本体
pip install tanze          # 含 MCP 入口:tanze-mcp(stdio JSON-RPC 2.0)

命令行:tanze "研究问题"(加 --mem 输出内存峰值);MCP 服务:tanze-mcp。 密钥经环境变量 TANZE_LLM_KEY / TANZE_LLM_BASE / TANZE_LLM_MODEL 提供,不落盘。

Metadata

Release files for tanze 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tanze 0.1.1
File Size Uploaded Provenance Actions
tanze-0.1.1.tar.gz 10.4 kB Without provenance Details for tanze-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tanze 0.1.1
File Interpreter ABI Platform Actions
tanze-0.1.1-py3-none-any.whl Python 3 none any Details for tanze-0.1.1-py3-none-any.whl

Total release size: 21.4 kB

Release files / tanze-0.1.1.tar.gz

Download URL tanze-0.1.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
70839a90f65941f347cb37b7bca4e1f5e4fb19cd6dcf49804e35d0316ba669f9
BLAKE2b-256 checksum
How to use checksums
50355f1a27eb5fdca4840fbdb5f774280daeadb5a8079344a99bfa1855555acc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / tanze-0.1.1-py3-none-any.whl

Download URL tanze-0.1.1-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6eb03dd15e80a8abb5a021a93fbd96a1e96c3a7fad9b212c8ca3c5648fe07fd
BLAKE2b-256 checksum
How to use checksums
fb2a7cdcb68b412eafaa9c4bc78041f800398409eb9db194a00ac9414f19c4ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for tanze 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page