ソース情報
- リポジトリ
- ag2ai/resource-hub
- ソースの最終更新活動
- 2026年3月19日 04:42
- 検出された SKILL.md の言語
- 英語
- スター
- 4
- フォーク
- 3
インストール方法
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
ソースファイルを確認
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
メニュー
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
SOC 職業分類に基づく
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/ag2ai/resource-hub --skill add-toolコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
SKILL.md を表示中
REST and WebSocket endpoint patterns, error handling, and Pydantic schema conventions for the backend
Architecture, directory layout, communication protocol, and conventions for the full-stack multi-agent application
Step-by-step guide to add a new REST or WebSocket endpoint to the backend
| name | add-tool |
| description | How to create and register a tool on an AG2 agent |
| license | Apache-2.0 |
Use the @tool decorator. The function's docstring becomes the tool description the LLM sees. Use type annotations for all parameters.
from ag2.tools import tool
@tool
def get_weather(city: str, units: str = "celsius") -> str:
"""Get the current weather for a city.
Args:
city: Name of the city to look up.
units: Temperature units, either 'celsius' or 'fahrenheit'.
"""
# Your implementation here
return f"The weather in {city} is 22 {units}"
You need two agents:
from ag2 import LLMConfig
from ag2.agentchat import AssistantAgent, UserProxyAgent
with LLMConfig(api_type="openai", model="gpt-4o"):
assistant = AssistantAgent(
name="weather_assistant",
system_message="You help users check the weather. Use the get_weather tool.",
)
executor = UserProxyAgent(
name="executor",
human_input_mode="NEVER",
)
assistant.register_tool(get_weather, caller=assistant, executor=executor)
This tells AG2:
assistant can generate tool-call requests for get_weather.executor runs the actual function and returns the result.The @tool decorator inspects type annotations to build the JSON schema sent to the LLM. Always annotate parameters.
Supported types:
str, int, float, boollist[str], dict[str, int]Optional[str], or str | NoneLiteral["option_a", "option_b"]from typing import Literal
@tool
def query_db(
table: str,
columns: list[str],
limit: int = 100,
order: Literal["asc", "desc"] = "asc",
) -> str:
"""Query a database table and return results."""
# implementation
return "results"
from ag2 import LLMConfig
from ag2.agentchat import AssistantAgent, UserProxyAgent
from ag2.tools import tool
@tool
def search_docs(query: str, top_k: int = 5) -> str:
"""Search the documentation index.
Args:
query: The search query string.
top_k: Number of results to return.
"""
# Replace with real search logic
return f"Found {top_k} results for '{query}'"
@tool
def write_file(path: str, content: str) -> str:
"""Write content to a file.
Args:
path: File path to write to.
content: Content to write.
"""
with open(path, "w") as f:
f.write(content)
return f"Wrote {len(content)} chars to {path}"
with LLMConfig(api_type="openai", model="gpt-4o"):
assistant = AssistantAgent(
name="doc_writer",
system_message=(
"You help write documentation. Use search_docs to find relevant info, "
"then use write_file to save the output. Reply TERMINATE when done."
),
)
executor = UserProxyAgent(name="executor", human_input_mode="NEVER")
assistant.register_tool(search_docs, caller=assistant, executor=executor)
assistant.register_tool(write_file, caller=assistant, executor=executor)
result = assistant.initiate_chat(
executor,
message=,
)