自然言語でタスクを与えると、そのタスクから実行計画とエージェント組織を自動生成し、そのエージェント組織でタスクを実行するシステムです。
- 自動タスク分析: 自然言語タスクを分析し、実行計画を生成
- 動的組織設計: タスクに最適なエージェント組織を自動設計
- エージェント自動生成: 必要な役割とスキルを持つエージェントを動的に生成
- 分散実行: マルチエージェントによる協調的なタスク実行
- リアルタイム監視: エージェント間の通信と実行状況をリアルタイム監視
- 自然言語タスクを分析し、実行計画を生成
- タスクの複雑度評価
- サブタスクへの分解
- 必要スキルの特定
- 実行計画に基づいてエージェント組織を設計
- エージェントロールの決定
- 組織構造の最適化
- 通信プロトコルの設定
- エージェントの動的生成と管理
- タスクのスケジューリング
- エージェント間通信の仲介
- 実行状況の監視
git clone https://github.com/your-repo/agent-generator.git
cd agent-generator
pip install -r requirements.txtimport asyncio
from src import AgentGeneratorSystem
async def main():
# システムを初期化
system = AgentGeneratorSystem()
# 自然言語でタスクを指定
task = "ユーザーの購買履歴を分析して、商品推薦レポートを作成してください"
# タスクを実行
result = await system.execute_task(task)
print(f"実行結果: {result['success']}")
print(f"メッセージ: {result['message']}")
asyncio.run(main())from src import AgentGeneratorSystem, SystemConfig
# カスタム設定
config = SystemConfig(
max_agents=15, # 最大エージェント数
execution_timeout=300, # 実行タイムアウト(秒)
enable_llm=True, # LLM使用の有効化
llm_model="gpt-4" # 使用するLLMモデル
)
system = AgentGeneratorSystem(config)task = """
新しいEコマースプラットフォームの開発プロジェクトを計画してください。
以下の機能を含める必要があります:
1. ユーザー認証システム
2. 商品カタログ管理
3. ショッピングカート機能
4. 決済システム統合
5. 在庫管理
6. レビュー・評価システム
各機能について設計、実装、テストの計画を立て、
必要なリソースと時間を見積もってください。
"""
result = await system.execute_task(task)システムには3つのデモモードが用意されています:
cd src
python main.py- シンプルなタスク: 基本機能のデモ
- 複雑なタスク: 大規模プロジェクトのデモ
- 対話型モード: リアルタイムでタスクを入力
システムは以下のエージェントロールを自動生成できます:
- Manager: プロジェクト管理、意思決定
- Analyst: データ分析、調査研究
- Developer: コード実装、システム開発
- Reviewer: 品質チェック、レビュー
- Coordinator: タスク調整、進捗管理
- Tester: テスト実行、品質保証
- Designer: UI/UX設計、アーキテクチャ設計
- Researcher: 情報収集、技術調査
- Documenter: ドキュメント作成、技術文書化
システムは4つの組織構造を自動選択できます:
- フラット型 (Flat): 簡単なタスクに適用
- 階層型 (Hierarchical): 複雑なタスクに適用
- マトリクス型 (Matrix): 非常に複雑なタスクに適用
- ネットワーク型 (Network): 特殊なタスクに適用
{
"task_id": "task_abc123",
"objective": "ユーザーの購買履歴を分析して、商品推薦レポートを作成",
"complexity": "moderate",
"phases": [
{
"phase_id": "phase_1",
"name": "データ収集",
"tasks": [
{
"task_id": "subtask_データ収集_1",
"description": "データ収集のサブタスク1",
"required_skills": ["research", "analysis"],
"estimated_duration": "30min"
}
]
}
],
"success_criteria": [
"分析結果が明確に文書化されていること",
"主要な発見事項が特定されていること"
]
}{
"organization_id": "org_xyz789",
"structure_type": "hierarchical",
"agents": [
{
"agent_id": "agent_000_manager",
"role": "Manager",
"capabilities": [
{
"skill_type": "planning",
"proficiency_level": 0.9,
"tools": ["task_tracker", "gantt_chart"]
}
],
"manages": ["agent_001_analyst", "agent_002_developer"]
}
]
}execute_task(task_description: str): タスクを実行get_execution_history(): 実行履歴を取得save_execution_history(filepath: str): 実行履歴をファイルに保存visualize_organization(organization): 組織構造を視覚化
enable_llm: bool: LLMの使用を有効化llm_model: str: 使用するLLMモデルmax_agents: int: 最大エージェント数execution_timeout: int: 実行タイムアウト(秒)enable_monitoring: bool: 監視機能の有効化log_level: str: ログレベル
実行状況は以下の形式で取得できます:
# リアルタイム実行状況
status = orchestrator.get_execution_status()
print(f"完了タスク: {status['completed_tasks']}/{status['total_tasks']}")
print(f"失敗タスク: {status['failed_tasks']}")
# 組織構造の視覚化
org_viz = system.visualize_organization(organization)
print(org_viz)from src.agent_executor import BaseAgent
class CustomAgent(BaseAgent):
async def execute_task(self, task):
# カスタムタスク実行ロジック
result = {"custom_result": True}
return result
async def process_message(self, message):
# カスタムメッセージ処理
return Nonefrom src.organization_designer import OrganizationDesigner
class CustomOrganizationDesigner(OrganizationDesigner):
def design_organization(self, execution_plan):
# カスタム組織設計ロジック
organization = super().design_organization(execution_plan)
# 追加のカスタマイズ
return organization- インポートエラー: パッケージが正しくインストールされているか確認
- 実行タイムアウト:
execution_timeoutを増やす - メモリ不足:
max_agentsを減らす
import logging
logging.basicConfig(level=logging.DEBUG)MIT License
プルリクエストやイシューの報告を歓迎します。
- 言語: Python 3.10+
- 非同期処理: asyncio
- データ構造: dataclasses, enum
- 通信: queue-based message passing
- アーキテクチャ: マイクロサービス風マルチエージェント
- LLMとの統合強化
- Web UIの追加
- パフォーマンス最適化
- 機械学習による組織最適化
- Docker対応
- API サーバー化