Skip to content

ClassCat® AI Research

クラスキャット – Agno, AgentOS, MCP, LangChain/LangGraph, CrewAI

Menu
  • ホーム
    • ClassCat® AI Research ホーム
    • クラスキャット・ホーム
  • OpenAI API
    • OpenAI Python ライブラリ 1.x : 概要
    • OpenAI ブログ
      • GPT の紹介
      • GPT ストアの紹介
      • ChatGPT Team の紹介
    • OpenAI platform 1.x
      • Get Started : イントロダクション
      • Get Started : クイックスタート (Python)
      • Get Started : クイックスタート (Node.js)
      • Get Started : モデル
      • 機能 : 埋め込み
      • 機能 : 埋め込み (ユースケース)
      • ChatGPT : アクション – イントロダクション
      • ChatGPT : アクション – Getting started
      • ChatGPT : アクション – アクション認証
    • OpenAI ヘルプ : ChatGPT
      • ChatGPTとは何ですか?
      • ChatGPT は真実を語っていますか?
      • GPT の作成
      • GPT FAQ
      • GPT vs アシスタント
      • GPT ビルダー
    • OpenAI ヘルプ : ChatGPT > メモリ
      • FAQ
    • OpenAI ヘルプ : GPT ストア
      • 貴方の GPT をフィーチャーする
    • OpenAI Python ライブラリ 0.27 : 概要
    • OpenAI platform
      • Get Started : イントロダクション
      • Get Started : クイックスタート
      • Get Started : モデル
      • ガイド : GPT モデル
      • ガイド : 画像生成 (DALL·E)
      • ガイド : GPT-3.5 Turbo 対応 微調整
      • ガイド : 微調整 1.イントロダクション
      • ガイド : 微調整 2. データセットの準備 / ケーススタディ
      • ガイド : 埋め込み
      • ガイド : 音声テキスト変換
      • ガイド : モデレーション
      • ChatGPT プラグイン : イントロダクション
    • OpenAI Cookbook
      • 概要
      • API 使用方法 : レート制限の操作
      • API 使用方法 : tiktoken でトークンを数える方法
      • GPT : ChatGPT モデルへの入力をフォーマットする方法
      • GPT : 補完をストリームする方法
      • GPT : 大規模言語モデルを扱う方法
      • 埋め込み : 埋め込みの取得
      • GPT-3 の微調整 : 分類サンプルの微調整
      • DALL-E : DALL·E で 画像を生成して編集する方法
      • DALL·E と Segment Anything で動的マスクを作成する方法
      • Whisper プロンプティング・ガイド
  • Gemini API
    • Tutorials : クイックスタート with Python (1) テキスト-to-テキスト生成
    • (2) マルチモーダル入力 / 日本語チャット
    • (3) 埋め込みの使用
    • (4) 高度なユースケース
    • クイックスタート with Node.js
    • クイックスタート with Dart or Flutter (1) 日本語動作確認
    • Gemma
      • 概要 (README)
      • Tutorials : サンプリング
      • Tutorials : KerasNLP による Getting Started
  • Keras 3
    • 新しいマルチバックエンド Keras
    • Keras 3 について
    • Getting Started : エンジニアのための Keras 入門
    • Google Colab 上のインストールと Stable Diffusion デモ
    • コンピュータビジョン – ゼロからの画像分類
    • コンピュータビジョン – 単純な MNIST convnet
    • コンピュータビジョン – EfficientNet を使用した微調整による画像分類
    • コンピュータビジョン – Vision Transformer による画像分類
    • コンピュータビジョン – 最新の MLPモデルによる画像分類
    • コンピュータビジョン – コンパクトな畳込み Transformer
    • Keras Core
      • Keras Core 0.1
        • 新しいマルチバックエンド Keras (README)
        • Keras for TensorFlow, JAX, & PyTorch
        • 開発者ガイド : Getting started with Keras Core
        • 開発者ガイド : 関数型 API
        • 開発者ガイド : シーケンシャル・モデル
        • 開発者ガイド : サブクラス化で新しい層とモデルを作成する
        • 開発者ガイド : 独自のコールバックを書く
      • Keras Core 0.1.1 & 0.1.2 : リリースノート
      • 開発者ガイド
      • Code examples
      • Keras Stable Diffusion
        • 概要
        • 基本的な使い方 (テキスト-to-画像 / 画像-to-画像変換)
        • 混合精度のパフォーマンス
        • インペインティングの簡易アプリケーション
        • (参考) KerasCV – Stable Diffusion を使用した高性能画像生成
  • TensorFlow
    • TF 2 : 初級チュートリアル
    • TF 2 : 上級チュートリアル
    • TF 2 : ガイド
    • TF 1 : チュートリアル
    • TF 1 : ガイド
  • その他
    • 🦜️🔗 LangChain ドキュメント / ユースケース
    • Stable Diffusion WebUI
      • Google Colab で Stable Diffusion WebUI 入門
      • HuggingFace モデル / VAE の導入
      • LoRA の利用
    • Diffusion Models / 拡散モデル
  • クラスキャット
    • 会社案内
    • お問合せ
    • Facebook
    • ClassCat® Blog
Menu

Agno 2.x : チーム – コンテキスト・エンジニアリング

Posted on 11/15/2025 by Masashi Okumura

チーム向けの、プロンプトの作成方法や他のコンテキスト・エンジニアリング技術を学習します。
コンテキスト・エンジニアリングは、言語モデルの動作や出力をガイドするために、モデルに送信される情報 (コンテキスト) を設計・制御するプロセスです。
実際には、コンテキストの構築は一つの質問に集約されます :「どの情報が最も望ましい結果を達成しやすいか?」

Agno 2.x : Learn : チーム – コンテキスト・エンジニアリング

作成 : クラスキャット・セールスインフォメーション
作成日時 : 11/15/2025
バージョン : Agno 2.2.10

* 本記事は docs.agno.com の以下のページを独自に翻訳した上で、補足説明を加えてまとめ直しています。スニペットはできる限り日本語を使用しています :

  • Learn : Teams – Context Engineering

* サンプルコードの動作確認はしておりますが、必要な場合には適宜、追加改変しています。
* ご自由にリンクを張って頂いてかまいませんが、sales-info@classcat.com までご一報いただけると嬉しいです。

 

 

Agno 2.x : Learn : チーム – コンテキスト・エンジニアリング

チーム向けの、プロンプトの作成方法や他のコンテキスト・エンジニアリング技術を学習します。

コンテキスト・エンジニアリングは、言語モデルの動作や出力をガイドするために、モデルに送信される情報 (コンテキスト) を設計・制御するプロセスです。実際には、コンテキストの構築は一つの質問に集約されます :「どの情報が最も望ましい結果を達成しやすいか?」

Agno ではこれは、チームの説明、指示、メンバー情報、そしてその他の関連設定を含む、システムメッセージを注意深く精巧に作成することを意味します。このコンテキストを思慮深く構築することで、以下が可能になります :

  • チームを特定の動作やロールに導く。

  • チームの機能を制約、または拡張する。

  • 出力に一貫性があり、関連性が高く、アプリケーションのニーズと整合性があることを保証します。

  • マルチステップ推論、メンバー委任、ツール使用、構造化出力のような高度なユースケースを可能にします。

  • 協調タスクのための効果的なチームメンバーの調整

 

システムメッセージのコンテキスト

以下はシステムメッセージを作成するために使用される主要なパラメータの一部です :

  1. Description: チームの全体的な動作をガイドする説明。

  2. Instructions: 目標をどのように達成するかについての正確で、タスク固有な指示のリスト。

  3. Expected Output: チームからの想定される出力の説明。

  4. Members: チームメンバー、ロールと機能についての情報。

システムメッセージは、チームの説明、指示、メンバー詳細、そしてその他の設定から構築されます。チームリーダーのシステムメッセージは委任ルールと調整ガイドラインも含みます。例えば :

instructions.py

from agno.agent import Agent
from agno.team import Team
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.hackernews import HackerNewsTools

web_agent = Agent(
    name="Web Researcher",
    role="You are a web researcher that can find information on the web.",
    instructions=[
        "Use your web search tool to find information on the web.",
        "Provide a summary of the information found.",
    ],
    tools=[DuckDuckGoTools()],
    markdown=True,
    debug_mode=True,  # Set to True to view the detailed logs
)
hackernews_agent = Agent(
    name="HackerNews Researcher",
    role="You are a hackernews researcher that can find information on hackernews.",
    instructions=[
        "Use your hackernews search tool to find information on hackernews.",
        "Provide a summary of the information found.",
    ],
    tools=[HackerNewsTools()],
    markdown=True,
    debug_mode=True,  # Set to True to view the detailed logs
)

team = Team(
    members=[web_agent, hackernews_agent],
    instructions=[
        "You are a team of researchers that can find information on the web and hackernews.",
        "After finding information about the topic, compile a joint report."
    ],
    markdown=True,
    debug_mode=True,   # Set to True to view the detailed logs and see the compiled system message
)
team.print_response("What is the latest news on the crypto market?", stream=True)

出力例

┏━ Response (42.1s) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃                                                                                                                                                 ┃
┃ 最新の暗号通貨市場に関するニュースを以下にまとめました。                                                                                        ┃
┃                                                                                                                                                 ┃
┃                                                           暗号通貨市場の最新ニュース                                                            ┃
┃                                                                                                                                                 ┃
┃  1 アルトコイン市場の動揺:                                                                                                                      ┃
┃     • 暗号通貨市場は最近、大きな変動を経験しており、アルトコインの市場資本化が1.4兆ドルまで減少しました。この影響はビットコインの価格の下落が引 ┃
┃       き金となっています。                                                                                                                      ┃
┃     • 詳細はこちら                                                                                                                              ┃
┃  2 ビットコインがベアマーケットに:                                                                                                              ┃
┃     • ビットコインの価格が95,000ドルを下回り、「ベアマーケットの状態」に入ったとされています。もし93,000ドルを下回ると、さらなる下落の可能性が  ┃
┃       あるとの警告が出ています。                                                                                                                ┃
┃     • 詳細はこちら                                                                                                                              ┃
┃  3 ビットコイン、100Kドル割れ:                                                                                                                  ┃
┃     • ビットコインは重要な100,000ドルの閾値を下回り、市場全体に衝撃を与え、多くのポジションの清算を引き起こしました。                           ┃
┃     • 詳細はこちら                                                                                                                              ┃
┃  4 ビットコインのベアマーケット:                                                                                                                ┃
┃     • ビットコインはリスクの高い資産からの投資家の撤退により、主要な技術的レベルを下回って取引されています。                                    ┃
┃     • 詳細はこちら                                                                                                                              ┃
┃  5 停滞する暗号通貨市場:                                                                                                                        ┃
┃     • ビットコインは週単位の時間枠でブル市場に留まることが難しく、50週移動平均を維持しようとしています。                                        ┃
┃     • 詳細はこちら                                                                                                                              ┃
┃                                                                                                                                                 ┃
┃                                                               HackerNewsでの情報                                                                ┃
┃                                                                                                                                                 ┃
┃ HackerNewsでは、最近の投稿の中でビットコインや主要な暗号通貨に直接関連するトピックは見当たりませんでしたが、多くの投稿があるため、他のページや  ┃
┃ 関連する投稿が存在する可能性があります。具体的なトピックを知りたい場合は、以下の方法をお勧めします:                                            ┃
┃                                                                                                                                                 ┃
┃  1 HackerNewsで直接「Bitcoin」または「Cryptocurrency」などのキーワードで検索してみる。                                                          ┃
┃  2 暗号通貨関連の最新ニュースを提供している他のニュースサイトを参照する。                                                                       ┃
┃  3 専門家によるブログや暗号通貨に特化したフォーラムをチェックする。                                                                             ┃
┃                                                                                                                                                 ┃
┃ これらの情報は、特にビットコインの価格動向が暗号市場全体に影響を与えている様子を示しています。ビットコインのボラティリティは市場全体に影響を与  ┃
┃ え、多くのトレーダーや投資家が注目している状況です。また、さらに詳しい情報や追加のサポートが必要であれば、お知らせください。                    ┃
┃                                                                                                                                                 ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

これは以下のシステムメッセージを生成します :

You are the leader of a team and sub-teams of AI Agents.
Your task is to coordinate the team to complete the user's request.

Here are the members in your team:
<team_members>
- Agent 1:
    - ID: web-researcher
    - Name: Web Researcher
    - Role: You are a web researcher that can find information on the web.
    - Member tools:
        - duckduckgo_search
        - duckduckgo_news
- Agent 2:
    - ID: hacker-news-researcher
    - Name: HackerNews Researcher
    - Role: You are a hackernews researcher that can find information on hackernews.
    - Member tools:
        - get_top_hackernews_stories
        - get_user_details
</team_members>

<how_to_respond>
- Your role is to forward tasks to members in your team with the highest likelihood of completing the user's request.
- Carefully analyze the tools available to the members and their roles before delegating tasks.
- You cannot use a member tool directly. You can only delegate tasks to members.
- When you delegate a task to another member, make sure to include:
    - member_id (str): The ID of the member to delegate the task to. Use only the ID of the member, not the ID of the team followed by the ID of the
member.
    - task_description (str): A clear description of the task.
    - expected_output (str): The expected output.
- You can delegate tasks to multiple members at once.
- You must always analyze the responses from members before responding to the user.
- After analyzing the responses from the members, if you feel the task has been completed, you can stop and respond to the user.
- If you are not satisfied with the responses from the members, you should re-assign the task.
- For simple greetings, thanks, or questions about the team itself, you should respond directly.
- For all work requests, tasks, or questions requiring expertise, route to appropriate team members.
</how_to_respond>

<instructions>
- You are a team of researchers that can find information on the web and hackernews.
- After finding information about the topic, compile a joint report.
</instructions>

<additional_information>
- Use markdown to format your answers.
</additional_information>

 

システムメッセージの構築方法

以下のチームの例を考えてみましょう :

from agno.agent import Agent
from agno.team import Team

web_agent = Agent(
    name="Web Researcher",
    role="You are a web researcher that can find information on the web.",
    description="You are a helpful web research assistant",
    instructions=["Search for accurate information"],
    markdown=True,
)

team = Team(
    members=[web_agent],
    name="Research Team",
    role="Team Lead",
    description="You are a research team lead",
    instructions=["Coordinate the team to provide comprehensive research"],
    expected_output="You should format your response with detailed findings",
    markdown=True,
    add_datetime_to_context=True,
    add_location_to_context=True,
    add_name_to_context=True,
    add_session_summary_to_context=True,
    add_memories_to_context=True,
    add_session_state_to_context=True,
)

以下が構築されるシステムメッセージです :

You are the leader of a team and sub-teams of AI Agents.
Your task is to coordinate the team to complete the user's request.

Here are the members in your team:
<team_members>
- Agent 1:
    - ID: web-researcher
    - Name: Web Researcher
    - Role: You are a web researcher that can find information on the web.
    - Member tools:
        (none)
</team_members>

<how_to_respond>
...
</how_to_respond>

You have access to memories from previous interactions with the user that you can use:

<memories_from_previous_interactions>
- User really likes Digimon and Japan.
- User really likes Japan.
- User likes coffee.
</memories_from_previous_interactions>

Note: this information is from previous interactions and may be updated in this conversation. You should always prefer information from this conversation over the past memories.

Here is a brief summary of your previous interactions:

<summary_of_previous_interactions>
The user asked about information about Digimon and Japan.
</summary_of_previous_interactions>

Note: this information is from previous interactions and may be outdated. You should ALWAYS prefer information from this conversation over the past summary.

<description>
You are a research team lead
</description>

<your_role>
Team Lead
</your_role>

<instructions>
- Coordinate the team to provide comprehensive research
</instructions>

<additional_information>
- Use markdown to format your answers.
- The current time is 2025-09-30 12:00:00.
- Your approximate location is: New York, NY, USA.
- Your name is: Research Team.
</additional_information>

<expected_output>
You should format your response with detailed findings
</expected_output>

<session_state> ... </session_state>

 

追加のコンテキスト

additional_context パラメータを使用して、システムメッセージの最後にコンテキストを追加できます。ここでは、additional_context は、チームが特定のデータベース・テーブルにアクセスできることを示す、メモをシステムメッセージに追加します。

from textwrap import dedent

from agno.agent import Agent
from agno.team import Team
from agno.models.langdb import LangDB
from agno.tools.duckdb import DuckDbTools

duckdb_tools = DuckDbTools(
    create_tables=False, export_tables=False, summarize_tables=False
)
duckdb_tools.create_table_from_path(
    path="https://phidata-public.s3.amazonaws.com/demo_data/IMDB-Movie-Data.csv",
    table="movies",
)

web_researcher = Agent(
    name="Web Researcher",
    role="You are a web researcher that can find information on the web.",
    tools=[DuckDbTools()],
    instructions=[
        "Use your web search tool to find information on the web.",
        "Provide a summary of the information found.",
    ],
)

team = Team(
    members=[web_researcher],
    model=LangDB(id="llama3-1-70b-instruct-v1.0"),
    tools=[duckdb_tools],
    markdown=True,
    additional_context=dedent("""\
    You have access to the following tables:
    - movies: contains information about movies from IMDB.
    """),
)
team.print_response("What is the average rating of movies?", stream=True)

 

チームメンバー情報

メンバー情報はシステムメッセージに自動的に注入されます。これはメンバー ID, 名前, ロールとツールを含みます。add_member_tools_to_context を Fale に設定して、システムメッセージからメンバーツールを削除して、これをオプションで最小化できます。

チームリーダーにチームメンバーについての情報を取得するためにツールを提供することもできます。

from agno.agent import Agent
from agno.team import Team

web_agent = Agent(
    name="Web Researcher",
    role="You are a web researcher that can find information on the web."
)

team = Team(
    members=[web_agent],
    get_member_information_tool=True,  # Adds a tool to get information about team members
    add_member_tools_to_context=False, # Removes the member tools from the system message
)

 

ツール指示

チームで Toolkit を使用している場合、instructions パラメータを使用してツール指示をシステムメッセージに追加することができます :

from agno.agent import Agent
from agno.tools.slack import SlackTools

slack_tools = SlackTools(
    instructions=["Use `send_message` to send a message to the user.  If the user specifies a thread, use `send_message_thread` to send a message to the thread."],
    add_instructions=True,
)
team = Team(
    members=[...],
    tools=[slack_tools],
)

これらの指示は <additional_information> タグの後のシステムメッセージに注入されます。

 

エージェント型メモリ

チームで enable_agentic_memory を True に設定した場合、チームはツールを使用して、ユーザメモリを作成/更新する機能を取得します。

これは以下をシステムメッセージに追加します :

<updating_user_memories>
- You have access to the `update_user_memory` tool that you can use to add new memories, update existing memories, delete memories, or clear all memories.
- If the user's message includes information that should be captured as a memory, use the `update_user_memory` tool to update your memory database.
- Memories should include details that could personalize ongoing interactions with the user.
- Use this tool to add new memories or update existing memories that you identify in the conversation.
- Use this tool if the user asks to update their memory, delete a memory, or clear all memories.
- If you use the `update_user_memory` tool, remember to pass on the response to the user.
</updating_user_memories>

 

システムメッセージを直接設定する

system_message パラメータを使用してシステムメッセージを手動で設定できます。これはすべての他の設定を無視して、ユーザが提供したシステムメッセージを使用します。

from agno.team import Team

team = Team(members=[], system_message="Share a 2 sentence story about")
team.print_response("Love in the year 12000.")

 

ユーザメッセージのコンテキスト

Team.run() または Team.print_response() に送信される入力はユーザメッセージとして使用されます。

ユーザメッセージへの依存関係の注入を行う方法については dependencies をご覧ください。

 

追加のユーザメッセージ・コンテキスト

​

デフォルトでは、ユーザメッセージは Team.run() or Team.print_response() 関数に送信される入力を使用して構築されます。

以下のチーム・パラメータはユーザメッセージが構築される方法を設定します :

  • add_knowledge_to_context

  • add_dependencies_to_context
from agno.agent import Agent
from agno.team import Team

web_agent = Agent(
    name="Web Researcher",
    role="You are a web researcher that can find information on the web."
)

team = Team(
    members=[web_agent],
    add_knowledge_to_context=True, 
    add_dependencies_to_context=True
)
team.print_response("What is the capital of France?", dependencies={"name": "John Doe"})

モデルに送信されるユーザメッセージはこのようになります :

What is the capital of France?

Use the following references from the knowledge base if it helps:
<references>
- Reference 1
- Reference 2
</references>

<additional context>
{"name": "John Doe"}
</additional context>

 

以上





クラスキャット

最近の投稿

  • Agno 2.x : チーム – コンテキスト・エンジニアリング
  • Agno 2.x 例題 : ワークフロー – 関数とエージェントのシークエンス
  • Agno 2.x : ワークフロー – ワークフローの実行
  • Agno 2.x : ワークフロー – 概要と構築
  • Agno 2.x : チーム – チーム・セッション

タグ

AG2 (14) Agno (46) Agno 2.x (22) AutoGen (13) ClassCat Press Release (20) ClassCat TF/ONNX Hub (11) DGL 0.5 (14) Edward (17) FLUX.1 (16) Gemini (20) HuggingFace Transformers 4.5 (10) HuggingFace Transformers 4.29 (9) Keras 2 Examples (98) Keras 2 Guide (16) Keras 3 (10) Keras Release Note (17) Kubeflow 1.0 (10) LangChain (45) LangChain v1.0 (10) LangGraph (24) LangGraph 0.5 (9) MediaPipe 0.8 (11) Model Context Protocol (16) NNI 1.5 (16) OpenAI Cookbook (13) OpenAI platform (10) OpenAI platform 1.x (10) OpenAI ヘルプ (8) TensorFlow 2.0 Advanced Tutorials (33) TensorFlow 2.0 Advanced Tutorials (Alpha) (15) TensorFlow 2.0 Advanced Tutorials (Beta) (16) TensorFlow 2.0 Guide (10) TensorFlow 2.0 Guide (Alpha) (16) TensorFlow 2.0 Guide (Beta) (9) TensorFlow 2.0 Release Note (12) TensorFlow 2.0 Tutorials (20) TensorFlow 2.0 Tutorials (Alpha) (14) TensorFlow 2.0 Tutorials (Beta) (12) TensorFlow 2.4 Guide (24) TensorFlow Deploy (8) TensorFlow Probability (9) TensorFlow Programmer's Guide (22) TensorFlow Release Note (18) TensorFlow Tutorials (33) TF-Agents 0.4 (11)
2025年11月
月 火 水 木 金 土 日
 12
3456789
10111213141516
17181920212223
24252627282930
« 10月    
© 2025 ClassCat® AI Research | Powered by Minimalist Blog WordPress Theme