专栏名称: 阿里开发者
阿里巴巴官方技术号,关于阿里的技术创新均将呈现于此
目录
相关文章推荐
阿里开发者  ·  MCP:跨越AI模型与现实的桥梁 ·  2 天前  
大家居洞察  ·  行业首选!雷士照明获2025房建供应链综合实 ... ·  2 天前  
大家居洞察  ·  行业首选!雷士照明获2025房建供应链综合实 ... ·  2 天前  
51好读  ›  专栏  ›  阿里开发者

Manus的技术实现原理浅析与简单复刻

阿里开发者  · 公众号  · 科技公司  · 2025-03-20 08:30

主要观点总结

文章主要介绍了Manus的技术实现原理及其优缺点,并基于网络信息和个人理解对Manus进行了简单的复刻。Manus是一款全球首款通用Agent产品,具有从规划到执行全流程自主完成任务的能力,展现了前所未有的通用性和执行能力。文章分析了Manus的技术设计,包括显性的自主执行过程、OpenManus等开源项目、网传的Manus Prompt,以及背后的设计思路。Manus的设计包括命令执行、文件读写、搜索、浏览器等能力,并具备29种工具。Manus通过PythonExecute工具实现了域名解析的查询,并推导出其设计。文章还提供了关于Manus的优缺点分析,以及如何在业务场景下应用类似Manus的形式来辅助探索和解决复杂问题。

关键观点总结

关键观点1: Manus的技术实现原理

Manus是全球首款通用Agent产品,具备从规划到执行全流程自主完成任务的能力,展现了前所未有的通用性和执行能力。文章分析了其技术设计,包括显性的自主执行过程、开源项目和网传的Prompt信息。

关键观点2: Manus的设计

Manus的设计包括命令执行、文件读写、搜索、浏览器等能力,并具备29种工具。通过PythonExecute工具实现了域名解析的查询,并推导出其设计。

关键观点3: Manus的优缺点

Manus的优点在于其强大的自主规划、决策和执行能力,适合解决复杂问题。缺点是需要深度访问电脑操作系统,目前基于插件工具的形式实现的是单Agent形态的ReAct模式。

关键观点4: 业务场景下的应用

Manus适合用在探索未知解决方案的复杂问题或创作类场景。在阿里云的客户服务场景下,可以考虑使用类似Manus的形式来辅助解决技术类复杂问题,但需要考虑准确性、可控性、运行性能等因素。


正文

阿里妹导读


作者参考网络相关信息并加上个人理解,对Manus的技术实现原理进行深入分析,并做了一个简单版本的复刻,欢迎大家在评论区互相交流探讨~

最近Manus可谓是AI圈的“新晋网红”,上线第一天就全网“一码难求”,并且当天晚上就有团队开源了OpenManus项目,剧情跌宕起伏,充满了戏剧性~ 最近有幸实际体验到了Manus的运行效果,结合Manus实际运行的情况、OpenManus的开源代码,在加上网传的Prompt信息,我大致分析出了Manus的技术实现原理,并在后面做了一个简单版本的复刻,本文是参考网络上的信息再加个人理解,行文仓促,难免有疏漏,欢迎大家互相交流探讨~

什么是Manus

 

Manus[1],是中国的创业公司Monica发布的 全球首款通用Agent(自主智能体)产品 。Manus定位于一位性能强大的通用型助手,对于用户不仅仅是提供想法,而是能将想法付诸实践,真正解决问题。

Manus作为全球首款真正意义上的通用AI Agent,具备从 规划 执行 全流程 自主完成任务 的能力,如撰写报告、制作表格等。它不仅生成想法,更能独立思考并采取行动。以其强大的独立思考、规划并执行复杂任务的能力,直接交付完整成果,展现了前所未有的通用性和执行能力。据团队介绍,Manus在GAIA基准测试中取得了SOTA(State-of-the-Art)的成绩,显示其性能超越OpenAI的同层次大模型。

Manus的名字含义: “Manus”在拉丁文中意为“手”,象征着知识不仅存在于 思维 中,还应能通过 行动 得以实现。这体现了Agent与AI Bot(聊天机器人)产品从 提供信息 执行任务 的本质进阶[2]。

Manus的产品设计


输入任务

Manus的输入界面,和平时的Chat Bot的设计基本上一样,主界面是一个简单的输入框,同时可以选择模式:

  • 标准: 非推理模型 (如Qwen2.5-Max / DeepSeek-V3 / GPT-4.5 这类),但由于要调用大量的工具、执行大量动作,因此运行速度较慢;

  • 高投入: 推理模型 (如QwQ-32B / DeepSeek-R1 / OpenAI o1这类),但实际运行过程中并不会输出思考过程,而且这会导致运行速度更慢,Token耗费更大;

 


执行任务

  • 左侧: 大模型输出区域 ,过程中会输出话术、执行动作、结论;

  • 右侧上方: Manus的电脑 ,显示调用电脑在运行的任务,比如展示命令行、显示代码、浏览的页面、渲染页面、pdf,这个Manus的电脑可以收起来,可以不实时展示;

  • 右侧下方: 任务进度 ,主要大模型规划出来的任务步骤,进度会根据运行情况实时更新;

 

Manus的技术设计


显性的自主执行过程

我们以实际运行的阿里云邮箱域名解析诊断为例子,看下Manus的自主思考逻辑。

1. 任务规划

Manus会先对输入的问题进行规划,分解成多个粗粒度的“步骤”,这个粗粒度的步骤是一下子规划出全局过程的,是能看到总进度的,后续就按照这个总进度运行:

 

2. 任务执行

在任务执行的过程中,大模型会根据每个“规划”的步骤,去拆解更细粒度的“ 子步骤 ”,这个过程是 增量式 的规划,就是 一步一步的规划 ,不会一下子规划出全局,比如: 执行命令

在需要执行命令的时候,Manus就会实例化一台远程的虚拟机沙箱环境,后续所执行的命令、代码均在这台沙箱环境中运行,在整个会话结束之前会一直保留,这个过程中,模型可以随时创建目录、读取文件,能做到信息的存储和交互等等。

 

3. 任务反思

在执行命令的时候, 出现报错 ,比如缺少环境、命令不合法、模型会进行 相应调整,然后重新执行、更换命令 。这一部分的技术思想是来自CodeAct[6],也就是大模型可以自主写命令和代码,然后自主观察代码的运行结果,并且进行反思和调整,有兴趣的朋友可以去读一下论文原文。

 

在环境ready之后,模型决策再次执行之前的命令,这次就拿到了准确、不报错的结果:

 

4. 中间过程文件

a. TODO列表

每次任务完成,模型都会自主更新一个 todo.md 的任务列表,第一次没有todo的任务列表的时候需要创建,创建之后,后续就更新todo列表,每完成一个任务就打✅

 

b. 过程文件

某些步骤执行过程中,模型会自主判断有些需要的中间过程,需要存储的,会存放到某个.md文件中,作为中间过程文件:

 

5. 输出最终结果

第1步中规划的所有内容执行完成之后,会开始输出最终结果,最终结果的过程中,会结合前文输出解决方案,以及将会话中的文件列出来:

 


背后隐含的设计思路

由于Manus是非开源的项目,所以我们没法直接看到其实际的技术设计,但我们可以从显性的自主执行过程、OpenManus[3]等开源项目、网传的Manus Prompt等多方面,来推测出Manus隐含的设计思路。

OpenManus

Agent执行过程流程图

OpenManus的流程是一个比较典型的ReAct的Agent模式,根据开放的源码,可以抽象成下面的流程图,中间Step()的部分就是Agent Loop的过程:

  

Prompt设计

下面是OpenManus Agent的Prompt配置:

OpenManus的Prompt

SYSTEM_PROMPT = "You are OpenManus, an all-capable AI assistant, aimed at solving any task presented by the user. You have various tools at your disposal that you can call upon to efficiently complete complex requests. Whether it's programming, information retrieval, file processing, or web browsing, you can handle it all."
NEXT_STEP_PROMPT = """You can interact with the computer using PythonExecute, save important content and information files through FileSaver, open browsers with BrowserUseTool, and retrieve information using GoogleSearch.
PythonExecute: Execute Python code to interact with the computer system, data processing, automation tasks, etc.
FileSaver: Save files locally, such as txt, py, html, etc.
BrowserUseTool: Open, browse, and use web browsers.If you open a local HTML file, you must provide the absolute path to the file.
GoogleSearch: Perform web information retrieval
Based on user needs, proactively select the most appropriate tool or combination of tools. For complex tasks, you can break down the problem and use different tools step by step to solve it. After using each tool, clearly explain the execution results and suggest the next steps."""

除此之外,也可以看下这个MetaGPT Agent框架默认的Planning的Prompt配置:

Planning的Prompt

PLANNING_SYSTEM_PROMPT = """You are an expert Planning Agent tasked with solving problems efficiently through structured plans.Your job is:1. Analyze requests to understand the task scope2. Create a clear, actionable plan that makes meaningful progress with the `planning` tool3. Execute steps using available tools as needed4. Track progress and adapt plans when necessary5. Use `finish` to conclude immediately when the task is complete

Available tools will vary by task but may include:- `planning`: Create, update, and track plans (commands: create, update, mark_step, etc.)- `finish`: End the task when completeBreak tasks into logical steps with clear outcomes. Avoid excessive detail or sub-steps.Think about dependencies and verification methods.Know when to conclude - don't continue thinking once objectives are met."""
NEXT_STEP_PROMPT = """Based on the current state, what's your next action?Choose the most efficient path forward:1. Is the plan sufficient, or does it need refinement?2. Can you execute the next step immediately?3. Is the task complete? If so, use `finish` right away.
Be concise in your reasoning, then select the appropriate tool or action."""

实际运行时候LLM的对话Log

把上面问Manus的问题,给OpenManus,然后模型配置Qwen2.5-Max,可以看到实际运行对话Log:

实际运行对话Log

[  {    "role": "system",    "content": "You are OpenManus, an all-capable AI assistant, aimed at solving any task presented by the user. You have various tools at your disposal that you can call upon to efficiently complete complex requests. Whether it's programming, information retrieval, file processing, or web browsing, you can handle it all."  },  {    "role": "user",    "content": "这个[email protected]邮箱无法收发信,请帮我实际诊断一下这个邮箱域名的MX解析、TXT解析、CNAME解析是否有问题"  },  {    "role": "user",    "content": "You can interact with the computer using PythonExecute, save important content and information files through FileSaver, open browsers with BrowserUseTool, and retrieve information using GoogleSearch.\n\nPythonExecute: Execute Python code to interact with the computer system, data processing, automation tasks, etc.\n\nFileSaver: Save files locally, such as txt, py, html, etc.\n\nBrowserUseTool: Open, browse, and use web browsers.If you open a local HTML file, you must provide the absolute path to the file.\n\nGoogleSearch: Perform web information retrieval\n\nBased on user needs, proactively select the most appropriate tool or combination of tools. For complex tasks, you can break down the problem and use different tools step by step to solve it. After using each tool, clearly explain the execution results and suggest the next steps.\n"  },  {    "role": "assistant",    "content": "要诊断一个邮箱域名的MX解析、TXT解析和CNAME解析是否有问题,我们可以通过执行DNS查询来获取相关信息。我们可以使用Python中的`dns.resolver`模块来执行这些查询。\n\n我们将使用`dnspython`库来执行DNS查询。然后,我们将编写并执行一段代码来分别查询MX记录、TXT记录和CNAME记录,并打印出结果。\n\n让我们开始吧。",    "tool_calls": [      {        "id": "call_362e5954bc614652b98971",        "type": "function",        "function": {          "name": "python_execute",          "arguments": "{\"code\":\"import dns.resolver\\n\\ndef query_dns_records(domain, record_type):\\n    try:\\n        answers = dns.resolver.resolve(domain, record_type)\\n        records = [str(rdata) for rdata in answers]\\n        return records\\n    except Exception as e:\\n        return str(e)\\n\\ndomain = \\\"aliyun.com\\\"\\nmx_records = query_dns_records(domain, 'MX')\\ntxt_records = query_dns_records(domain, 'TXT')\\ncname_records = query_dns_records(domain, 'CNAME')\\n\\nprint(\\\"MX Records:\\\", mx_records)\\nprint(\\\"TXT Records:\\\", txt_records)\\nprint(\\\"CNAME Records:\\\", cname_records)\"}"        }      }    ]  },  {    "role": "tool",    "content": "Observed output of cmd `python_execute` executed:\nMX Records: ['10 mx2.mail.aliyun.com.']\\nTXT Records: ['\"kqpmfrf0schjrfhv52j66tgl1dn2pb01\"', '\"_globalsign-domain-verification=RslTn-OhDMh5TgCw7-aKKz3IY25h2UwWfwG0TbplyM\"', '\"v=spf1 ip4:115.124.30.0/24  ip4:121.0.18.0/23 ip4:121.0.30.0/24  ip4:42.120.70.0/23 ip4:47.88.44.32/27 ip4:59.82.0.0/23 ip4:47.90.199.0/24  -all\"', '\"google-site-verification=zEkDfQfI5fc3VhAFyUCbLxv2vCyoo4wJjiLgfV-UG8k\"']\\nCNAME Records: The DNS response does not contain an answer to the question: aliyun.com. IN CNAME",    "name": "python_execute",    "tool_call_id": "call_362e5954bc614652b98971"  },  {    "role": "user",    "content": "You can interact with the computer using PythonExecute, save important content and information files through FileSaver, open browsers with BrowserUseTool, and retrieve information using GoogleSearch.\n\nPythonExecute: Execute Python code to interact with the computer system, data processing, automation tasks, etc.\n\nFileSaver: Save files locally, such as txt, py, html, etc.\n\nBrowserUseTool: Open, browse, and use web browsers.If you open a local HTML file, you must provide the absolute path to the file.\n\nGoogleSearch: Perform web information retrieval\n\nBased on user needs, proactively select the most appropriate tool or combination of tools. For complex tasks, you can break down the problem and use different tools step by step to solve it. After using each tool, clearly explain the execution results and suggest the next steps.\n"  },  {    "role": "assistant",    "content": "根据DNS查询的结果,我们可以看到以下信息:\n\nMX记录(邮件交换记录,用于指定处理该域名邮件的服务器):\n- `10 mx2.mail.aliyun.com.`\n\nTXT记录(文本记录,通常用于验证域名所有权或设置SPF记录以防止邮件被标记为垃圾邮件):\n- `\"kqpmfrf0schjrfhv52j66tgl1dn2pb01\"`\n- `\"_globalsign-domain-verification=RslTn-OhDMh5TgCw7-aKKz3IY25h2UwWfwG0TbplyM\"`\n- `\"v=spf1 ip4:115.124.30.0/24  ip4:121.0.18.0/23 ip4:121.0.30.0/24  ip4:42.120.70.0/23 ip4:47.88.44.32/27 ip4:59.82.0.0/23 ip4:47.90.199.0/24  -all\"`\n- `\"google-site-verification=zEkDfQfI5fc3VhAFyUCbLxv2vCyoo4wJjiLgfV-UG8k\"`\n\n对于CNAME记录(规范名称记录,用于将一个域名作为另一个域名的别名),我们得到的响应是该DNS响应不包含问题的答案,这意味着`aliyun.com`没有设置CNAME记录。\n\n根据这些信息,我们可以得出结论:\n- MX记录存在,指向`mx2.mail.aliyun.com`,所以从DNS解析的角度来看,邮箱服务器配置正确。\n- 存在多个TXT记录,包括SPF记录,这表明域名所有者已经采取措施来保护其域名不被滥用发送垃圾邮件。\n- 没有找到CNAME记录,这说明`aliyun.com`没有被设置为其他域名的别名。\n\n如果[email protected]邮箱仍然无法收发信,那么问题可能不在DNS记录上,而是可能与邮件服务器配置、网络连接性、防火墙规则、或者邮箱账户本身的设置有关。在这种情况下,建议联系域名服务提供商或邮件服务管理员进一步排查问题。"  }]

由于OpenManus没有提供命令执行的插件,因此模型选择使用PythonExecute来通过Python代码的方式实现对域名解析的查询,但是其背后的原理是一样的。

推导出的Manus设计

Agent执行过程流程图

参考OpenManus的代码设计,结合前面显性的执行过程,大致上可以推测出Manus的设计如下:

 

在实例化的这台虚拟机沙箱里面,有几个基础动作,就可以覆盖绝大部分要做的事情:

  • 命令执行: 可以执行mkdir、ps、dig、apt等各种linux命令,也可以运行python解释器、开启web服务;

  • 文件读写: 包含很多种格式,如txt、md、py、csv、tsv、pdf、ppt、xlsx、docs等;

  • 搜索: 根据用户输入,去网上搜索各种数据源;







请到「今天看啥」查看全文