重磅!微软发布AutoGen 0.4!

微软全面重写了其著名的Agent框架AutoGen,朝着企业级部署迈出了关键一步!

这次不是简单的升级,而是彻底的重建

微软研究院刚刚发布的AutoGen 0.4完全重新设计了整个框架,只为解决一个问题:如何让AI Agent系统真正具备企业级部署能力

痛点驱动的重构

过去一年,AutoGen确实展现了Agent系统的巨大潜力。但随着使用规模扩大,各种问题逐渐浮出水面:架构约束太死、API效率低下、调试功能有限……

Jack Gerrits(@jack_gerrits) 给出了Ollama接入方案:

Ollama可以通过OpenAI兼容的API使用,我们也在开发原生的Ollama客户端,很快就会推出。

全新异步架构

为了解决这些问题,AutoGen 0.4采用了异步事件驱动架构,带来了一系列重要突破:

「可观察性」:内置指标追踪、消息追踪和调试工具,还支持OpenTelemetry实现企业级监控。

「异步消息」:Agent之间通过异步消息通信,支持事件驱动和请求/响应交互模式。

「跨语言支持」:目前已支持Python和.NET,未来还会支持更多编程语言。

「模块化设计」:用户可以轻松定制系统,包括自定义Agent、工具、记忆和模型。

要使用AutoGen,你需要先安装相关包:

# 安装AgentChat和OpenAI扩展
pip install -U "autogen-agentchat" "autogen-ext[openai]"

# 安装AutoGen Studio的GUI界面
pip install -U "autogenstudio"

最简单的Hello World示例:

import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient

async def main() -> None:
    agent = AssistantAgent("assistant", OpenAIChatCompletionClient(model="gpt-4o"))
    print(await agent.run(task="Say 'Hello World!'"))

asyncio.run(main())

如果要创建一个多Agent团队,代码如下:

import asyncio
from autogen_agentchat.agents import AssistantAgent, UserProxyAgent
from autogen_agentchat.conditions import TextMentionTermination
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.ui import Console
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.agents.web_surfer import MultimodalWebSurfer

async def main() -> None:
    model_client = OpenAIChatCompletionClient(model="gpt-4o")
    assistant = AssistantAgent("assistant", model_client)
    web_surfer = MultimodalWebSurfer("web_surfer", model_client)
    user_proxy = UserProxyAgent("user_proxy")
    termination = TextMentionTermination("exit")
    team = RoundRobinGroupChat([web_surfer, assistant, user_proxy], 
                             termination_condition=termination)
    await Console(team.run_stream(task="Find information about AutoGen and write a summary."))

asyncio.run(main())

开发者工具升级

AutoGen 0.4还带来了一整套升级版的开发工具:

「AutoGen Studio」:基于0.4的AgentChat API重建,提供了实时Agent更新、执行过程控制、交互式反馈等功能。启动方式很简单:

# 在 http://localhost:8080 运行AutoGen Studio
autogenstudio ui --port 8080 --appdir ./my-app

AutoGen团队(@pyautogen)表示:

基本的记忆协议已经可用。更复杂的记忆实现也将很快推出。

「AutoGen Bench」:帮助开发者在不同任务和环境中对Agent进行基准测试。

「Magentic-One」:全新的通用多Agent应用,专门用于解决复杂的网络和文件任务。

Mid Season Group(@MidSeasonGroup)就提到:

我们要用AutoGen和semantic kernel以及Ollama连接器来帮助偏远地区的教育者。

社区反馈积极

SamWise(@Feni__Sam)评价道:

很期待看到这项技术能让开发者甚至非开发者都能使用。这是下一个技术前沿。

John Thilén(@JohnThilen)补充:

AutoGen已经兼容MemGPT一段时间了。不过0.4.0发布后我还没确认是否仍然兼容。

微软强调,这次重构为Agent AI应用和研究奠定了坚实基础

接下来,他们将发布.NET支持,推出更多针对特定领域的应用和扩展,并致力于打造一个社区驱动的生态系统。

相关链接:

  • GitHub仓库:https://github.com/microsoft/autogen
  • 文档:https://microsoft.github.io/autogen/
  • Discord社区:https://aka.ms/autogen-discord
  • X:https://twitter.com/pyautogen
  • LinkedIn:https://www.linkedin.com/company/105812540

注意:AutoGen需要Python 3.10或更高版本

如果你正在从AutoGen v0.2升级,请参考迁移指南:

https://microsoft.github.io/autogen/dev/user-guide/agentchat-user-guide/migration-guide.html

(文:AGI Hunt)

发表评论