AutoGen#
AutoGen
用于构建 AI 代理和应用程序的框架
一个用于构建对话式单代理和多代理应用程序的编程框架。基于 Core 构建。需要 Python 3.10+。
# pip install -U "autogen-agentchat" "autogen-ext[openai]"
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())
如果您正在使用 Python 进行代理原型设计,请从这里开始。 从 AutoGen 0.2 迁移?。
与外部服务或其他库接口的 Core 和 AgentChat 组件的实现。您可以查找和使用社区扩展或创建自己的扩展。内置扩展的示例
McpWorkbench
用于使用模型-上下文协议 (MCP) 服务器。OpenAIAssistantAgent
用于使用 Assistant API。DockerCommandLineCodeExecutor
用于在 Docker 容器中运行模型生成的代码。GrpcWorkerAgentRuntime
用于分布式代理。