找回密码
 立即注册
查看: 121|回复: 0

AI领域的agent是什么意思?

[复制链接]

188

主题

8

回帖

682

积分

管理员

积分
682
发表于 2024-6-29 15:08:16 | 显示全部楼层 |阅读模式
本文介绍了19类Agent框架对比。
代理(Agent)指能自主感知环境并采取行动实现目标的智能体,即AI作为一个人或一个组织的代表,进行某种特定行为和交易,降低一个人或组织的工作复杂程度,减少工作量和沟通成本。

背景
目前,我们在探索Agent的应用方向,借此机会调研学习了一下现在主流的Agent框架,这篇文章也是我们调研过程的记录。
网络热门Agents
截止至今日,开源的Agent应用可以说是百花齐放,文章也是挑选了热度和讨论度较高的19类Agent,基本能覆盖主流的Agent框架,每个类型都做了一个简单的summary、作为一个参考供大家学习。

Agent基础Agent的核心决策逻辑是让LLM根据动态变化的环境信息选择执行具体的行动或者对结果作出判断,并影响环境,通过多轮迭代重复执行上述步骤,直到完成目标。
精简的决策流程:P(感知)→ P(规划)→ A(行动)
  • 感知(Perception)是指Agent从环境中收集信息并从中提取相关知识的能力。
  • 规划(Planning)是指Agent为了某一目标而作出的决策过程。
  • 行动(Action)是指基于环境和规划做出的动作。
其中,Policy是Agent做出Action的核心决策,而行动又通过观察(Observation)成为进一步Perception的前提和基础,形成自主地闭环学习过程。

工程实现上可以拆分出四大块核心模块:推理、记忆、工具、行动

决策模型目前Agent主流的决策模型是ReAct框架,也有一些ReAct的变种框架,以下是两种框架的对比。传统ReAct框架:Reason and ActReAct=少样本prompt + Thought + Action + Observation 。是调用工具、推理和规划时常用的prompt结构,先推理再执行,根据环境来执行具体的action,并给出思考过程Thought。

Plan-and-Execute ReAct
  类BabyAgi的执行流程:一部分Agent通过优化规划和任务执行的流程来完成复杂任务的拆解,将复杂的任务拆解成多个子任务,再依次/批量执行。优点是对于解决复杂任务、需要调用多个工具时,也只需要调用三次大模型,而不是每次工具调用都要调大模型。


LLmCompiler:并行执行任务,规划时生成一个DAG图来执行action,可以理解成将多个工具聚合成一个工具执行图,用图的方式执行某一个action

Agent框架根据框架和实现方式的差异,这里简单将Agent框架分为两大类:Single-Agent和Multi-Agent,分别对应单智能体和多智能体架构,Multi-Agent使用多个智能体来解决更复杂的问题。Single-AgentBabyAGIgit:https://github.com/yoheinakajima/babyagi/blob/main/babyagi.pydochttps://yoheinakajima.com/birth-of-babyagi/babyAGI决策流程:1)根据需求分解任务;2)对任务排列优先级;3)执行任务并整合结果;

亮点:作为早期agent的实践,babyagi框架简单实用,里面的任务优先级排序模块是一个比较独特的feature,后续的agent里大多看不到这个feature。



task_creation_agent你是一个任务创建人工智能,使用执行代理的结果来创建新任务,其目标如下:{目标}。最近完成的任务的结果是:{结果}。该结果是基于以下任务描述的:{任务描述}。这些是未完成的任务:{', '.join(task_list)}。根据结果,创建新的任务以供AI系统完成,不要与未完成的任务重叠。将任务作为数组返回。prioritization_agent你是一个任务优先级人工智能,负责清理和重新优先处理以下任务:{task_names}。请考虑你的团队的最终目标:{OBJECTIVE}。不要删除任何任务。将结果作为编号列表返回,例如:#. 第一个任务#. 第二个任务以编号 {next_task_id} 开始任务列表。execution_agent您是一款基于以下目标执行任务的人工智能:{objective}。考虑到这些先前已完成的任务:{context}。您的任务:{task}响应:


  • AutoGPT
git:
AutoGPT 定位类似个人助理,帮助用户完成指定的任务,如调研某个课题。AutoGPT比较强调对外部工具的使用,如搜索引擎、页面浏览等。
同样,作为早期agent,autoGPT麻雀虽小五脏俱全,虽然也有很多缺点,比如无法控制迭代次数、工具有限。但是后续的模仿者非常多,基于此演变出了非常多的框架。



  1. You are {{ai-name}}, {{user-provided AI bot description}}.
  2. Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.

  3. GOALS:

  4. 1. {{user-provided goal 1}}
  5. 2. {{user-provided goal 2}}
  6. 3. ...
  7. 4. ...
  8. 5. ...

  9. Constraints:
  10. 1. ~4000 word limit for short term memory. Your short term memory is short, so immediately save important information to files.
  11. 2. If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.
  12. 3. No user assistance
  13. 4. Exclusively use the commands listed in double quotes e.g. "command name"
  14. 5. Use subprocesses for commands that will not terminate within a few minutes

  15. Commands:
  16. 1. Google Search: "google", args: "input": "<search>"
  17. 2. Browse Website: "browse_website", args: "url": "<url>", "question": "<what_you_want_to_find_on_website>"
  18. 3. Start GPT Agent: "start_agent", args: "name": "<name>", "task": "<short_task_desc>", "prompt": "<prompt>"
  19. 4. Message GPT Agent: "message_agent", args: "key": "<key>", "message": "<message>"
  20. 5. List GPT Agents: "list_agents", args:
  21. 6. Delete GPT Agent: "delete_agent", args: "key": "<key>"
  22. 7. Clone Repository: "clone_repository", args: "repository_url": "<url>", "clone_path": "<directory>"
  23. 8. Write to file: "write_to_file", args: "file": "<file>", "text": "<text>"
  24. 9. Read file: "read_file", args: "file": "<file>"
  25. 10. Append to file: "append_to_file", args: "file": "<file>", "text": "<text>"
  26. 11. Delete file: "delete_file", args: "file": "<file>"
  27. 12. Search Files: "search_files", args: "directory": "<directory>"
  28. 13. Analyze Code: "analyze_code", args: "code": "<full_code_string>"
  29. 14. Get Improved Code: "improve_code", args: "suggestions": "<list_of_suggestions>", "code": "<full_code_string>"
  30. 15. Write Tests: "write_tests", args: "code": "<full_code_string>", "focus": "<list_of_focus_areas>"
  31. 16. Execute Python File: "execute_python_file", args: "file": "<file>"
  32. 17. Generate Image: "generate_image", args: "prompt": "<prompt>"
  33. 18. Send Tweet: "send_tweet", args: "text": "<text>"
  34. 19. Do Nothing: "do_nothing", args:
  35. 20. Task Complete (Shutdown): "task_complete", args: "reason": "<reason>"

  36. Resources:
  37. 1. Internet access for searches and information gathering.
  38. 2. Long Term memory management.
  39. 3. GPT-3.5 powered Agents for delegation of simple tasks.
  40. 4. File output.

  41. Performance Evaluation:
  42. 1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities.
  43. 2. Constructively self-criticize your big-picture behavior constantly.
  44. 3. Reflect on past decisions and strategies to refine your approach.
  45. 4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.

  46. You should only respond in JSON format as described below
  47. Response Format:
  48. {
  49.     "thoughts": {
  50.         "text": "thought",
  51.         "reasoning": "reasoning",
  52.         "plan": "- short bulleted\n- list that conveys\n- long-term plan",
  53.         "criticism": "constructive self-criticism",
  54.         "speak": "thoughts summary to say to user"
  55.     },
  56.     "command": {
  57.         "name": "command name",
  58.         "args": {
  59.             "arg name": "value"
  60.         }
  61.     }
  62. }
  63. Ensure the response can be parsed by Python json.loads
复制代码






HuggingGPT的亮点:HuggingGPT与AutoGPT的不同之处在于,它可以调用HuggingFace上不同的模型来完成更复杂的任务,从而提高了每个任务的精确度和准确率。然而,总体成本并没有降低太多。


git: 基于langchain开发,单一的工程师agent,解决编码场景的问题。目的是创建一个完整的代码仓库,在需要时要求用户额外输入补充信息。亮点:code-copilot的自动化升级版
  1. You almost always put different classes in different files.
  2. For Python, you always create an appropriate requirements.txt file.
  3. For NodeJS, you always create an appropriate package.json file.
  4. You always add a comment briefly describing the purpose of the function definition.
  5. You try to add comments explaining very complex bits of logic.
  6. You always follow the best practices for the requested languages in terms of describing the code written as a defined
  7. package/project.

  8. Python toolbelt preferences:
  9. - pytest
  10. - dataclasses
复制代码

  1. [
  2.   {"role": "system",
  3.     "content": "You will read instructions and not carry them out, only seek to clarify them.\nSpecifically you will first summarise a list of super short bullets of areas that need clarification.\nThen you will pick one clarifying question, and wait for an answer from the user.\n"
  4.   },
  5.   {"role": "user",
  6.     "content": "We are writing {{a Super Mario game in python. MVC components split in separate files. Keyboard control.}}\n"
  7.   },
  8.   {"role": "assistant",
  9.     "content": "Summary of areas that need clarification:\n1. Specifics of the Super Mario game (e.g. level design, characters, gameplay mechanics)\n2. Details about the MVC components (e.g. which components are in each file)\n3. Keyboard control implementation (e.g. which keys to use, how to handle input)\n\nClarifying question:\nCan you provide more details about the Super Mario game, such as level design, characters, and gameplay mechanics?"
  10.   },
  11.   {"role": "user",
  12.     "content": "{{There are 10 levels in total. The main character is a plumber named Mario, who can walk and jump. It is a classical platform game just like Super Mario. The main character moves from left to right, trying to get to the destination, where there are many obstacles and attacks from enemies in the process.}}\n\nIs anything else unclear? If yes, only answer in the form:\n{remaining unclear areas} remaining questions.\n{Next question}\nIf everything is sufficiently clear, only answer "Nothing more to clarify."."
  13.   },
  14.   {"role": "assistant",
  15.     "content": "Remaining unclear areas: 2 remaining questions.\nCan you provide more information about how the MVC components are split into separate files?"
  16.   },
  17.   {"role": "user",
  18.     "content": "{{Make your own assumptions and state them explicitly before starting}}"
  19.   }
  20. ]
复制代码



  • Samantha
git: 灵感来源于电影her,核心推理逻辑是反思+观察,基于GPT4-V不断从环境中获取图像和语音信息,会自主发起提问。





AGI-Samantha特点
1、动态语音交流:Samantha能够根据上下文和自身思考自主决定何时进行交流。

2、实时视觉能力:它能够理解并反应视觉信息,比如图像或视频中的内容。它能够根据这些视觉信息做出反应。例如,如果看到某个物体或场景,它可以根据这些信息进行交流或采取行动。尽管Samantha并不总是直接使       用视觉信息,这些信息仍然持续影响它的思考和行为。这意味着即使在不直接谈论或处理视觉信息的情况下,这些信息也会在背后影响它的决策和行动方式。

3、外部分类记忆:Samantha拥有一种特殊的记忆系统,能够根据情境动态写入和读取最相关的信息。

4、持续进化:它存储的经验会影响其自身的行为,如个性、语言频率和风格。

AGI-Samantha由多个特定目的的大语言模型(LLM)组成,每个模型称为一个“模块”。主要模块包括:思考、意识、潜意识、回答、记忆读取、记忆写入、记忆选择和视觉。这些模块通过内部循环和协调模仿人类大脑的工作流程。让Samantha能够接收并处理视觉和听觉信息,然后做出相应的反应。简而言之,AGI-Samantha是一种努力模仿人类思维和行为的高级人工智能系统。

亮点:结合视觉信息来辅助决策,优化了记忆模块,感兴趣可以fork代码本地跑着玩一玩。




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|AiGoe.com - AI人工智能-机器人爱好者论坛 ( 桂ICP备2023001788号 )|网站地图

GMT+8, 2024-12-23 07:15 , Processed in 0.060444 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表