mcpField
C
cloudflare-agents

cloudflare-agents

github.com/secondskyエージェントワークフロー240382 回インストール5 週間前に更新
リポジトリ

cloudflare-agents について

Cloudflare上でLLMアプリケーションを開発する人向けのエージェント構築ガイドです。ツール登録、プロバイダー、Cloudflareバインディング、MCP連携、実装テンプレートを扱います。

主な機能

  1. 01ツールの登録と実行
  2. 02OpenAI、Anthropic、Geminiのプロバイダー
  3. 03Cloudflare D1、KV、R2、Durable Objects
  4. 04HTTP、SSE、WebSocketのパターン
  5. 05状態管理とスケジュールタスク
  6. 06エージェントとMCP連携のテンプレート

活用シーン

  1. 01登録済みツールを呼び出すエージェントの構築
  2. 02エージェントとCloudflareストレージバインディングの接続
  3. 03ストリーミングまたはWebSocketのエージェント画面の実装
  4. 04CloudflareエージェントへのMCP連携の追加

MCP 対応

MCPプロトコルのサポートを扱い、MCP連携のリファレンスと、MCPサーバーをエージェントに接続するテンプレートを提供します。

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/secondsky/claude-skills --skill cloudflare-agents

インストール後、Claude Code で/cloudflare-agentsを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

references/
advanced-features.md
agent-api.md
configuration-guide.md
error-catalog.md
http-sse-guide.md
mcp-integration.md
patterns-concepts.md
state-management.md
websockets-guide.md
templates/
basic-agent.ts
browser-agent.ts
calling-agents-worker.ts
chat-agent-streaming.ts
hitl-agent.ts
mcp-server-basic.ts
rag-agent.ts
react-useagent-client.tsx
scheduled-agent.ts
state-sync-agent.ts
websocket-agent.ts
workflow-agent.ts
wrangler-agents-config.jsonc

詳細

Cloudflare Agents

最終更新日:2025-11-21

クイックスタート

export default {
  async fetch(request, env, ctx) {
    const agent = {
      tools: [
        { name: 'getTodo', handler: async ({id}) => ({id, title: 'Task'}) }
      ],
      async run(input) {
        return await processWithLLM(input, this.tools);
      }
    };
    
    return Response.json(await agent.run(await request.text()));
  }
};

主な機能

  • ツール統合:ツールの登録と実行
  • LLM プロバイダー:OpenAI、Anthropic、Google Gemini
  • MCP プロトコル:Model Context Protocol に対応
  • Cloudflare バインディング:D1、KV、R2、Durable Objects

エージェントパターン

const agent = {
  tools: [...],
  systemPrompt: 'You are a helpful assistant',
  model: 'gpt-4o',
  async run(input) {
    // Process with LLM
  }
};

リソース

コアドキュメント
  • references/patterns-concepts.md (317 lines) - Cloudflare Agents とは何か、パターンと概念、重要なルール、既知の問題の防止策
  • references/configuration-guide.md (152 lines) - 設定の詳細な解説
  • references/agent-api.md (115 lines) - Agent Class API の完全なリファレンス
統合ガイド
  • references/http-sse-guide.md (74 lines) - HTTP と Server-Sent Events
  • references/websockets-guide.md (110 lines) - WebSocket の統合
  • references/state-management.md (388 lines) - 状態管理、スケジュールされたタスク、ワークフロー
  • references/mcp-integration.md (130 lines) - Model Context Protocol の統合
高度な機能
  • references/advanced-features.md (637 lines) - ブラウザー自動化、RAG、AI モデルの統合、エージェントの呼び出し、クライアント API
エラーリファレンス
  • references/error-catalog.md (10 lines) - よくあるエラーと解決策
テンプレート
  • templates/basic-agent.ts - 基本的なエージェントのセットアップ
  • templates/browser-agent.ts - ブラウザー自動化
  • templates/calling-agents-worker.ts - 他のエージェントの呼び出し
  • templates/chat-agent-streaming.ts - ストリーミングチャットエージェント
  • templates/hitl-agent.ts - ヒューマン・イン・ザ・ループ
  • templates/mcp-server-basic.ts - MCP サーバーの統合
  • templates/rag-agent.ts - RAG の実装
  • templates/react-useagent-client.tsx - React クライアントの統合
  • templates/scheduled-agent.ts - スケジュールされたタスク
  • templates/state-sync-agent.ts - 状態の同期
  • templates/websocket-agent.ts - WebSocket エージェント
  • templates/workflow-agent.ts - ワークフローの統合
  • templates/wrangler-agents-config.jsonc - Wrangler の設定

公式ドキュメント:https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-agents/

コメント