From f0a3cd02cedccae478319c0cf1db5e6f4a76f364 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 18 Aug 2025 14:32:58 +0000 Subject: [PATCH 1/4] Initial plan From ff76bcdcf9bd9dc256b41d75e86b59d7aa9bb484 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 18 Aug 2025 14:44:42 +0000 Subject: [PATCH 2/4] Add demo agents documentation and Makefile targets Co-authored-by: ks6088ts <1254960+ks6088ts@users.noreply.github.com> --- Makefile | 18 +++++++++++++++ docs/index.ja.md | 57 +++++++++++++++++++++++++++++++++++++++++------- docs/index.md | 57 +++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 116 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 117e6cc..9e49e32 100644 --- a/Makefile +++ b/Makefile @@ -215,3 +215,21 @@ run-task-decomposer-agent: ## run task decomposer agent --name task_decomposer_agent \ --question "KABUTOにログインできない。パスワードは合ってるはずなのに…若手社員である山田太郎は、Windows 11 を立ち上げ、日課のように自社の業務システムKABUTOのログイン画面を開きます。しかし、そこには、意味をなさない「虚無」という文字だけがただひっそりと表示されていたのです。これは質問でもあり不具合の報告でもあります。岡本太郎さんに本件調査依頼します。" \ --verbose + +.PHONY: run-weather-agent +run-weather-agent: ## run weather agent (demo) + uv run python scripts/demo_agents_operator.py weather-agent \ + --query "What's the weather in Japan?" \ + --verbose + +.PHONY: run-multi-agent +run-multi-agent: ## run multi agent (demo) + uv run python scripts/demo_agents_operator.py multi-agent \ + --query "What's the weather in Tokyo?" \ + --verbose + +.PHONY: run-parallel-processor-agent +run-parallel-processor-agent: ## run parallel processor agent (demo) + uv run python scripts/demo_agents_operator.py parallel-processor-agent \ + --goal "ソフトウェアシステム開発会社を立ち上げる戦略を立てるための情報収集をしたい" \ + --verbose diff --git a/docs/index.ja.md b/docs/index.ja.md index 4020c68..247be9e 100644 --- a/docs/index.ja.md +++ b/docs/index.ja.md @@ -91,6 +91,9 @@ uv run python scripts/elasticsearch_operator.py create-index \ - **`template_langgraph/`** - すべてのエージェント実装を含むメイン Python パッケージ - **`notebooks/`** - インタラクティブな例と説明付き Jupyter ノートブック - **`scripts/`** - エージェント実行用コマンドラインツール + - `agent_operator.py` - プロダクションエージェント用メインランナー + - `demo_agents_operator.py` - シンプルなデモエージェント用ランナー + - データ管理用各種オペレータースクリプト(`qdrant_operator.py`、`elasticsearch_operator.py` など) ### エージェントの例(`template_langgraph/agents/`) @@ -104,6 +107,14 @@ uv run python scripts/elasticsearch_operator.py create-index \ - `news_summarizer_agent/` — Web/YouTube 要約。取得 → 要約 → 通知。主要概念: 扇形サブタスク、Notifier/Scraper/Summarizer を差し替え。 - `image_classifier_agent/` — 画像分類。ローカル画像を分類し通知。主要概念: 画像 ×LLM、並列サブタスク。 +#### デモエージェント(`template_langgraph/agents/demo_agents/`) + +学習と実演用の追加シンプルエージェント: + +- `weather_agent.py` — シンプルなツール呼び出しエージェント。モック天気検索ツールを使った基本的な ReAct パターン。主要概念: ツール呼び出し、基本エージェントパターン。 +- `multi_agent.py` — マルチエージェント協調。転送機能を使ったエージェント間の引き渡しを実演。主要概念: エージェント協調、ワークフロー転送。 +- `parallel_processor_agent/` — 並列実行タスク分解。目標をタスクに分解し並列処理。主要概念: 並列処理、タスク分解、Send 操作。 + ### サポートモジュール - `template_langgraph/llms/`: LLM ラッパー(Azure OpenAI など) @@ -242,8 +253,36 @@ uv run python scripts/agent_operator.py image-classifier-agent \ --verbose ``` +### デモエージェント実行例 + +- Weather agent(シンプルなツール呼び出し): + +```shell +uv run python scripts/demo_agents_operator.py weather-agent \ + --query "日本の天気はどうですか?" \ + --verbose +``` + +- Multi agent(エージェント協調): + +```shell +uv run python scripts/demo_agents_operator.py multi-agent \ + --query "東京の天気はどうですか?" \ + --verbose +``` + +- Parallel processor agent(タスク分解): + +```shell +uv run python scripts/demo_agents_operator.py parallel-processor-agent \ + --goal "ソフトウェア会社立ち上げのための情報収集戦略を計画する" \ + --verbose +``` + Makefile のショートカット(例: `make run-chat-with-tools-agent`, `make run-issue-formatter-agent`, `make run-news-summarizer-agent`, `make run-image-classifier-agent`)も用意しています。 +デモエージェントのショートカット: `make run-weather-agent`, `make run-multi-agent`, `make run-parallel-processor-agent` + ## 実演されている主要概念 ### 1. **ReAct パターン**(推論 + 行動) @@ -319,9 +358,10 @@ make mcp-inspector ## 次のステップ 1. **基本から始める**: `kabuto_helpdesk_agent`の例を実行 -2. **実装を理解する**: `chat_with_tools_agent`と比較 -3. **高度なパターンを探索**: タスク分解器とスーパーバイザーエージェントを試す -4. **独自のものを構築**: このテンプレートをあなたのユースケースの出発点として使用 +2. **デモエージェントを試す**: `weather_agent`、`multi_agent`、`parallel_processor_agent`でシンプルなパターンを探索 +3. **実装を理解する**: `chat_with_tools_agent`と比較 +4. **高度なパターンを探索**: タスク分解器とスーパーバイザーエージェントを試す +5. **独自のものを構築**: このテンプレートをあなたのユースケースの出発点として使用 ## 可観測性(任意) @@ -340,10 +380,11 @@ uv run python scripts/otel_operator.py run -q "health check" -v このテンプレートは複数の実証済みエージェントアーキテクチャを実演しています: -1. **ツール付きシングルエージェント** - 基本的なツール呼び出しパターン -2. **ReAct エージェント** - ループでの推論と行動 -3. **構造化出力エージェント** - フォーマットされたデータの返却 -4. **計画エージェント** - 複雑なタスクの分解 -5. **スーパーバイザーエージェント** - 複数エージェントの協調 +1. **ツール付きシングルエージェント** - 基本的なツール呼び出しパターン(`weather_agent`) +2. **ReAct エージェント** - ループでの推論と行動(`kabuto_helpdesk_agent`) +3. **構造化出力エージェント** - フォーマットされたデータの返却(`issue_formatter_agent`) +4. **計画エージェント** - 複雑なタスクの分解(`task_decomposer_agent`) +5. **マルチエージェントシステム** - 複数エージェントの協調(`supervisor_agent`、`multi_agent`) +6. **並列処理** - 同時タスク実行(`parallel_processor_agent`) 各パターンは、いつどのように使用するかを理解するのに役立つ明確な例と文書で実装されています。 diff --git a/docs/index.md b/docs/index.md index c0c8a9a..9de0679 100644 --- a/docs/index.md +++ b/docs/index.md @@ -91,6 +91,9 @@ uv run python scripts/elasticsearch_operator.py create-index \ - **`template_langgraph/`** - Main Python package containing all agent implementations - **`notebooks/`** - Jupyter notebooks with interactive examples and explanations - **`scripts/`** - Command-line tools for running agents + - `agent_operator.py` - Main agent runner for production agents + - `demo_agents_operator.py` - Runner for simple demo agents + - Various operator scripts for data management (`qdrant_operator.py`, `elasticsearch_operator.py`, etc.) ### Agent Examples (`template_langgraph/agents/`) @@ -104,6 +107,14 @@ This project includes several agent implementations, each demonstrating differen - `news_summarizer_agent/` — Web/YouTube summarization. Scrapes content, summarizes to `StructuredArticle`, and notifies. Key: fan-out subtasks, notifier/scraper/summarizer plugins. - `image_classifier_agent/` — Vision classification. Classifies local images and notifies results. Key: LLM-based image classification, parallel subtasks. +#### Demo Agents (`template_langgraph/agents/demo_agents/`) + +Additional simple agents for learning and demonstration: + +- `weather_agent.py` — Simple tool-calling agent. Basic ReAct pattern with mock weather search tool. Key: tool calling, basic agent pattern. +- `multi_agent.py` — Multi-agent coordination. Demonstrates agent-to-agent handoff using transfer functions. Key: agent coordination, workflow transfer. +- `parallel_processor_agent/` — Task decomposition with parallel execution. Breaks down goals into tasks and processes them in parallel. Key: parallel processing, task decomposition, Send operations. + ### Supporting Modules - `template_langgraph/llms/`: LLM wrappers (Azure OpenAI, etc.) @@ -242,8 +253,36 @@ uv run python scripts/agent_operator.py image-classifier-agent \ --verbose ``` +### Demo agent runs + +- Weather agent (simple tool calling): + +```shell +uv run python scripts/demo_agents_operator.py weather-agent \ + --query "What's the weather in Japan?" \ + --verbose +``` + +- Multi agent (agent coordination): + +```shell +uv run python scripts/demo_agents_operator.py multi-agent \ + --query "What's the weather in Tokyo?" \ + --verbose +``` + +- Parallel processor agent (task decomposition): + +```shell +uv run python scripts/demo_agents_operator.py parallel-processor-agent \ + --goal "Plan information gathering strategy for launching a software company" \ + --verbose +``` + Makefile shortcuts are also available (e.g., `make run-chat-with-tools-agent`, `make run-issue-formatter-agent`, `make run-news-summarizer-agent`, `make run-image-classifier-agent`). +Demo agent shortcuts: `make run-weather-agent`, `make run-multi-agent`, `make run-parallel-processor-agent`. + ## Key Concepts Demonstrated ### 1. **ReAct Pattern** (Reasoning + Acting) @@ -321,9 +360,10 @@ make mcp-inspector ## Next Steps 1. **Start with the basics**: Run the `kabuto_helpdesk_agent` example -2. **Understand the implementation**: Compare it with `chat_with_tools_agent` -3. **Explore advanced patterns**: Try the task decomposer and supervisor agents -4. **Build your own**: Use this template as a starting point for your use case +2. **Try demo agents**: Explore the simple patterns with `weather_agent`, `multi_agent`, and `parallel_processor_agent` +3. **Understand the implementation**: Compare it with `chat_with_tools_agent` +4. **Explore advanced patterns**: Try the task decomposer and supervisor agents +5. **Build your own**: Use this template as a starting point for your use case ## Observability (optional) @@ -342,10 +382,11 @@ uv run python scripts/otel_operator.py run -q "health check" -v This template demonstrates several proven agent architectures: -1. **Single Agent with Tools** - Basic tool-calling pattern -2. **ReAct Agent** - Reasoning and acting in loops -3. **Structured Output Agent** - Returning formatted data -4. **Planning Agent** - Breaking down complex tasks -5. **Supervisor Agent** - Coordinating multiple agents +1. **Single Agent with Tools** - Basic tool-calling pattern (`weather_agent`) +2. **ReAct Agent** - Reasoning and acting in loops (`kabuto_helpdesk_agent`) +3. **Structured Output Agent** - Returning formatted data (`issue_formatter_agent`) +4. **Planning Agent** - Breaking down complex tasks (`task_decomposer_agent`) +5. **Multi-Agent Systems** - Coordinating multiple agents (`supervisor_agent`, `multi_agent`) +6. **Parallel Processing** - Concurrent task execution (`parallel_processor_agent`) Each pattern is implemented with clear examples and documentation to help you understand when and how to use them. From f50e508ffd786f9f262e026606186d07860e698d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 18 Aug 2025 14:49:59 +0000 Subject: [PATCH 3/4] Complete documentation updates with LLM wrappers and scripts Co-authored-by: ks6088ts <1254960+ks6088ts@users.noreply.github.com> --- docs/index.ja.md | 25 +++++++++++++++++++++++-- docs/index.md | 25 +++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/docs/index.ja.md b/docs/index.ja.md index 247be9e..f085f52 100644 --- a/docs/index.ja.md +++ b/docs/index.ja.md @@ -83,6 +83,20 @@ uv run python scripts/elasticsearch_operator.py create-index \ --verbose ``` +**任意: 追加データソースの設定:** + +```shell +# Azure AI Search +make create-ai-search-index + +# Azure Cosmos DB +make create-cosmosdb-index + +# またはオペレータースクリプトを直接使用: +# uv run python scripts/ai_search_operator.py add-documents --verbose +# uv run python scripts/cosmosdb_operator.py add-documents --verbose +``` + ## プロジェクト構造 ### コアコンポーネント @@ -93,7 +107,9 @@ uv run python scripts/elasticsearch_operator.py create-index \ - **`scripts/`** - エージェント実行用コマンドラインツール - `agent_operator.py` - プロダクションエージェント用メインランナー - `demo_agents_operator.py` - シンプルなデモエージェント用ランナー - - データ管理用各種オペレータースクリプト(`qdrant_operator.py`、`elasticsearch_operator.py` など) + - データベース/検索オペレーター(`qdrant_operator.py`、`elasticsearch_operator.py`、`ai_search_operator.py`、`cosmosdb_operator.py`) + - LLM テストオペレーター(`azure_openai_operator.py`、`azure_ai_foundry_operator.py`、`ollama_operator.py`) + - その他ユーティリティ(`dify_operator.py`、`otel_operator.py`) ### エージェントの例(`template_langgraph/agents/`) @@ -117,7 +133,7 @@ uv run python scripts/elasticsearch_operator.py create-index \ ### サポートモジュール -- `template_langgraph/llms/`: LLM ラッパー(Azure OpenAI など) +- `template_langgraph/llms/`: LLM ラッパー(Azure OpenAI、Azure AI Foundry、Ollama) - `template_langgraph/tools/`: ツール実装 - Azure AI Search(`ai_search_tool.py`) - Azure Cosmos DB Vector Search(`cosmosdb_tool.py`) @@ -328,6 +344,11 @@ LangGraph が複数のインタラクションステップにわたってコン - `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_API_VERSION` - `AZURE_OPENAI_MODEL_CHAT`, `AZURE_OPENAI_MODEL_EMBEDDING`, `AZURE_OPENAI_MODEL_REASONING` - Entra ID 認証の任意設定: `AZURE_OPENAI_USE_MICROSOFT_ENTRA_ID=true` +- Azure AI Foundry + - `AZURE_AI_FOUNDRY_INFERENCE_ENDPOINT`, `AZURE_AI_FOUNDRY_INFERENCE_API_VERSION` + - `AZURE_AI_FOUNDRY_INFERENCE_MODEL_CHAT` +- Ollama(ローカル) + - `OLLAMA_MODEL_CHAT` - Azure AI Search - `AI_SEARCH_ENDPOINT`, `AI_SEARCH_KEY`, `AI_SEARCH_INDEX_NAME` - Azure Cosmos DB(ベクター) diff --git a/docs/index.md b/docs/index.md index 9de0679..2ae7b3b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -83,6 +83,20 @@ uv run python scripts/elasticsearch_operator.py create-index \ --verbose ``` +**Optional: Set up additional data sources:** + +```shell +# Azure AI Search +make create-ai-search-index + +# Azure Cosmos DB +make create-cosmosdb-index + +# Or use the operator scripts directly: +# uv run python scripts/ai_search_operator.py add-documents --verbose +# uv run python scripts/cosmosdb_operator.py add-documents --verbose +``` + ## Project Structure ### Core Components @@ -93,7 +107,9 @@ uv run python scripts/elasticsearch_operator.py create-index \ - **`scripts/`** - Command-line tools for running agents - `agent_operator.py` - Main agent runner for production agents - `demo_agents_operator.py` - Runner for simple demo agents - - Various operator scripts for data management (`qdrant_operator.py`, `elasticsearch_operator.py`, etc.) + - Database/search operators (`qdrant_operator.py`, `elasticsearch_operator.py`, `ai_search_operator.py`, `cosmosdb_operator.py`) + - LLM testing operators (`azure_openai_operator.py`, `azure_ai_foundry_operator.py`, `ollama_operator.py`) + - Other utilities (`dify_operator.py`, `otel_operator.py`) ### Agent Examples (`template_langgraph/agents/`) @@ -117,7 +133,7 @@ Additional simple agents for learning and demonstration: ### Supporting Modules -- `template_langgraph/llms/`: LLM wrappers (Azure OpenAI, etc.) +- `template_langgraph/llms/`: LLM wrappers (Azure OpenAI, Azure AI Foundry, Ollama) - `template_langgraph/tools/`: Tool implementations used by agents - Azure AI Search (`ai_search_tool.py`) - Azure Cosmos DB Vector Search (`cosmosdb_tool.py`) @@ -328,6 +344,11 @@ The default toolset is configured in `template_langgraph/tools/common.py` and in - `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_API_VERSION` - `AZURE_OPENAI_MODEL_CHAT`, `AZURE_OPENAI_MODEL_EMBEDDING`, `AZURE_OPENAI_MODEL_REASONING` - Optional Entra ID auth: `AZURE_OPENAI_USE_MICROSOFT_ENTRA_ID=true` +- Azure AI Foundry + - `AZURE_AI_FOUNDRY_INFERENCE_ENDPOINT`, `AZURE_AI_FOUNDRY_INFERENCE_API_VERSION` + - `AZURE_AI_FOUNDRY_INFERENCE_MODEL_CHAT` +- Ollama (local) + - `OLLAMA_MODEL_CHAT` - Azure AI Search - `AI_SEARCH_ENDPOINT`, `AI_SEARCH_KEY`, `AI_SEARCH_INDEX_NAME` - Azure Cosmos DB (vector) From 3f92b40dcfdba2f9f6d9f43081039cf6690a189e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 18 Aug 2025 14:59:16 +0000 Subject: [PATCH 4/4] Remove Makefile targets for demo agents per user request Co-authored-by: ks6088ts <1254960+ks6088ts@users.noreply.github.com> --- Makefile | 18 ------------------ docs/index.ja.md | 2 -- docs/index.md | 2 -- 3 files changed, 22 deletions(-) diff --git a/Makefile b/Makefile index 9e49e32..117e6cc 100644 --- a/Makefile +++ b/Makefile @@ -215,21 +215,3 @@ run-task-decomposer-agent: ## run task decomposer agent --name task_decomposer_agent \ --question "KABUTOにログインできない。パスワードは合ってるはずなのに…若手社員である山田太郎は、Windows 11 を立ち上げ、日課のように自社の業務システムKABUTOのログイン画面を開きます。しかし、そこには、意味をなさない「虚無」という文字だけがただひっそりと表示されていたのです。これは質問でもあり不具合の報告でもあります。岡本太郎さんに本件調査依頼します。" \ --verbose - -.PHONY: run-weather-agent -run-weather-agent: ## run weather agent (demo) - uv run python scripts/demo_agents_operator.py weather-agent \ - --query "What's the weather in Japan?" \ - --verbose - -.PHONY: run-multi-agent -run-multi-agent: ## run multi agent (demo) - uv run python scripts/demo_agents_operator.py multi-agent \ - --query "What's the weather in Tokyo?" \ - --verbose - -.PHONY: run-parallel-processor-agent -run-parallel-processor-agent: ## run parallel processor agent (demo) - uv run python scripts/demo_agents_operator.py parallel-processor-agent \ - --goal "ソフトウェアシステム開発会社を立ち上げる戦略を立てるための情報収集をしたい" \ - --verbose diff --git a/docs/index.ja.md b/docs/index.ja.md index f085f52..82f590f 100644 --- a/docs/index.ja.md +++ b/docs/index.ja.md @@ -297,8 +297,6 @@ uv run python scripts/demo_agents_operator.py parallel-processor-agent \ Makefile のショートカット(例: `make run-chat-with-tools-agent`, `make run-issue-formatter-agent`, `make run-news-summarizer-agent`, `make run-image-classifier-agent`)も用意しています。 -デモエージェントのショートカット: `make run-weather-agent`, `make run-multi-agent`, `make run-parallel-processor-agent` - ## 実演されている主要概念 ### 1. **ReAct パターン**(推論 + 行動) diff --git a/docs/index.md b/docs/index.md index 2ae7b3b..31015d4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -297,8 +297,6 @@ uv run python scripts/demo_agents_operator.py parallel-processor-agent \ Makefile shortcuts are also available (e.g., `make run-chat-with-tools-agent`, `make run-issue-formatter-agent`, `make run-news-summarizer-agent`, `make run-image-classifier-agent`). -Demo agent shortcuts: `make run-weather-agent`, `make run-multi-agent`, `make run-parallel-processor-agent`. - ## Key Concepts Demonstrated ### 1. **ReAct Pattern** (Reasoning + Acting)