mcpField
F
Fast Agent

Fast Agent

github.com/evalstateフレームワーク・SDK4.0k今日更新

Fast Agent について

fast-agent は、MCP 対応のエージェントとワークフローを定義、プロンプト、テストするためのフレームワークです。コマンドライン中心の設計で、コーディングエージェント、開発ツールキット、評価基盤、ワークフロー基盤として利用できます。複数のモデルプロバイダーに対応し、Sampling や Elicitations を含む MCP 機能のサポートをうたっています。Streamable HTTP 転送の状況を確認することもできます。

主な機能

  1. 01ファイルで定義する宣言的なエージェントとプロンプト
  2. 02stdio および Streamable HTTP の MCP サーバーへの接続
  3. 03チェーン構成のエージェントと並列ツール呼び出し
  4. 04Sampling と Elicitations など MCP 機能への対応
  5. 05KeyRing によるシークレット保存と OAuth 認証

活用シーン

  1. 01MCP サーバーを利用するコーディングエージェントやデータ分析エージェントの構築
  2. 02複数エージェントを連結またはオーケストレーションするワークフローの作成
  3. 03Streamable HTTP 転送の確認によるデプロイの問題調査

MCP 対応

MCP クライアントとして、/connect または設定ファイルから stdio および Streamable HTTP の MCP サーバーに接続し、OAuth と ping による監視をサポートします。

詳細

README の画像 README の画像 README の画像 discord Pepy Total Downloads README の画像

まずはこちら

ヒント

最新のドキュメントは https://fast-agent.ai をご覧ください。

fast-agent は、LLM と柔軟にやり取りするための方法です。コーディングエージェント、開発ツールキット、評価、ワークフロープラットフォームとして優れています。

シェルに対応した対話セッションを開始するには、uv をインストールして、次を実行します。

uvx fast-agent-mcp@latest -x

Hugging Face の推論プロバイダーを使ってコーディングを始めるか、OpenAI Codex プランを使用するには、次を実行します。

# Code with Hugging Face Inference Providers
uvx fast-agent-mcp@latest --pack hf-dev

# Code with Codex (agents optimized for OpenAI)
uvx fast-agent-mcp@latest --pack codex

! を入力してシェルに入り、! cd web && npm run build のようにシェルコマンドを実行します。

/skills コマンドでスキルを管理し、/connect で MCP サーバーに接続します。デフォルトの fast-agent レジストリには、LSP、エージェントおよびツールのフック、コンパクション戦略、自動化などを設定するためのスキルが含まれています。

# /connect supports stdio or streamable http (with OAuth)

# Start a STDIO server
/connect @modelcontextprotocol/server-everything

# Connect to a Streamable HTTP Server
/connect https://huggingface.co/mcp

シェルエイリアスやその他のツールを設定するために、fast-agent のインストールをおすすめします。

# Install fast-agent
uv tool install -U fast-agent-mcp

# Run fast-agent with opus, shell support and built-in subagents
fast-agent --model opus -xx

汎用プロバイダーでローカルモデルを使用するか、llama.cpp 用の適切な設定を自動的に作成できます。

fast-agent model llamacpp

fast-agent のセットアップやプログラムは、どの ACP クライアントでも使用できます。最も簡単な方法は fast-agent-acp を使うことです。

# Run fast-agent inside Toad
toad acp "fast-agent-acp -x --model sonnet"

fast-agent を使うと、高度なマルチモーダルエージェントやワークフローを数分で作成し、操作できます。Sampling や Elicitations を含む MCP 機能をエンドツーエンドで完全にテストしてサポートする、初のフレームワークです。

fast-agent は CLI を中心に設計されており、オプションで prompt_toolkit を利用した対話型ターミナルプロンプト(TUI スタイルの入力、補完、ターミナル内メニュー)を使用できます。全画面の curses UI や外部 GUI オーバーレイに頼ることなく、rich を介して応答をターミナルにリアルタイムでストリーミングできます。

シンプルな宣言型構文により、プロンプトと MCP サーバーの組み合わせに集中して、効果的なエージェントを構築できます。

モデルのサポートは包括的で、Anthropic、OpenAI、Google のプロバイダーをネイティブにサポートするほか、TensorZero を介して Azure、Ollama、Deepseek など数十のプロバイダーに対応しています。構造化出力、PDF、ビジョンのサポートは簡単に使え、十分にテストされています。Passthrough LLM と Playback LLM により、アプリケーション向けの Python のグルーコードをすばやく開発・テストできます。

最近追加された機能:

  • エージェントスキル(SKILL.md)
  • MCP Apps
  • OpenAI Apps SDK
  • シェルモード
  • 高度な MCP トランスポート診断
  • MCP Elicitations
MCP トランスポート診断

fast-agent は、Streamable HTTP Transport の使用状況を検査できる唯一のツールです。これは、信頼性が高く準拠したデプロイを確保するうえで重要な機能です。シークレットの KeyRing ストレージを使用した OAuth に対応しています。管理には fast-agent auth コマンドを使用してください。

重要

ドキュメントは、このリポジトリの docs/ に含まれています。リポジトリのルートからドキュメント用ヘルパースクリプトを使って、サイトのインストール、生成、ビルド、配信、スクリーンショットの撮影、評価を行ってください。

エージェントアプリケーションの開発

エージェントアプリケーションを定義するプロンプトと設定は、ボイラープレートを最小限に抑えたシンプルなファイルに保存されるため、管理やバージョン管理が容易です。

ワークフローの実行前、実行中、実行後に、個々のエージェントやコンポーネントとチャットして、アプリケーションを調整・診断できます。エージェントは、タスクを完了するために必要な追加のコンテキストを得るため、人間に入力を求めることができます。

モデルを簡単に選択できるため、モデルと MCP サーバーのやり取りを手軽にテストできます。このプロジェクトの目的については、こちらをご覧ください。

2025-03-23-fast-agent

はじめに:

まず、Python 用の uv パッケージマネージャーをインストールします。次に:

uv pip install fast-agent-mcp          # install fast-agent!
fast-agent go                          # start an interactive session
fast-agent go --url https://hf.co/mcp  # with a remote MCP
fast-agent go --model=generic.qwen2.5  # use ollama qwen 2.5
fast-agent go --pack analyst --model haiku  # install/reuse a card pack and launch it
fast-agent scaffold                    # create an example agent and config files
uv run agent.py                        # run with default_model or FAST_AGENT_MODEL configured
uv run agent.py --model='gpt-5.4-mini?reasoning=low'    # specify a model
uv run agent.py --transport http --port 8001  # expose as MCP server (server mode implied)
fast-agent quickstart workflow  # create "building effective agents" examples

モデルが設定されていない状態で対話形式の実行を開始すると、モデル選択画面が表示されます。 自動化やサーバーの実行では、--model を渡すか、FAST_AGENT_MODEL を設定するか、 default_model を設定するか、エージェントでモデルを宣言する必要があります。

パッケージ化されたスターターエージェントを使うには、fast-agent go --pack <name> --model <model> を実行します。 必要に応じて、選択した fast-agent ホームにパックをインストールしてから、 通常どおり go を開始します。--model は、モデルが明示的に設定されていないカードに対する フォールバックです。AgentCard でモデルが直接宣言されている場合は、そちらが優先されます。

その他のクイックスタート例には、MCP Roots のサポートを示す、研究者エージェント(評価者・最適化ワークフローを使用)とデータ分析エージェント(ChatGPT に似た操作感)があります。

ヒント

Windows ユーザーの場合、Filesystem および Docker MCP サーバーには設定変更がいくつか必要です。必要な変更については、設定ファイル内で詳しく説明しています。

基本的なエージェント

エージェントの定義は、次のように簡単に行えます。

@fast.agent(
  instruction="Given an object, respond only with an estimate of its size."
)

次に、エージェントにメッセージを送信できます。

async with fast.run() as agent:
    moon_size = await agent("the moon")
    print(moon_size)

または、エージェントとの対話型チャットを開始できます。

async with fast.run() as agent:
    await agent.interactive()

以下は、ボイラープレートコードを含む sizer.py エージェントアプリケーションの全体です。

import asyncio
from fast_agent import FastAgent

# Create the application
fast = FastAgent("Agent Example")


@fast.agent(instruction="Given an object, respond only with an estimate of its size.")
async def main():
    async with fast.run() as agent:
        await agent.interactive()


if __name__ == "__main__":
    asyncio.run(main())

エージェントは uv run sizer.py で実行できます。

--model スイッチでモデルを指定します。例:uv run sizer.py --model sonnet。

モデル文字列では、クエリによるオーバーライドも指定できます。例:

  • uv run sizer.py --model "gpt-5?reasoning=low"
  • uv run sizer.py --model "claude-sonnet-4-6?web_search=on"
  • uv run sizer.py --model "claude-sonnet-4-5?context=1m"
  • uv run sizer.py --model "gpt-5?poll_period=240"

Anthropic のモデルでは、明示的な 1M コンテキストのオプトインが引き続き必要な、以前の Sonnet 4 / Sonnet 4.5 モデルでのみ ?context=1m が必要です。 Claude Sonnet 4.6 と Claude Opus 4.6 では、長いコンテキストウィンドウがデフォルトで使用されるため、?context=1m は後方互換性のために受け付けられますが、不要です。

エージェントの組み合わせと MCP サーバーの利用

例を生成するには fast-agent quickstart workflow を実行します。この例は uv run workflow/chaining.py で実行できます。fast-agent.yaml をアクティブな fast-agent ホームに配置するか、必要に応じて設定ファイルのパスを明示的に指定してください。

エージェントを連鎖させてワークフローを構築できます。MCP サーバーは fast-agent.yaml ファイルで定義します。

@fast.agent(
    "url_fetcher",
    "Given a URL, provide a complete and comprehensive summary",
    servers=["fetch"],  # Name of an MCP Server defined in fast-agent.yaml
)
@fast.agent(
    "social_media",
    """
    Write a 280 character social media post for any given text.
    Respond only with the post, never use hashtags.
    """,
)
@fast.chain(
    name="post_writer",
    sequence=["url_fetcher", "social_media"],
)
async def main():
    async with fast.run() as agent:
        # using chain workflow
        await agent.post_writer("http://llmindset.co.uk")

すべてのエージェントとワークフローは、.send("message") または .prompt() を呼び出すとチャットセッションを開始します。

social.py として保存すると、次のコマンドでこのワークフローをコマンドラインから実行できます。

uv run workflow/chaining.py --agent post_writer --message "<url>"

--quiet スイッチを追加すると、進捗とメッセージの表示が無効になり、最終応答のみが返されます。シンプルな自動化に便利です。

MAKER

MAKER(「K 投票による誤り低減を用いた、大規模に分解されたエージェントプロセス」)は、ワーカーエージェントをラップし、応答がすべての代替案に対して k 票の差を獲得するまで繰り返しサンプリングします(「first-to-ahead-by-k」投票)。これは、まれなエラーが積み重なる可能性のある、単純なステップが長く連なる処理に役立ちます。

@fast.agent(
    name="classifier",
    instruction="Reply with only: A, B, or C.",
)
@fast.maker(
    name="reliable_classifier",
    worker="classifier",
    k=3,
    max_samples=25,
    match_strategy="normalized",
    red_flag_max_length=16,
)
async def main():
    async with fast.run() as agent:
        await agent.reliable_classifier.send("Classify: ...")
ツールとしてのエージェント

ツールとしてのエージェントのワークフローでは、複雑なタスクをサブタスクに分割し、メインエージェントの指示に基づいて他のエージェントをツールとして呼び出します。

このパターンは、OpenAI Agents SDK の ツールとしてのエージェント 機能に着想を得ています。

子エージェントをツールとして公開すると、ルーティング、並列化、オーケストレーターとワーカーによる分解を指示に直接実装し、組み合わせることができます。1 ターンあたり複数のツール呼び出しがサポートされ、並列で実行されます。

一般的な使用パターンは次のとおりです。

  • ルーティング:ユーザープロンプトに基づいて、適切な専門ツールを選択します。
  • 並列化:独立した項目やプロジェクトを並行して処理し、その後結果を集約します。
  • オーケストレーターとワーカー:タスクを範囲を限定したサブタスクに分割し(多くの場合、シンプルな JSON プランを使用)、実行を調整します。
@fast.agent(
    name="NY-Project-Manager",
    instruction="Return NY time + timezone, plus a one-line project status.",
    servers=["time"],
)
@fast.agent(
    name="London-Project-Manager",
    instruction="Return London time + timezone, plus a one-line news update.",
    servers=["time"],
)
@fast.agent(
    name="PMO-orchestrator",
    instruction=(
        "Get reports. Always use one tool call per project/news. "  # parallelization
        "Responsibilities: NY projects: [OpenAI, Fast-Agent, Anthropic]. London news: [Economics, Art, Culture]. "  # routing
        "Aggregate results and add a one-line PMO summary."
    ),
    default=True,
    agents=["NY-Project-Manager", "London-Project-Manager"],  # orchestrator-workers
)
async def main() -> None:
    async with fast.run() as agent:
        await agent("Get PMO report. Projects: all. News: Art, Culture")

拡張例と全パラメーターのサンプルは、リポジトリ内の examples/workflows/agents_as_tools_extended.pyで確認できます。

MCP OAuth(v2.1)

SSE および HTTP MCP サーバーでは、最小限の設定で OAuth がデフォルトで有効になります。ローカルのコールバックサーバーを使用して認証コードを取得します。ポートを利用できない場合は、URL を貼り付ける方法にフォールバックします。

  • fast-agent.yamlでサーバーごとに最小限の設定を行います。
mcp:
  servers:
    myserver:
      transport: http # or sse
      url: http://localhost:8001/mcp # or /sse for SSE servers
      auth:
        oauth: true # default: true
        redirect_port: 3030 # default: 3030
        redirect_path: /callback # default: /callback
        # scope: "user"       # optional; if omitted, server defaults are used
  • OAuth クライアントは PKCE とインメモリのトークンストレージを使用します(トークンはディスクに書き込まれません)。
  • トークンの永続化:デフォルトでは、keyringを介して OS のキーチェーンにトークンを安全に保存します。キーチェーンを利用できない場合(例:ヘッドレスコンテナ)は、セッション中インメモリストレージを使用します。
  • サーバーごとにインメモリストレージのみを強制するには、次のように設定します。
mcp:
  servers:
    myserver:
      transport: http
      url: http://localhost:8001/mcp
      auth:
        oauth: true
        persist: memory
  • 特定のサーバーで OAuth を無効にするには、そのサーバーにauth.oauth: falseを設定します。

MCP Ping(オプション)

MCP ping ユーティリティは、どちらのピア(クライアントまたはサーバー)でも有効にできます。Ping の概要を参照してください。

クライアント側の ping は、サーバーごとに設定します(デフォルト:間隔 30 秒、ping の見逃し 3 回)。

mcp:
  servers:
    myserver:
      ping_interval_seconds: 30 # optional; <=0 disables
      max_missed_pings: 3 # optional; consecutive timeouts before marking failed

ワークフロー

Chain

chainワークフローでは、エージェントを順番に呼び出す方法を、より宣言的に記述できます。


@fast.chain(
  "post_writer",
   sequence=["url_fetcher","social_media"]
)

# we can them prompt it directly:
async with fast.run() as agent:
  await agent.post_writer()

これによりインタラクティブセッションが開始され、指定した URL の短いソーシャルメディア投稿が作成されます。_chain_にプロンプトを送ると、チェーン内の最後のエージェントとのチャットに戻ります。@agent-nameと入力すると、プロンプトを送るエージェントを切り替えられます。

Chain は他のワークフローに組み込んだり、他のワークフロー要素(他の Chain を含む)を含めたりできます。必要に応じてinstructionを設定し、他のワークフローステップに対して機能を正確に説明できます。

Human Input

エージェントは、タスクを支援してもらったり、追加のコンテキストを得たりするために、ユーザーに入力を求めることができます。

@fast.agent(
    instruction="An AI agent that assists with basic tasks. Request Human Input when needed.",
    human_input=True,
)

await agent("print the next number in the sequence")

human_input.pyの例では、エージェントがタスクの完了に必要な追加情報をユーザーに尋ねます。

Parallel

Parallel ワークフローは、同じメッセージを複数のエージェントに同時に送り(fan-out)、その後fan-inエージェントが統合された内容を処理します。

@fast.agent("translate_fr", "Translate the text to French")
@fast.agent("translate_de", "Translate the text to German")
@fast.agent("translate_es", "Translate the text to Spanish")

@fast.parallel(
  name="translate",
  fan_out=["translate_fr","translate_de","translate_es"]
)

@fast.chain(
  "post_writer",
   sequence=["url_fetcher","social_media","translate"]
)

fan-inエージェントを指定しない場合、parallelはエージェントの結果をそのまま結合して返します。

parallelは、異なる LLM のアイデアを組み合わせる用途にも便利です。

他のワークフロー内でparallelを使用する場合は、その動作を説明するinstructionを指定してください。

Evaluator-Optimizer

Evaluator-Optimizer は 2 つのエージェントを組み合わせます。コンテンツを生成するエージェント(generator)と、そのコンテンツを評価して実行可能なフィードバックを提供するエージェント(evaluator)です。メッセージは最初に Generator に送られ、その後、Evaluator が品質に満足するか、最大改善回数に達するまで、両者の処理がループします。最終的に Generator の結果が返されます。

Generator で use_history がオフの場合、改善を求める際には前回のイテレーションが返されます。オンの場合は、会話のコンテキストが使用されます。

@fast.evaluator_optimizer(
  name="researcher",
  generator="web_searcher",
  evaluator="quality_assurance",
  min_rating="EXCELLENT",
  max_refinements=3
)

async with fast.run() as agent:
  await agent.researcher.send("produce a report on how to make the perfect espresso")

ワークフローで使用すると、最後の generator メッセージが結果として返されます。

より詳しい例については、evaluator.py のワークフロー例、または fast-agent quickstart researcher をご覧ください。

Router

Router は LLM を使用してメッセージを評価し、最も適切なエージェントにルーティングします。ルーティングプロンプトは、エージェントの指示と利用可能なサーバーに基づいて自動生成されます。

@fast.router(
  name="route",
  agents=["agent1","agent2","agent3"]
)

例については、router.py のワークフローをご覧ください。

Orchestrator

複雑なタスクが与えられると、Orchestrator は LLM を使用して、利用可能なエージェントにタスクを分割する計画を生成します。計画と集約のプロンプトは Orchestrator によって生成されるため、より高性能なモデルを使用すると効果的です。計画は最初に一度だけ作成する(plan_type="full")か、反復的に作成する(plan_type="iterative")ことができます。

@fast.orchestrator(
  name="orchestrate",
  agents=["task1","task2","task3"]
)

ワークフロー例については、orchestrator.py または agent_build.py をご覧ください。

エージェントの機能

エージェントの呼び出し

簡潔に記述できるよう、すべての定義で名前と指示の引数を省略できます。

@fast.agent("You are a helpful agent")          # Create an agent with a default name.
@fast.agent("greeter","Respond cheerfully!")    # Create an agent with the name "greeter"

moon_size = await agent("the moon")             # Call the default (first defined agent) with a message

result = await agent.greeter("Good morning!")   # Send a message to an agent by name using dot notation
result = await agent.greeter.send("Hello!")     # You can call 'send' explicitly

await agent.greeter()                           # If no message is specified, a chat session will open
await agent.greeter.prompt()                    # that can be made more explicit
await agent.greeter.prompt(default_prompt="OK") # and supports setting a default prompt

await agent["greeter"].send("Good Evening!")    # Dictionary access is supported if preferred
エージェントの定義
基本的なエージェント
@fast.agent(
  name="agent",                          # name of the agent
  instruction="You are a helpful Agent", # base instruction for the agent
  servers=["filesystem"],                # list of MCP Servers for the agent
  model="gpt-5.4-mini?reasoning=high",   # specify a model for the agent
  use_history=True,                      # agent maintains chat history
  request_params=RequestParams(temperature= 0.7), # additional parameters for the LLM (or RequestParams())
  human_input=True,                      # agent can request human input
)
Chain
@fast.chain(
  name="chain",                          # name of the chain
  sequence=["agent1", "agent2", ...],    # list of agents in execution order
  instruction="instruction",             # instruction to describe the chain for other workflows
  cumulative=False,                      # whether to accumulate messages through the chain
  continue_with_final=True,              # open chat with agent at end of chain after prompting
)
Parallel
@fast.parallel(
  name="parallel",                       # name of the parallel workflow
  fan_out=["agent1", "agent2"],          # list of agents to run in parallel
  fan_in="aggregator",                   # name of agent that combines results (optional)
  instruction="instruction",             # instruction to describe the parallel for other workflows
  include_request=True,                  # include original request in fan-in message
)
Evaluator-Optimizer
@fast.evaluator_optimizer(
  name="researcher",                     # name of the workflow
  generator="web_searcher",              # name of the content generator agent
  evaluator="quality_assurance",         # name of the evaluator agent
  min_rating="GOOD",                     # minimum acceptable quality (EXCELLENT, GOOD, FAIR, POOR)
  max_refinements=3,                     # maximum number of refinement iterations
)
Router
@fast.router(
  name="route",                          # name of the router
  agents=["agent1", "agent2", "agent3"], # list of agent names router can delegate to
  model="gpt-5.4-mini?reasoning=high",   # specify routing model
  use_history=False,                     # router does not maintain conversation history
  human_input=False,                     # whether router can request human input
)
Orchestrator
@fast.orchestrator(
  name="orchestrator",                   # name of the orchestrator
  instruction="instruction",             # base instruction for the orchestrator
  agents=["agent1", "agent2"],           # list of agent names this orchestrator can use
  model="gpt-5.4-mini?reasoning=high",   # specify orchestrator planning model
  use_history=False,                     # orchestrator doesn't maintain chat history (no effect).
  human_input=False,                     # whether orchestrator can request human input
  plan_type="full",                      # planning approach: "full" or "iterative"
  plan_iterations=5,                     # maximum number of full plan attempts, or iterations
)
MAKER
@fast.maker(
  name="maker",                           # name of the workflow
  worker="worker_agent",                  # worker agent name
  k=3,                                    # voting margin (first-to-ahead-by-k)
  max_samples=50,                         # maximum number of samples
  match_strategy="exact",                 # exact|normalized|structured
  red_flag_max_length=256,                # flag unusually long outputs
  instruction="instruction",              # optional instruction override
)
ツールとしてのエージェント
@fast.agent(
  name="orchestrator",                    # orchestrator agent name
  instruction="instruction",              # orchestrator instruction (routing/decomposition/aggregation)
  agents=["agent1", "agent2"],            # exposed as tools: agent__agent1, agent__agent2
  max_parallel=128,                       # cap parallel child tool calls (OpenAI limit is 128)
  child_timeout_sec=600,                  # per-child timeout (seconds)
  max_display_instances=20,               # collapse progress display after top-N instances
)
関数ツール

Python 関数をコード内で直接ツールとして登録できます。MCP サーバーや外部ファイルは必要ありません。同期関数と非同期関数の両方に対応しています。デフォルトでは関数名と docstring がツール名と説明として使用されますが、name= と description= で上書きできます。

エージェントごとのツール(@agent.tool) — 特定のエージェントにツールの適用範囲を限定します。

@fast.agent(name="writer", instruction="You write things.")
async def writer(): ...


@writer.tool
def translate(text: str, language: str) -> str:
    """Translate text to the given language."""
    return f"[{language}] {text}"


@writer.tool(name="summarize", description="Produce a one-line summary")
def summarize(text: str) -> str:
    return f"Summary: {text[:80]}..."

グローバルツール(@fast.tool) — 独自のツールを宣言していないすべてのエージェントが利用できます。

@fast.tool
def get_weather(city: str) -> str:
    """Return the current weather for a city."""
    return f"Sunny in {city}"

@fast.agent(name="assistant", instruction="You are helpful.")
# assistant gets get_weather (global @fast.tool)

@agent.tool または function_tools= を設定したエージェントには、そのエージェント独自のツールのみが表示され、グローバルツールは注入されません。グローバルツールを使用せず、ツールなしを明示するには function_tools=[] を使用します。

マルチモーダル対応

MCP の型を直接使用するか、外部の MCP リソースサーバーを介して、リソースをプロンプトに追加できます。たとえば、便利な API を使うと簡単に実行できます。

summary: str = await agent.with_resource(
    "Summarise this PDF please",
    "mcp_server",
    "resource://fast-agent/sample.pdf",
)
MCP ツール結果の変換

LLM API では、Chat Completions API を介してツール呼び出し/関数の結果として返せるコンテンツの種類に制限があります。

  • OpenAI はテキストに対応しています
  • Anthropic はテキストと画像に対応しています
  • Google はテキスト、画像、PDF、動画(例:video/mp4)に対応しています。

    注:インライン動画データは 20MB に制限されています。より大きなファイルには File API を使用してください。YouTube の URL はそのまま使用できます。

MCP ツールの結果では、ImageResources と EmbeddedResources がユーザーメッセージに変換され、会話に追加されます。

プロンプト

MCP プロンプトは apply_prompt(name,arguments) でサポートされており、常にアシスタントメッセージを返します。MCP サーバーからの最後のメッセージが「ユーザー」メッセージの場合、処理のために LLM に送信されます。エージェントのコンテキストに適用されたプロンプトは保持されます。つまり、use_history=False の場合、エージェントは細かく調整された応答を返せます。

プロンプトは、インタラクティブインターフェースで /prompt コマンドを使用して適用することもできます。

サンプリング

サンプリング用の LLM は、クライアントとサーバーのペアごとに設定します。次のように fast-agent.yaml でモデル名を指定します。

mcp:
  servers:
    sampling_resource:
      command: "uv"
      args: ["run", "sampling_resource_server.py"]
      sampling:
        model: "haiku"
シークレットファイル

ヒント

fast-agent.secrets.yaml は、現在使用している fast-agent のホームディレクトリにある fast-agent.yaml と同じ場所に配置してください。--home または FAST_AGENT_HOME で別のホームディレクトリを選択できます。--workspace で別のワークスペースを選択すると、ホームディレクトリは <workspace>/.fast-agent に設定されます。

インタラクティブシェル

fast-agent

ドキュメント

ドキュメントサイトは docs/ にあります。ドキュメントをローカルで作業するには、以下を実行してください。

# Install docs dependencies (first time only)
uv run scripts/docs.py install

# Generate reference docs from source code
uv run scripts/docs.py generate

# Run the dev server (http://127.0.0.1:8000)
uv run scripts/docs.py serve

# Capture and assess screenshots of the built docs
uv run scripts/docs.py screenshot
uv run scripts/docs.py assess

# Or generate and serve in one command
uv run scripts/docs.py all

ドキュメントを同期した状態に保つため、ジェネレーターは設定フィールドの説明、モデルのエイリアス、API リファレンスをソースコードから直接抽出します。

プロジェクトについて

fast-agent は、Sarmad Qadri による mcp-agent プロジェクトを基盤としています。

貢献

貢献や PR を歓迎します。議論のために、気軽に課題を提起してください。貢献に関する詳しいガイドラインとロードマップは、近日公開予定です。ぜひご連絡ください!

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。