claude-to-deerflow by bytedance/deer-flow
npx skills add https://github.com/bytedance/deer-flow --skill claude-to-deerflow通过 HTTP API 与正在运行的 DeerFlow 实例进行通信。DeerFlow 是一个基于 LangGraph 构建的 AI 智能体平台,它协调子智能体进行研究、代码执行、网页浏览等任务。
DeerFlow 在 Nginx 反向代理后暴露两个 API 接口:
| 服务 | 直接端口 | 通过代理 | 用途 |
|---|---|---|---|
| Gateway API | 8001 | $DEERFLOW_GATEWAY_URL | REST 端点(模型、技能、记忆、上传) |
| LangGraph API | 2024 | $DEERFLOW_LANGGRAPH_URL | 智能体线程、运行、流式传输 |
所有 URL 均可通过环境变量配置。在发起任何请求之前,请先读取这些环境变量。
| 变量 | 默认值 |
|---|
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 描述 |
|---|
DEERFLOW_URL | http://localhost:2026 | 统一代理基础 URL |
DEERFLOW_GATEWAY_URL | ${DEERFLOW_URL} | Gateway API 基础 URL(模型、技能、记忆、上传) |
DEERFLOW_LANGGRAPH_URL | ${DEERFLOW_URL}/api/langgraph | LangGraph API 基础 URL(线程、运行) |
在使用 curl 调用时,请始终按以下方式解析 URL:
# 从环境变量解析基础 URL(在任何 API 调用之前首先执行此操作)
DEERFLOW_URL="${DEERFLOW_URL:-http://localhost:2026}"
DEERFLOW_GATEWAY_URL="${DEERFLOW_GATEWAY_URL:-$DEERFLOW_URL}"
DEERFLOW_LANGGRAPH_URL="${DEERFLOW_LANGGRAPH_URL:-$DEERFLOW_URL/api/langgraph}"
验证 DeerFlow 是否正在运行:
curl -s "$DEERFLOW_GATEWAY_URL/health"
这是主要操作。它会创建一个线程并流式传输智能体的响应。
步骤 1:创建一个线程
curl -s -X POST "$DEERFLOW_LANGGRAPH_URL/threads" \
-H "Content-Type: application/json" \
-d '{}'
响应:{"thread_id": "<uuid>", ...}
步骤 2:流式传输一个运行
curl -s -N -X POST "$DEERFLOW_LANGGRAPH_URL/threads/<thread_id>/runs/stream" \
-H "Content-Type: application/json" \
-d '{
"assistant_id": "lead_agent",
"input": {
"messages": [
{
"type": "human",
"content": [{"type": "text", "text": "在此处输入您的消息"}]
}
]
},
"stream_mode": ["values", "messages-tuple"],
"stream_subgraphs": true,
"config": {
"recursion_limit": 1000
},
"context": {
"thinking_enabled": true,
"is_plan_mode": true,
"subagent_enabled": true,
"thread_id": "<thread_id>"
}
}'
响应是一个 SSE 流。每个事件的格式为:
event: <event_type>
data: <json_data>
关键事件类型:
metadata — 运行元数据,包括 run_idvalues — 包含 messages 数组的完整状态快照messages-tuple — 增量消息更新(AI 文本块、工具调用、工具结果)end — 流传输完成上下文模式(通过 context 设置):
thinking_enabled: false, is_plan_mode: false, subagent_enabled: falsethinking_enabled: true, is_plan_mode: false, subagent_enabled: falsethinking_enabled: true, is_plan_mode: true, subagent_enabled: falsethinking_enabled: true, is_plan_mode: true, subagent_enabled: true要发送后续消息,请重用步骤 2 中的相同 thread_id,并使用新消息 POST 另一个运行。
curl -s "$DEERFLOW_GATEWAY_URL/api/models"
返回:{"models": [{"name": "...", "provider": "...", ...}, ...]}
curl -s "$DEERFLOW_GATEWAY_URL/api/skills"
返回:{"skills": [{"name": "...", "enabled": true, ...}, ...]}
curl -s -X PUT "$DEERFLOW_GATEWAY_URL/api/skills/<skill_name>" \
-H "Content-Type: application/json" \
-d '{"enabled": true}'
curl -s "$DEERFLOW_GATEWAY_URL/api/agents"
返回:{"agents": [{"name": "...", ...}, ...]}
curl -s "$DEERFLOW_GATEWAY_URL/api/memory"
返回用户上下文、事实和对话历史摘要。
curl -s -X POST "$DEERFLOW_GATEWAY_URL/api/threads/<thread_id>/uploads" \
-F "files=@/path/to/file.pdf"
支持 PDF、PPTX、XLSX、DOCX — 自动转换为 Markdown。
curl -s "$DEERFLOW_GATEWAY_URL/api/threads/<thread_id>/uploads/list"
curl -s "$DEERFLOW_LANGGRAPH_URL/threads/<thread_id>/history"
curl -s -X POST "$DEERFLOW_LANGGRAPH_URL/threads/search" \
-H "Content-Type: application/json" \
-d '{"limit": 20, "sort_by": "updated_at", "sort_order": "desc"}'
要发送消息并收集完整响应,请使用辅助脚本:
bash /path/to/skills/claude-to-deerflow/scripts/chat.sh "您的问题在此"
实现细节请参见 scripts/chat.sh。该脚本:
流返回 SSE 事件。要从 values 事件中提取最终的 AI 响应:
event: values 块data JSONmessages 数组包含所有消息;最后一个 type: "ai" 的消息即为响应content 字段是 AI 的文本回复每周安装次数
22
代码仓库
GitHub 星标数
27.8K
首次出现
2 天前
安全审计
安装于
codex21
opencode21
gemini-cli20
amp20
cline20
github-copilot20
Communicate with a running DeerFlow instance via its HTTP API. DeerFlow is an AI agent platform built on LangGraph that orchestrates sub-agents for research, code execution, web browsing, and more.
DeerFlow exposes two API surfaces behind an Nginx reverse proxy:
| Service | Direct Port | Via Proxy | Purpose |
|---|---|---|---|
| Gateway API | 8001 | $DEERFLOW_GATEWAY_URL | REST endpoints (models, skills, memory, uploads) |
| LangGraph API | 2024 | $DEERFLOW_LANGGRAPH_URL | Agent threads, runs, streaming |
All URLs are configurable via environment variables. Read these env vars before making any request.
| Variable | Default | Description |
|---|---|---|
DEERFLOW_URL | http://localhost:2026 | Unified proxy base URL |
DEERFLOW_GATEWAY_URL | ${DEERFLOW_URL} | Gateway API base (models, skills, memory, uploads) |
DEERFLOW_LANGGRAPH_URL | ${DEERFLOW_URL}/api/langgraph | LangGraph API base (threads, runs) |
When making curl calls, always resolve the URL like this:
# Resolve base URLs from env (do this FIRST before any API call)
DEERFLOW_URL="${DEERFLOW_URL:-http://localhost:2026}"
DEERFLOW_GATEWAY_URL="${DEERFLOW_GATEWAY_URL:-$DEERFLOW_URL}"
DEERFLOW_LANGGRAPH_URL="${DEERFLOW_LANGGRAPH_URL:-$DEERFLOW_URL/api/langgraph}"
Verify DeerFlow is running:
curl -s "$DEERFLOW_GATEWAY_URL/health"
This is the primary operation. It creates a thread and streams the agent's response.
Step 1: Create a thread
curl -s -X POST "$DEERFLOW_LANGGRAPH_URL/threads" \
-H "Content-Type: application/json" \
-d '{}'
Response: {"thread_id": "<uuid>", ...}
Step 2: Stream a run
curl -s -N -X POST "$DEERFLOW_LANGGRAPH_URL/threads/<thread_id>/runs/stream" \
-H "Content-Type: application/json" \
-d '{
"assistant_id": "lead_agent",
"input": {
"messages": [
{
"type": "human",
"content": [{"type": "text", "text": "YOUR MESSAGE HERE"}]
}
]
},
"stream_mode": ["values", "messages-tuple"],
"stream_subgraphs": true,
"config": {
"recursion_limit": 1000
},
"context": {
"thinking_enabled": true,
"is_plan_mode": true,
"subagent_enabled": true,
"thread_id": "<thread_id>"
}
}'
The response is an SSE stream. Each event has the format:
event: <event_type>
data: <json_data>
Key event types:
metadata — run metadata including run_idvalues — full state snapshot with messages arraymessages-tuple — incremental message updates (AI text chunks, tool calls, tool results)end — stream is completeContext modes (set via context):
thinking_enabled: false, is_plan_mode: false, subagent_enabled: falsethinking_enabled: true, is_plan_mode: false, subagent_enabled: falsethinking_enabled: true, is_plan_mode: true, subagent_enabled: falsethinking_enabled: true, is_plan_mode: true, subagent_enabled: trueTo send follow-up messages, reuse the same thread_id from step 2 and POST another run with the new message.
curl -s "$DEERFLOW_GATEWAY_URL/api/models"
Returns: {"models": [{"name": "...", "provider": "...", ...}, ...]}
curl -s "$DEERFLOW_GATEWAY_URL/api/skills"
Returns: {"skills": [{"name": "...", "enabled": true, ...}, ...]}
curl -s -X PUT "$DEERFLOW_GATEWAY_URL/api/skills/<skill_name>" \
-H "Content-Type: application/json" \
-d '{"enabled": true}'
curl -s "$DEERFLOW_GATEWAY_URL/api/agents"
Returns: {"agents": [{"name": "...", ...}, ...]}
curl -s "$DEERFLOW_GATEWAY_URL/api/memory"
Returns user context, facts, and conversation history summaries.
curl -s -X POST "$DEERFLOW_GATEWAY_URL/api/threads/<thread_id>/uploads" \
-F "files=@/path/to/file.pdf"
Supports PDF, PPTX, XLSX, DOCX — automatically converts to Markdown.
curl -s "$DEERFLOW_GATEWAY_URL/api/threads/<thread_id>/uploads/list"
curl -s "$DEERFLOW_LANGGRAPH_URL/threads/<thread_id>/history"
curl -s -X POST "$DEERFLOW_LANGGRAPH_URL/threads/search" \
-H "Content-Type: application/json" \
-d '{"limit": 20, "sort_by": "updated_at", "sort_order": "desc"}'
For sending messages and collecting the full response, use the helper script:
bash /path/to/skills/claude-to-deerflow/scripts/chat.sh "Your question here"
See scripts/chat.sh for the implementation. The script:
The stream returns SSE events. To extract the final AI response from a values event:
event: values blockdata JSONmessages array contains all messages; the last one with type: "ai" is the responsecontent field of that message is the AI's text replyWeekly Installs
22
Repository
GitHub Stars
27.8K
First Seen
2 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
codex21
opencode21
gemini-cli20
amp20
cline20
github-copilot20
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
56,200 周安装
Firebase应用托管基础教程:部署Next.js、Angular全栈Web应用
297 周安装
智能代码探索工具smart-explore:AST解析结构化代码搜索与导航
297 周安装
GrepAI Ollama 本地安装配置教程 - 私有化代码搜索嵌入模型设置指南
297 周安装
YouTube 全功能工具包:转录、搜索、频道分析 API | TranscriptAPI.com 集成
297 周安装
Firebase AI Logic 入门指南:为移动和Web应用集成Gemini生成式AI
297 周安装
UX设计原则与可用性启发式指南 | 用户研究、设计思维、尼尔森十大原则
297 周安装