尧图网络 高端网站定制 · 原创设计
免费咨询热线
400-888-6620
免费获取方案
DeepSeek Harness 震撼发布!一切皆插件的 AI Agent 框架,附 10 分钟上手 Demo
导读2026 年 8 月 13 日DeepSeek 正式开源 DeepSeek Harness v0.1主打一切皆插件架构MIT 协议完全开源。本文带你 10 分钟上手手写第一个 AI Agent 插件为什么 DeepSeek Harness 值得关注在 AI Agent 框架百花齐放的 2026 年DeepSeek Harness 凭什么出圈特性DeepSeek HarnessLangGraphCrewAI架构模式插件化图工作流角色协作热插拔✅ 支持❌ 不支持❌ 不支持开源协议MITMITMIT多模型✅ 原生支持✅✅国产化✅❌❌学习成本中高低核心优势一切皆插件——模型、工具、技能、UI、沙箱全部插件化自由组合、替换、扩展 快速开始10 分钟上手 Demo环境准备# Node.js 版本要求 18.0node-v# 建议 v20# 克隆仓库gitclone https://github.com/deepseek-ai/deepseek-harness.gitcddeepseek-harness# 安装依赖npminstall# 构建核心npmrun build项目结构速览deepseek-harness/ ├── packages/ │ ├── core/ # 核心框架Cordis 元框架 │ ├── plugins/ # 官方插件 │ │ ├── model/ # 模型插件 │ │ ├── tool/ # 工具插件 │ │ └── ui/ # UI 插件 │ └── examples/ # 示例代码 ├── docs/ # 文档 └── package.json 实战手写第一个插件场景开发一个「天气查询」工具插件我们要创建一个简单的 AI Agent 插件让 AI 能够查询天气信息。Step 1创建插件项目# 创建插件目录mkdirweather-plugincdweather-plugin# 初始化 npm 项目npminit-y# 安装 Harness 核心依赖npminstalldeepseek-harness/coreStep 2编写插件代码创建src/weather-plugin.ts// src/weather-plugin.tsimport{Plugin,definePlugin}fromdeepseek-harness/core;// 定义插件配置接口interfaceWeatherPluginConfig{apiKey:string;defaultCity:string;}// 定义插件exportconstweatherPlugindefinePluginWeatherPluginConfig({name:weather-query,version:1.0.0,description:天气查询工具插件,// 插件激活时的初始化asyncsetup(config){console.log([Weather] 插件已激活默认城市${config.defaultCity});return{currentCity:config.defaultCity,apiKey:config.apiKey,};},// 插件提供的工具函数tools:{// 查询天气asyncgetWeather(ctx,city?:string){conststatectx.getPluginStateReturnTypetypeofthis.setup();consttargetCitycity||state.currentCity;// 模拟天气数据实际使用需调用 APIconstweatherData{city:targetCity,temperature:Math.floor(Math.random()*35)°C,condition:[晴,多云,小雨,阴天][Math.floor(Math.random()*4)],humidity:Math.floor(Math.random()*100)%,};return{success:true,data:weatherData,};},// 设置默认城市asyncsetDefaultCity(ctx,city:string){conststatectx.getPluginStateReturnTypetypeofthis.setup();state.currentCitycity;return{success:true,message:默认城市已设置为${city},};},},// 插件销毁时的清理asyncteardown(){console.log([Weather] 插件已卸载);},});exportdefaultweatherPlugin;Step 3创建插件入口创建src/index.ts// src/index.tsexport{weatherPlugin}from./weather-plugin;exporttype{WeatherPluginConfig}from./weather-plugin;Step 4编译插件创建tsconfig.json{compilerOptions:{target:ES2020,module:commonjs,lib:[ES2020],declaration:true,outDir:./dist,rootDir:./src,strict:true,esModuleInterop:true,skipLibCheck:true},include:[src/**/*],exclude:[node_modules,dist]}编译npx tscStep 5在 Harness 中注册插件创建src/app.ts主程序// src/app.tsimport{Harness}fromdeepseek-harness/core;import{weatherPlugin}from./weather-plugin;asyncfunctionmain(){// 创建 Harness 实例constharnessnewHarness({name:my-first-agent,version:1.0.0,});// 注册天气插件awaitharness.registerPlugin(weatherPlugin,{apiKey:your-api-key-here,// 实际使用需申请天气 APIdefaultCity:北京,});console.log(✅ Harness 启动成功);// 获取插件实例constweatherharness.getPlugin(weather-query);// 调用插件工具constresultawaitweather.tools.getWeather(null,上海);console.log(️ 天气查询结果:,result);// 设置默认城市awaitweather.tools.setDefaultCity(null,广州);// 再次查询使用默认城市constresult2awaitweather.tools.getWeather(null);console.log(️ 默认城市天气:,result2);}main().catch(console.error);Step 6运行 Demo# 编译主程序npx tsc src/app.ts--outDirdist# 运行nodedist/app.js预期输出[Weather] 插件已激活默认城市北京 ✅ Harness 启动成功 ️ 天气查询结果{ success: true, data: { city: 上海, temperature: 28°C, condition: 多云, humidity: 65% } } ️ 默认城市天气{ success: true, data: { city: 广州, temperature: 32°C, condition: 晴, humidity: 80% } } [Weather] 插件已卸载进阶多插件协作示例Harness 的强大之处在于插件自由组合。下面演示模型插件 工具插件的协作。完整示例AI 天气助手// src/ai-weather-agent.tsimport{Harness}fromdeepseek-harness/core;import{deepSeekModelPlugin}fromdeepseek-harness/model-deepseek;import{weatherPlugin}from./weather-plugin;asyncfunctionmain(){constharnessnewHarness({name:ai-weather-agent,version:1.0.0,});// 注册模型插件awaitharness.registerPlugin(deepSeekModelPlugin,{apiKey:process.env.DEEPSEEK_API_KEY,model:deepseek-chat,});// 注册天气插件awaitharness.registerPlugin(weatherPlugin,{apiKey:your-weather-api-key,defaultCity:北京,});// 获取插件constmodelharness.getPlugin(deepseek-model);constweatherharness.getPlugin(weather-query);// 用户输入constuserInput帮我查一下上海的天气然后用一句话总结;// 第一步让 AI 理解意图constintentawaitmodel.tools.chat({messages:[{role:user,content:userInput}],tools:[weather-query.getWeather],// 告知可用工具});// 第二步调用天气插件if(intent.toolCalls?.[0]?.namegetWeather){constweatherResultawaitweather.tools.getWeather(null,intent.toolCalls[0].args.city||上海);// 第三步让 AI 总结constsummaryawaitmodel.tools.chat({messages:[{role:user,content:userInput},{role:assistant,toolCalls:intent.toolCalls},{role:tool,content:JSON.stringify(weatherResult.data)},],});console.log( AI 总结:,summary.content);}}main().catch(console.error);运行效果 AI 总结上海今天多云气温 28°C湿度 65%适合外出活动。 插件类型大全DeepSeek Harness 支持多种插件类型下面是常见插件的开发模板1. 模型插件exportconstmyModelPlugindefinePlugin({name:my-model,tools:{asyncchat(ctx,messages:Message[]){// 调用 LLM APIreturnawaitcallLLM(messages);},},});2. 工具插件exportconstfilePlugindefinePlugin({name:file-operations,tools:{asyncreadFile(ctx,path:string){returnawaitfs.promises.readFile(path,utf-8);},asyncwriteFile(ctx,path:string,content:string){awaitfs.promises.writeFile(path,content);return{success:true};},},});3. UI 插件exportconstcliUiPlugindefinePlugin({name:cli-ui,hooks:{onOutput(output){console.log( 输出:,output);},},});4. 沙箱插件exportconstdockerSandboxPlugindefinePlugin({name:docker-sandbox,tools:{asyncexecute(ctx,code:string,language:string){// 在 Docker 容器中执行代码returnawaitdocker.run(code,language);},},}); 发布你的插件到 NPM# 完善 package.jsonnpmpkgsetkeywordsdeepseek-harness,plugin,ai-agentnpmpkgsetrepository.githubyour-username/your-plugin# 测试npmpack# 发布npmpublish--accesspublic发布后其他人可以npminstallyour-weather-plugin然后在 Harness 中使用import{weatherPlugin}fromyour-weather-plugin;awaitharness.registerPlugin(weatherPlugin,config); 实际应用场景场景 1AI 代码助手// 组合模型 文件 沙箱 代码审查插件harness.registerPlugin(deepSeekModelPlugin);harness.registerPlugin(filePlugin);harness.registerPlugin(dockerSandboxPlugin);harness.registerPlugin(codeReviewPlugin);// AI 可以读写文件 → 生成代码 → 沙箱运行 → 自动审查场景 2自动化测试 Agent// 组合模型 浏览器 测试 报告插件harness.registerPlugin(deepSeekModelPlugin);harness.registerPlugin(playwrightPlugin);harness.registerPlugin(testGeneratorPlugin);harness.registerPlugin(reportPlugin);// AI 可以分析需求 → 生成测试 → 执行 → 输出报告场景 3数据分析助手// 组合模型 SQL 可视化 报告插件harness.registerPlugin(deepSeekModelPlugin);harness.registerPlugin(sqlPlugin);harness.registerPlugin(chartPlugin);harness.registerPlugin(reportPlugin);// AI 可以理解问题 → 查询数据 → 生成图表 → 输出分析⚠️ 注意事项事项说明版本兼容性v0.1 预览版API 可能变动生产环境暂不建议用于生产等待 v1.0文档完善度部分文档仍在补充中社区支持新框架遇到问题需自行探索资源链接资源链接GitHub 仓库https://github.com/deepseek-ai/deepseek-harness官方文档https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/development.zh.mdAwesome 资源https://github.com/0xsline/awesome-deepseek-harness本文 Demo 代码可关注公众号回复harness获取写在最后deepseek Harness本质上主要是适用于前端 JS/TS的AI开发框架方便统一管理插件并不能直接应用于 Java/Python/Golang 乃至于客户端app的Android, IOS 鸿蒙开发等
RELATED

相关推荐

Peak CAN卡选型、软件使用与实战调试全指南

Peak CAN卡选型、软件使用与实战调试全指南

1. 从项目到工具:为什么需要一张专业的CAN卡?如果你正在开发汽车电子、工业控制或者机器人相关的项目,那么“CAN总线”这个词对你来说一定不陌生。它就像这些复杂系统里的“神经系统”,负责在各个控制器(ECU&#xff0…

📅 2026/10/12 3:50:02
现在才懂啊,儿子的家呀根本就不是我的家。昨天中午呢我孙子就跑到厨房啊,扒着门框喊说,爷爷饭好了没有我饿了。我把最后一道啊排骨端出来,我说好了,快喊你爸妈出来吃饭吧。儿媳妇呢就跟着从卧室啊走出来就往桌旁

现在才懂啊,儿子的家呀根本就不是我的家。昨天中午呢我孙子就跑到厨房啊,扒着门框喊说,爷爷饭好了没有我饿了。我把最后一道啊排骨端出来,我说好了,快喊你爸妈出来吃饭吧。儿媳妇呢就跟着从卧室啊走出来就往桌旁

现在才懂啊,儿子的家呀根本就不是我的家。昨天中午呢我孙子就跑到厨房啊,扒着门框喊说,爷爷饭好了没有我饿了。我把最后一道啊排骨端出来,我说好了,快喊你爸妈出来吃饭吧。儿媳妇呢就跟着从卧室啊走出来就往桌旁一坐。…

📅 2026/10/11 23:58:41
求职招聘大厂Java面试实录:JDK17、Redis分布式锁、Kafka投递削峰、Seata分布式事务、Spring AI+RAG智能匹配,谢飞机三轮被虐哭(附完整答案解析)

求职招聘大厂Java面试实录:JDK17、Redis分布式锁、Kafka投递削峰、Seata分布式事务、Spring AI+RAG智能匹配,谢飞机三轮被虐哭(附完整答案解析)

求职招聘大厂Java面试实录:JDK17、Redis分布式锁、Kafka投递削峰、Seata分布式事务、Spring AIRAG智能匹配,谢飞机三轮被虐哭(附完整答案解析) 面试公司背景 伯乐直聘——国内头部求职招聘平台,注册求职者2亿、企业用户…

📅 2026/10/14 11:37:49
MORE NEWS

更多资讯

📰

TIPSv1-So400m/14图像特征提取指南:cls_token、register_tokens与patch_tokens三分钟看懂

【免费下载链接】tipsv1-so400m14 项目地址: https://ai.gitcode.com/hf_mirrors/google/tipsv1-so400m14 点击查看 免费下载 TIPSv1-So400m/14 是谷歌开源的 TIPS 对比式视觉-语言模型中的 So400m 尺寸版本,一次 encode_image 调用即可输出三种图像特征…

📰

5 分钟跑通 iptv-checker:一次验证几百个 IPTV 频道

5 分钟跑通 iptv-checker:一次验证几百个 IPTV 频道 【免费下载链接】iptv-checker IPTV checker tool for Docker && CMD, check your playlist is available 项目地址: https://gitcode.com/GitHub_Trending/ip/iptv-checker 手里有一份几百个频道…

📰

Python 3步搞定图片文字识别:ArmorOCR-GGUF的OpenAI兼容API调用完全实战

人工智能大模型计算机视觉OCR多模态本地部署 【免费下载链接】ArmorOCR-GGUF 项目地址: https://ai.gitcode.com/hf_mirrors/inclusionAI/ArmorOCR-GGUF 点击查看 免费下载 ArmorOCR-GGUF 是视觉语言模型 ArmorOCR 的 GGUF 量化版本,基于 Qwen3-VL-8B-I…

📰

RepoPrompt CE项目全景:这个免费开源macOS应用如何让AI编码代理在行动前读懂你的代码库

【免费下载链接】repoprompt-ce Community edition of RepoPrompt: a native macOS context engineering app for AI coding agents, with an MCP CLI. 项目地址: https://gitcode.com/gh_mirrors/re/repoprompt-ce 点击查看 免费下载 RepoPrompt CE 是一款免费、开…

📰

RPCS3 更新显卡驱动后打不开?「Failed to open Vulkan」报错的四步排查法

RPCS3 更新显卡驱动后打不开?「Failed to open Vulkan」报错的四步排查法 【免费下载链接】rpcs3 PlayStation 3 emulator and debugger 项目地址: https://gitcode.com/GitHub_Trending/rp/rpcs3 更新显卡驱动后点启动 RPCS3,窗口闪一下就没了&a…

📰

网络原理:网络通信基础概念全面整理

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

TODAY

今日更新

THIS WEEK

本周精选

THIS MONTH

本月热门

读完文章,想聊聊您的网站?

告诉我们您的行业与需求,资深顾问一对一梳理方案与报价,全程免费。

📞 💬