langchain-ai/swarm

多くの独立したアイテムを並行して処理します:テーブルを作成し、サブエージェントに分散し、結果を集約します。1行=1つの作業単位。

swarm とは?

langchain-ai/swarmは、独立したタスクを並行して実行するためのスキルです。開発者はテーブル形式で作業単位を定義し、各タスクをサブエージェントに割り当て、結果を一元的に収集できます。このスキルは、Claude CodeやCursor、CodexなどのAIエージェントプラットフォームで使用でき、大量のデータ処理やバッチジョブの効率的な実行を実現します。SKILL.mdのドキュメントに従い、fan-out(分散)とaggregate(集約)のパターンを自動化し、各タスクの進捗管理と結果の統合を容易にします。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/langchain-ai/langchain-skills/tree/main/skills/swarm

Installed? Explore more 生産性&コラボレーション skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

swarm は何をしますか?

多くの独立したアイテムを並行して処理します:テーブルを作成し、サブエージェントに分散し、結果を集約します。1行=1つの作業単位。

概要

このスキルは、swarmパターンを実装し、多数の独立したタスクを効率的に並行実行します。テーブルを作成し、各行を作業単位としてサブエージェントに割り当て、結果を自動収集・集約します。

使用例

# サブエージェントを起動してタスクを実行
$ swarm --task-table tasks.csv --output results.json

主な機能

  • 並行処理: 複数のサブエージェントを同時に起動し、独立したタスクを高速処理
  • テーブル駆動: CSVまたはテーブル形式でタスクを定義、各行が1つの作業単位
  • 自動集約: 全タスク完了後、結果を統合して出力
  • 進捗追跡: 各タスクの状態をリアルタイムで監視可能

対応プラットフォーム

  • Claude Code
  • Cursor
  • Codex
  • その他AIエージェント

動作の仕組み

  1. ユーザーがテーブル(例: CSV)を作成
  2. テーブルの各行がサブエージェントにfan-out
  3. 各サブエージェントが独立して処理を実行
  4. 全結果をcollectしてaggregate
  5. 最終的な出力をユーザーに提示

環境変数

  • SWARM_MAX_WORKERS: 同時実行するサブエージェントの最大数(デフォルト: 5)
  • SWARM_TIMEOUT: 各タスクのタイムアウト時間(秒)

注意事項

  • 各タスクは完全に独立している必要があります(依存関係不可)
  • サブエージェントは親エージェントのコンテキストを継承しません
  • 大規模なデータセットでは適切なタイムアウト設定を推奨

サンプル

task_id,command,params
1,process_image,image1.jpg
2,process_image,image2.jpg
3,analyze_text,doc1.txt

上記のテーブルを入力として、各タスクを並行実行し、結果をJSONで出力します。

Individual skills in this repo

This repo contains 11 individual skills — each has its own dedicated page.

langchain-ai/deep-agents-core

INVOKE THIS SKILL when building ANY Deep Agents application. Covers create_deep_agent(), harness architecture, SKILL.md format, and configuration options.

langchain-ai/deep-agents-memory

INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access. Covers StateBackend (ephemeral), StoreBackend (persistent), FilesystemMiddleware, and CompositeBackend for routing.

langchain-ai/deep-agents-orchestration

INVOKE THIS SKILL when using subagents, task planning, or human approval in Deep Agents. Covers SubAgentMiddleware, TodoList for planning, and HITL interrupts.

langchain-ai/framework-selection

INVOKE THIS SKILL at the START of any LangChain/LangGraph/Deep Agents project, before writing any agent code. Determines which framework layer is right for the task: LangChain, LangGraph, Deep Agents, or a combination. Must be consulted before other agent skills.

langchain-ai/langchain-dependencies

INVOKE THIS SKILL when setting up a new project or when asked about package versions, installation, or dependency management for LangChain, LangGraph, LangSmith, or Deep Agents. Covers required packages, minimum versions, environment requirements, versioning best practices, and common community tool packages for both Python and TypeScript.

langchain-ai/langchain-fundamentals

Create LangChain agents with create_agent, define tools, and use middleware for human-in-the-loop and error handling.

langchain-ai/langchain-middleware

INVOKE THIS SKILL when you need human-in-the-loop approval, custom middleware, or structured output. Covers HumanInTheLoopMiddleware for human approval of dangerous tool calls, creating custom middleware with hooks, Command resume patterns, and structured output with Pydantic/Zod.

langchain-ai/langchain-rag

INVOKE THIS SKILL when building ANY retrieval-augmented generation (RAG) system. Covers document loaders, RecursiveCharacterTextSplitter, embeddings (OpenAI), and vector stores (Chroma, FAISS, Pinecone).

langchain-ai/langgraph-fundamentals

INVOKE THIS SKILL when writing ANY LangGraph code. Covers StateGraph, state schemas, nodes, edges, Command, Send, invoke, streaming, and error handling.

langchain-ai/langgraph-human-in-the-loop

INVOKE THIS SKILL when implementing human-in-the-loop patterns, pausing for approval, or handling errors in LangGraph. Covers interrupt(), Command(resume=...), approval/validation workflows, and the 4-tier error handling strategy.

langchain-ai/langgraph-persistence

INVOKE THIS SKILL when your LangGraph needs to persist state, remember conversations, travel through history, or configure subgraph checkpointer scoping. Covers checkpointers, thread_id, time travel, Store, and subgraph persistence modes.

関連スキル