AutoGen の README を翻訳します。AutoGen は、自律的に行動したり人間とともに作業可能なマルチエージェント API アプリケーションを作成するためのフレームワークです。
AutoGen マルチエージェント・フレームワーク : 概要
作成 : クラスキャット・セールスインフォメーション
作成日時 : 04/04/2025
* 本記事は github microsoft/autogen の以下のページを独自に翻訳した上でまとめ直し、補足説明を加えています :
* サンプルコードの動作確認はしておりますが、必要な場合には適宜、追加改変しています。
* ご自由にリンクを張って頂いてかまいませんが、sales-info@classcat.com までご一報いただけると嬉しいです。
◆ お問合せ : 下記までお願いします。
- クラスキャット セールス・インフォメーション
- sales-info@classcat.com
- ClassCatJP
AutoGen マルチエージェント・フレームワーク : 概要
AutoGen は、自律的に行動したり人間とともに作業可能なマルチエージェント API アプリケーションを作成するためのフレームワークです。
インストール
AutoGen は Python 3.10 またはそれ以降のバージョンが必要です。
# Install AgentChat and OpenAI client from Extensions
pip install -U "autogen-agentchat" "autogen-ext[openai]"
# Install AutoGen Studio for no-code GUI
pip install -U "autogenstudio"
クイックスタート
Hello World
OpenAI の GPT-4o モデルを使用してアシスタント・エージェントを作成します。他のサポートされているモデル を確認してください。
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
async def main() -> None:
model_client = OpenAIChatCompletionClient(model="gpt-4o")
agent = AssistantAgent("assistant", model_client=model_client)
print(await agent.run(task="Say 'Hello World!'"))
await model_client.close()
asyncio.run(main())
Web ブラウジング・エージェント・チーム
Web ブラウジング・タスク用に Web サーファー・エージェントとユーザ・プロキシ・エージェントを持つグループチャット・チームを作成します。playwright をインストールする必要があります。
# pip install -U autogen-agentchat autogen-ext[openai,web-surfer]
# playwright install
import asyncio
from autogen_agentchat.agents import 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")
# The web surfer will open a Chromium browser window to perform web browsing tasks.
web_surfer = MultimodalWebSurfer("web_surfer", model_client, headless=False, animate_actions=True)
# The user proxy agent is used to get user input after each step of the web surfer.
# NOTE: you can skip input by pressing Enter.
user_proxy = UserProxyAgent("user_proxy")
# The termination condition is set to end the conversation when the user types 'exit'.
termination = TextMentionTermination("exit", sources=["user_proxy"])
# Web surfer and user proxy take turns in a round-robin fashion.
team = RoundRobinGroupChat([web_surfer, user_proxy], termination_condition=termination)
try:
# Start the team and wait for it to terminate.
await Console(team.run_stream(task="Find information about AutoGen and write a short summary."))
finally:
await web_surfer.close()
await model_client.close()
asyncio.run(main())
AutoGen Studio
AutoGen Studio を使用して、コードを書くことなくマルチエージェント・ワークフローのプロトタイプを作成して実行できます。
# Run AutoGen Studio on http://localhost:8080
autogenstudio ui --port 8080 --appdir ./my-app
Why Use AutoGen?
AutoGen エコシステムは AI エージェント、特にマルチエージェント・ワークフローを作成するために必要なものすべて — フレームワーク、開発者ツール、そしてアプリケーションを提供します。
フレームワークは階層化された拡張可能な設計を使用しています。レイヤーは明確に分割された役割を持ち、下のレイヤーの上に構築されます。この設計は高位 API から低位コンポーネントまで、様々な抽象化レベルでフレームワークを使用することを可能にします。
- Core API は、柔軟で強力なメッセージパッシング、イベント駆動型エージェント、ローカル/分散ランタイムを実装しています。それはまた .NET と Python のためにクロス言語サポートもサポートしています。
- AgentChat API は、ラピッドプロトタイピングのためにより単純で設計思想の強い (opinionated) API を実装しています。この API は Core API 上に構築されており、v0.2 のユーザに馴染みのあるものに非常に近く、そして 2 エージェント・チャットやグループチャットのような一般的なマルチエージェント・パターンをサポートします。
- Extensions API は、ファーストパーティやサードパーティの拡張が継続的にフレームワークの機能を拡張できるようにします。それは LLM クライアント (e.g., OpenAI, AzureOpenAI) の特定の実装とコード実行のような機能をサポートします。
エコシステムはまた 2 つの不可欠な開発者ツールもサポートします :
- AutoGen Studio は、マルチエージェント・アプリケーションを構築するためのノーコード GUI を提供します。
- AutoGen Bench は、エージェント性能を評価するためのベンチマーク・スイートを提供します。
AutoGen フレームワークと開発者ツールを使用して独自ドメイン用のアプリケーションを作成できます。例えば、Magentic-One は、AgentChat API and Extensions API を使用して構築された最先端のマルチエージェント・チームで、Web ブラウジング、コード実行やファイル処理を必要とする様々なタスクを処理できます。
Legal Notices
(訳註: 原文 参照)
以上