コラボレーション (協力) モードでは、すべてのチームメンバーがユーザクエリーに同時に応答します。これにより、チーム・コーディネーターはチームが特定のトピックについて合意に達しているかをレビューし、そしてすべてのチームメンバーからの応答を単一の応答に合成できます。
Agno : ユーザガイド : コンセプト : チームモード – コラボレーション
作成 : クラスキャット・セールスインフォメーション
作成日時 : 07/29/2025
バージョン : Agno 1.7.5
* 本記事は docs.agno.com の以下のページを独自に翻訳した上で、補足説明を加えてまとめ直しています :
* サンプルコードの動作確認はしておりますが、必要な場合には適宜、追加改変しています。
* ご自由にリンクを張って頂いてかまいませんが、sales-info@classcat.com までご一報いただけると嬉しいです。
Agno ユーザガイド : コンセプト : チームモード – コラボレーション
コラボレーション (協力) モードでは、すべてのチームメンバーがユーザクエリーに同時に応答します。これにより、チーム・コーディネーターはチームが特定のトピックについて合意に達しているかをレビューし、そしてすべてのチームメンバーからの応答を単一の応答に合成できます。
これは特に、async await で使用する際に有用です、それは個々のメンバーが同時に応答し、コーディネーターがそれらの応答を非同期に合成することを可能にするからです。
コラボレーションモードはどのように動作するか
「コラボレーション」モードでは :
- チームはユーザクエリーを受け取ります。
- すべてのチームメンバーにクエリーが送信されます。同期的に実行する場合、この処理は一つずつ発生します。非同期に実行する場合は、これは同時に発生します。
- 各チームメンバーが出力を生成します。
- コーディネーターは出力をレビューして、それらを単一の応答に合成します。
- コラボレーションモードのチームの作成
ファイル discussion_team.py の作成
discussion_team.py
import asyncio from textwrap import dedent from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.team.team import Team from agno.tools.arxiv import ArxivTools from agno.tools.duckduckgo import DuckDuckGoTools from agno.tools.googlesearch import GoogleSearchTools from agno.tools.hackernews import HackerNewsTools reddit_researcher = Agent( name="Reddit Researcher", role="Research a topic on Reddit", model=OpenAIChat(id="gpt-4o"), tools=[DuckDuckGoTools()], add_name_to_instructions=True, instructions=dedent(""" You are a Reddit researcher. You will be given a topic to research on Reddit. You will need to find the most relevant posts on Reddit. """), ) hackernews_researcher = Agent( name="HackerNews Researcher", model=OpenAIChat("gpt-4o"), role="Research a topic on HackerNews.", tools=[HackerNewsTools()], add_name_to_instructions=True, instructions=dedent(""" You are a HackerNews researcher. You will be given a topic to research on HackerNews. You will need to find the most relevant posts on HackerNews. """), ) academic_paper_researcher = Agent( name="Academic Paper Researcher", model=OpenAIChat("gpt-4o"), role="Research academic papers and scholarly content", tools=[GoogleSearchTools(), ArxivTools()], add_name_to_instructions=True, instructions=dedent(""" You are a academic paper researcher. You will be given a topic to research in academic literature. You will need to find relevant scholarly articles, papers, and academic discussions. Focus on peer-reviewed content and citations from reputable sources. Provide brief summaries of key findings and methodologies. """), ) twitter_researcher = Agent( name="Twitter Researcher", model=OpenAIChat("gpt-4o"), role="Research trending discussions and real-time updates", tools=[DuckDuckGoTools()], add_name_to_instructions=True, instructions=dedent(""" You are a Twitter/X researcher. You will be given a topic to research on Twitter/X. You will need to find trending discussions, influential voices, and real-time updates. Focus on verified accounts and credible sources when possible. Track relevant hashtags and ongoing conversations. """), ) agent_team = Team( name="Discussion Team", mode="collaborate", model=OpenAIChat("gpt-4o"), members=[ reddit_researcher, hackernews_researcher, academic_paper_researcher, twitter_researcher, ], instructions=[ "You are a discussion master.", "You have to stop the discussion when you think the team has reached a consensus.", ], success_criteria="The team has reached a consensus.", enable_agentic_context=True, show_tool_calls=True, markdown=True, show_members_responses=True, ) if __name__ == "__main__": asyncio.run( agent_team.print_response( message="Start the discussion on the topic: 'What is the best way to learn to code?'", stream=True, stream_intermediate_steps=True, ) )
- チームの実行
ライブラリをインストールする
pip install openai duckduckgo-search arxiv pypdf googlesearch-python pycountry
チームを実行する
python discussion_team.py
出力
成功基準の定義
チームコーディネーターが評価するための成功基準 (criteria) を指定することでコラボレーションチームをガイドすることができます :
strategy_team = Team(
members=[hackernews_researcher, academic_paper_researcher, twitter_researcher],
mode="collaborate",
name="Research Team",
description="A team that researches a topic",
success_criteria="The team has reached a consensus on the topic",
)
response = strategy_team.run(
"What is the best way to learn to code?"
)
以上