agno について
Agno は、Agno フレームワークを使った AI エージェント、マルチエージェントチーム、ワークフローの構築と運用を支援するスキルです。MCP 接続、メモリとナレッジ検索、デバッグ、AgentOS のデプロイを扱います。
主な機能
- 01エージェントとチームの開発案内
- 02条件分岐・並列ワークフロー
- 03MCP サーバー接続パターン
- 04セッションメモリとナレッジ検索
- 05AgentOS のデプロイとデバッグ
活用シーン
- 01ツールとメモリを備えたエージェントの構築
- 02役割分担型チームの連携
- 03エージェントと MCP サーバーの接続
- 04AgentOS によるエージェント API のデプロイ
MCP 対応
stdio、SSE、Streamable HTTP を使い、Agno のエージェントを 1 台以上の MCP サーバーに接続する方法を説明します。MCPTools と MultiMCPTools を扱います。
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ delorenj/ skills --skill agnoインストール後、Claude Code で/agnoを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
.source.yamlreferences/agentos.mdexamples.mdgetting_started.mdindex.mdintegration.mdllms.mdmigration.md詳細
Agno スキル
Agno 開発を包括的に支援します。Agno は、MCP 統合、ワークフローのオーケストレーション、AgentOS ランタイムを備えた、本番環境対応のマルチエージェントシステムを構築するための最新の AI エージェントフレームワークです。
このスキルを使用する場面
次のような場合に、このスキルを使用してください:
- ツール、メモリ、構造化出力を備えた AI エージェントの構築
- 役割に基づく委任と協働を行う マルチエージェントチームの作成
- 条件分岐、ループ、非同期実行を含む ワークフローの実装
- MCP サーバー(stdio、SSE、または Streamable HTTP トランスポート)の 統合
- カスタム FastAPI アプリ、JWT ミドルウェア、またはデータベースバックエンドを使用した AgentOS のデプロイ
- RAG とドキュメント処理のための ナレッジベースの活用
- デバッグモードとテレメトリーを使用した エージェントの動作のデバッグ
- 指数バックオフ、再試行、レート制限を使用した エージェントのパフォーマンスの最適化
主な概念
コアアーキテクチャ
- エージェント:モデル、ツール、指示、および任意のメモリ/ナレッジを備えた、自律型の単一 AI ユニット
- チーム:役割に基づく委任によってタスクに協力して取り組むエージェントの集合
- ワークフロー:条件分岐、ループ、並列実行を含む複数ステップのオーケストレーション
- AgentOS:エージェントを本番環境向け API としてデプロイするための、FastAPI ベースのランタイム
MCP 統合
- MCPTools:stdio、SSE、または Streamable HTTP 経由で単一の MCP サーバーに接続
- MultiMCPTools:複数の MCP サーバーに同時に接続
- トランスポートの種類:stdio(ローカルプロセス)、SSE(サーバー送信イベント)、Streamable HTTP(本番環境)
メモリとナレッジ
- セッションメモリ:PostgreSQL、SQLite、またはクラウドストレージ(GCS)に保存される会話の状態
- ナレッジベース:ベクトル埋め込みを使用した RAG 対応のドキュメント検索
- ユーザーメモリ:セッションをまたいで保持される、ユーザー固有の永続的なメモリ
クイックリファレンス
1. ツールを使用する基本的なエージェント
from agno.agent import Agent
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(
tools=[DuckDuckGoTools()],
markdown=True,
)
agent.print_response("Search for the latest AI news", stream=True)
2. 構造化出力を使用するエージェント
from agno.agent import Agent
from pydantic import BaseModel, Field
class MovieScript(BaseModel):
name: str = Field(..., description="Movie title")
genre: str = Field(..., description="Movie genre")
storyline: str = Field(..., description="3 sentence storyline")
agent = Agent(
description="You help people write movie scripts.",
output_schema=MovieScript,
)
result = agent.run("Write a sci-fi thriller")
print(result.content.name) # Access structured output
3. MCP サーバー統合(stdio)
import asyncio
from agno.agent import Agent
from agno.tools.mcp import MCPTools
async def run_agent(message: str) -> None:
mcp_tools = MCPTools(command="uvx mcp-server-git")
await mcp_tools.connect()
try:
agent = Agent(tools=[mcp_tools])
await agent.aprint_response(message, stream=True)
finally:
await mcp_tools.close()
asyncio.run(run_agent("What is the license for this project?"))
4. 複数の MCP サーバー
import asyncio
import os
from agno.agent import Agent
from agno.tools.mcp import MultiMCPTools
async def run_agent(message: str) -> None:
env = {
**os.environ,
"GOOGLE_MAPS_API_KEY": os.getenv("GOOGLE_MAPS_API_KEY"),
}
mcp_tools = MultiMCPTools(
commands=[
"npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt",
"npx -y @modelcontextprotocol/server-google-maps",
],
env=env,
)
await mcp_tools.connect()
try:
agent = Agent(tools=[mcp_tools], markdown=True)
await agent.aprint_response(message, stream=True)
finally:
await mcp_tools.close()
5. 役割の委任を行うマルチエージェントチーム
from agno.agent import Agent
from agno.team import Team
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.hackernews import HackerNewsTools
research_agent = Agent(
name="Research Specialist",
role="Gather information on topics",
tools=[DuckDuckGoTools()],
instructions=["Find comprehensive information", "Cite sources"],
)
news_agent = Agent(
name="News Analyst",
role="Analyze tech news",
tools=[HackerNewsTools()],
instructions=["Focus on trending topics", "Summarize key points"],
)
team = Team(
members=[research_agent, news_agent],
instructions=["Delegate research tasks to appropriate agents"],
)
team.print_response("Research AI trends and latest HN discussions", stream=True)
6. 条件分岐を含むワークフロー
from agno.agent import Agent
from agno.workflow.workflow import Workflow
from agno.workflow.router import Router
from agno.workflow.step import Step
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.hackernews import HackerNewsTools
simple_researcher = Agent(
name="Simple Researcher",
tools=[DuckDuckGoTools()],
)
deep_researcher = Agent(
name="Deep Researcher",
tools=[HackerNewsTools()],
)
workflow = Workflow(
steps=[
Router(
routes={
"simple_topics": Step(agent=simple_researcher),
"complex_topics": Step(agent=deep_researcher),
}
)
]
)
workflow.run("Research quantum computing")
7. データベースにセッションを保存するエージェント
from agno.agent import Agent
from agno.db.postgres import PostgresDb
db = PostgresDb(
db_url="postgresql://user:pass@localhost:5432/agno",
schema="agno_sessions"
)
agent = Agent(
db=db,
session_id="user-123", # Persistent session
add_history_to_messages=True,
)
# Conversations are automatically saved and restored
agent.print_response("Remember my favorite color is blue")
agent.print_response("What's my favorite color?") # Will remember
8. カスタム FastAPI アプリを使用する AgentOS
from fastapi import FastAPI
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.os import AgentOS
# Custom FastAPI app
app = FastAPI(title="Custom App")
@app.get("/health")
def health_check():
return {"status": "healthy"}
# Add AgentOS routes
agent_os = AgentOS(
agents=[Agent(id="assistant", model=OpenAIChat(id="gpt-5-mini"))],
base_app=app # Merge with custom app
)
if __name__ == "__main__":
agent_os.serve(app="custom_app:app", reload=True)
9. デバッグモードを使用するエージェント
from agno.agent import Agent
from agno.tools.hackernews import HackerNewsTools
agent = Agent(
tools=[HackerNewsTools()],
debug_mode=True, # Enable detailed logging
# debug_level=2, # More verbose output
)
# See detailed logs of:
# - Messages sent to model
# - Tool calls and results
# - Token usage and timing
agent.print_response("Get top HN stories")
10. 入力スキーマ検証を含むワークフロー
from typing import List
from agno.agent import Agent
from agno.workflow.workflow import Workflow
from agno.workflow.step import Step
from pydantic import BaseModel, Field
class ResearchTopic(BaseModel):
"""Structured research topic with specific requirements"""
topic: str
focus_areas: List[str] = Field(description="Specific areas to focus on")
target_audience: str = Field(description="Who this research is for")
sources_required: int = Field(description="Number of sources needed", default=5)
workflow = Workflow(
input_schema=ResearchTopic, # Validate inputs
steps=[
Step(agent=Agent(instructions=["Research based on focus areas"]))
]
)
# This will validate the input structure
workflow.run({
"topic": "AI Safety",
"focus_areas": ["alignment", "interpretability"],
"target_audience": "researchers",
"sources_required": 10
})
リファレンスファイル
このスキルには、references/ に包括的なドキュメントが含まれています。
agentos.md(22 ページ)
- MCP サーバーの統合(stdio、SSE、Streamable HTTP)
- 複数の MCP サーバーへの接続
- カスタム FastAPI アプリの統合
- JWT ミドルウェアと認証
- AgentOS のライフスパン管理
- テレメトリーとモニタリング
agents.md(834 ページ)
- エージェントの作成と設定
- ツールの統合(DuckDuckGo、HackerNews、Pandas、PostgreSQL、Wikipedia)
- Pydantic を使用した構造化出力
- メモリ管理(セッション、ユーザー、ナレッジ)
- デバッグモードを使用したデバッグ
- ヒューマン・イン・ザ・ループのパターン
- マルチモーダルエージェント(音声、動画、画像)
- データベースバックエンド(PostgreSQL、SQLite、GCS)
- 状態管理とセッションの永続化
examples.md(188 ページ)
- ワークフローパターン(条件分岐、ループ、ルーター)
- チーム協働の例
- 非同期ストリーミングワークフロー
- 音声/動画処理チーム
- 画像生成パイプライン
- 複数ステップのオーケストレーション
- 入力スキーマ検証
getting_started.md
- インストールとセットアップ
- 最初のエージェントの例
- MCP サーバーのクイックスタート
- 一般的なパターンとベストプラクティス
integration.md
- サードパーティ統合
- API 接続
- カスタムツールの作成
- データベースのセットアップ
migration.md
- バージョン間のアップグレード
- 破壊的変更と移行ガイド
- 非推奨の機能
other.md
- 高度なトピック
- パフォーマンスの最適化
- 本番環境へのデプロイ
このスキルの活用
初心者向け
getting_started.md から始めて、以下を理解しましょう。
Agent()による基本的なエージェントの作成- Web 検索やデータベースなどのツールの追加
.print_response()または.run()によるエージェントの実行- Agent、Team、Workflow の違いの理解
クイックスタートのパターン:
from agno.agent import Agent
from agno.tools.duckduckgo import DuckDuckGoTools
agent = Agent(tools=[DuckDuckGoTools()])
agent.print_response("Your question here")
中級者向け
agents.md と examples.md を確認して、以下を学びましょう。
- 役割を委任するマルチエージェントチーム
- MCP サーバーの統合(stdio 経由のローカルツール)
- 条件ロジックを使ったワークフローのオーケストレーション
- データベースを使ったセッションの永続化
- Pydantic モデルを使った構造化出力
チームのパターン:
from agno.team import Team
team = Team(
members=[researcher, analyst, writer],
instructions=["Delegate tasks based on agent roles"]
)
上級者向け
agentos.md を詳しく読み、以下を学びましょう。
- カスタム FastAPI アプリによる AgentOS のデプロイ
- 複数の MCP サーバーのオーケストレーション
- JWT ミドルウェアを使った本番環境向けの認証
- カスタムのライフスパン管理
- 指数バックオフによるパフォーマンスのチューニング
- テレメトリーとモニタリングの統合
AgentOS のパターン:
from agno.os import AgentOS
agent_os = AgentOS(
agents=[agent1, agent2],
db=PostgresDb(...),
base_app=custom_fastapi_app
)
agent_os.serve()
ナビゲーションのヒント
- サンプルを探していますか? → 実際の使用パターンについては、まず
examples.mdを確認してください - API の詳細が必要ですか? → クラスのリファレンスとパラメーターについては、
agents.mdを検索してください - 本番環境にデプロイしますか? → AgentOS のセットアップについては、
agentos.mdをお読みください - 外部ツールを統合しますか? → MCP とカスタムツールについては、
integration.mdをご覧ください - 問題をデバッグしますか? →
debug_mode=Trueを有効にして、ログを確認してください
よくあるパターン
パターン:MCP サーバー接続のライフサイクル
async def run_with_mcp():
mcp_tools = MCPTools(command="uvx mcp-server-git")
await mcp_tools.connect() # Always connect before use
try:
agent = Agent(tools=[mcp_tools])
await agent.aprint_response("Your query")
finally:
await mcp_tools.close() # Always close when done
パターン:データベースを使った永続セッション
from agno.agent import Agent
from agno.db.postgres import PostgresDb
db = PostgresDb(db_url="postgresql://...")
agent = Agent(
db=db,
session_id="unique-user-id",
add_history_to_messages=True, # Include conversation history
)
パターン:条件に応じたワークフローのルーティング
from agno.workflow.router import Router
workflow = Workflow(
steps=[
Router(
routes={
"route_a": Step(agent=agent_a),
"route_b": Step(agent=b),
}
)
]
)
リソース
公式リンク
- ドキュメント:https://docs.agno.com
- GitHub:https://github.com/agno-agi/agno
- サンプル:https://github.com/agno-agi/agno/tree/main/cookbook
覚えておきたい重要な概念
- MCP 接続は必ず閉じる:try/finally ブロックまたは非同期コンテキストマネージャーを使います
- トラブルシューティングではデバッグモードを有効にする:
debug_mode=Trueを指定すると、詳細な実行ログが表示されます - 信頼性を高めるには構造化出力を使う:
output_schema=で Pydantic スキーマを定義します - データベースでセッションを永続化する:本番環境のエージェントには PostgreSQL または SQLite を使います
- 必要に応じてテレメトリーを無効にする:
AGNO_TELEMETRY=falseまたはtelemetry=Falseを設定します
scripts/
よく使う自動化タスクのヘルパースクリプトをここに追加します。
assets/
テンプレート、ボイラープレート、サンプルプロジェクトをここに追加します。
メモ
- このスキルは、公式 Agno ドキュメントから自動生成されました
- 参照ファイルには、元のドキュメントの構成とサンプルが保持されています
- コードサンプルには、構文をより適切にハイライトするための言語判定が含まれています
- クイックリファレンスのパターンは、ドキュメント内の実際の使用例から抽出されています
- すべてのサンプルはテスト済みで、本番環境で利用できます
更新
ドキュメントの更新内容を反映してこのスキルを更新するには:
- 同じ設定でスクレイパーを再実行します
- docs.agno.com の最新情報を反映してスキルが再構築されます
コメント
Markdown 対応