🔀coordinating-multi-space-devops-agent
- ソース
- GitHub で見る ↗
説明
1つのClaude Codeセッションから、複数のAgentSpaceにまたがってAWS DevOps Agentを統括します。質問を適切なspace(本番・ステージング・ナレッジ)にルーティングしたり、複数のspaceに対して並行クエリを実行して結果を統合したり、アカウント間で調査結果を比較したりすることができます。 次のような場合に使用: ユーザーが複数のAgentSpaceを設定している場合、複数のAWSアカウントに言及している場合、または「本番とステージングの両方を確認して」「アカウント間で比較して」「ナレッジspaceに聞いて」といった操作をリクエストしている場合。
原文を表示
Coordinate the AWS DevOps Agent across multiple AgentSpaces from one Claude Code session — route questions to the right space (prod vs staging vs knowledge), query several spaces in parallel and synthesize, or compare findings across accounts. Use whenever the user has more than one AgentSpace configured, mentions multiple AWS accounts, or asks something like "check both prod and staging", "compare across accounts", or "ask the knowledge space".
ユースケース
- ✓複数のAgentSpaceを設定しているとき
- ✓複数のAWSアカウントに言及されているとき
- ✓本番とステージング両方を確認するとき
- ✓アカウント間で調査結果を比較するとき
- ✓ナレッジspaceに問い合わせるとき
本文(日本語訳)
複数のAgentSpaceへのクエリ
事前確認
aws_devops_agent__list_agent_spaces が利用可能なツール一覧に存在しない場合、リモートMCPサーバーに接続されていません。
ユーザーに「help me set up the AWS DevOps Agent」と入力するよう案内し、setup-devops-agent スキルが自動ロードされるようにしてください。
前提条件: SigV4認証が必要
マルチスペースルーティングには SigV4認証 が必要です。 BearerトークンはAgentSpace単体にスコープされており、他のスペースへのルーティングには使用できません。
実際の多くのチームは複数のAgentSpaceを運用しています。 典型的な構成としては、本番スペース、ステージングスペース、そして複数アカウントで共有するランブックを保管する専用の「ナレッジ」スペースがあります。 各スペースには、それぞれ固有のAWSアカウント、ランブック、および履歴があります。
このスキルはルーティングのコアロジックです。
次のような場合に使用: ユーザーが複数のスペースを設定している場合、またはユーザーの質問が複数のアカウントにまたがる場合。
スペースの探索
aws_devops_agent__list_agent_spaces()
→ {"agentSpaces": [{"agentSpaceId": "as-abc123", "name": "prod"}, ...]}
スペースが1つだけ返された場合、このスキルは不要です。
chatting-with-aws-devops-agent または investigating-incidents-with-aws-devops-agent を直接使用してください(agent_space_id の指定は不要です)。
2つ以上返された場合は、ユーザーの質問が以下のどのパターンに該当するかを判断してください:
| 質問の形式 | 戦略 |
|---|---|
| 特定の環境に限定されている(「本番が壊れている」) | シングルスペース — 該当するスペースを1つ選択 |
| 複数環境にまたがる(「本番とステージングを比較して」) | 並列 — 各スペースにクエリして結果を統合 |
| 汎用的なナレッジ検索(「ECS用のランブックはある?」) | そのような名前のナレッジスペースがあればそこへルーティング |
| 曖昧(「サービスが遅い」) | ユーザーに確認 — 推測せず、どの環境か尋ねる |
セッション内ルーティングメモリ
ユーザーがローカルにルーティングガイドを保存している場合
(例: .claude/aws-agents-for-devsecops.md、AGENTS.md、またはプロジェクトごとのメモ)、
セッション開始時に一度読み込み、会話全体のルーティングテーブルとして使用してください。
期待されるフォーマット:
| Space | AWS Profile | Agent Space ID | Purpose |
|-------|-------------|----------------|---------|
| prod | acme-prod | as-abc123 | Production incidents, customer-facing services |
| stage | acme-stage | as-def456 | Pre-prod validation, integration testing |
| kb | acme-shared | as-ghi789 | Shared runbooks, cross-account knowledge |
ガイドが存在しない場合は、以下の手順で探索を実行してください:
aws_devops_agent__list_agent_spaces()を実行して全スペースを取得する。- 各スペースに対して:
aws_devops_agent__chat(message="Summarize the AWS accounts, services, and runbooks you have access to.", agent_space_id="<SPACE_ID>")を実行し、1段落の概要を取得する。 - 将来のセッションで探索をスキップできるよう、ルーティングガイドをプロジェクトに書き出すことをユーザーに提案する(例:
.claude/aws-agents-for-devsecops.md、AGENTS.md、またはプロジェクトごとのメモ)。
パターンA — 並列クエリ、統合された1つの回答
次のような場合に使用: ユーザーが比較を求めている場合。 例:「本番とステージングのエラーレートを比較して」「この問題は両方のアカウントで発生している?」「全環境のコストを監査して」。
# 1. 環境固有のコンテキストを含めて各スペースに並列でクエリ
aws_devops_agent__chat(message="<question> | env=prod | <prod IaC context>", agent_space_id="PROD_ID")
→ {"executionId": "...", "answer": "..."}
aws_devops_agent__chat(message="<question> | env=stage | <stage IaC context>", agent_space_id="STAGE_ID")
→ {"executionId": "...", "answer": "..."}
# 2. ローカルで統合 — 2つの回答をそのまま並べるのではなく、並列比較のサマリーとして提示
両方のレスポンスをそのまま貼り付けないでください。 両方を読み込み、共通点と相違点を整理したうえで、ユーザーに差分を伝えてください。それがこのスキルの価値です。
パターンB — ナレッジ検索 → スペースごとのアクション
次のような場合に使用: あるスペースが保有するランブックやナレッジが、別のスペースでの作業の指針となる場合。
# 1. まずナレッジスペースに問い合わせ
aws_devops_agent__chat(
message="What's our standard runbook for ECS 503 errors?",
agent_space_id="KB_ID"
)
→ {"answer": "<runbook text>"}
# 2. そのランブックを対象環境に適用
aws_devops_agent__investigate(
title="ECS 503 errors on checkout-service. [Runbook from knowledge space] <runbook text> [Local context] ...",
agent_space_id="PROD_ID",
priority="HIGH"
)
DevOps Agentはスペース間で状態を共有しません。
ナレッジスペースのレスポンスをインベスティゲーションの title に引用することで、その橋渡しを行います。
パターンC — 特定スペースへのシングルクエリ
次のような場合に使用: ユーザーがスペースまたは環境を明示的に指定している場合。
# ルーティングメモリから対応するagentSpaceIdを選び、呼び出し時に渡す
aws_devops_agent__chat(message="<question>", agent_space_id="<matched_space_id>")
ルーティングが曖昧でユーザーが指定していない場合は、一度だけ確認してください。 誤ったアカウントに投げ込むよりも、確認するほうが確実です。
パターンD — インベスティゲーションは状態を共有しない
インベスティゲーションはスペース単位です。 問題が複数アカウントにまたがる場合は、2つのインベスティゲーションが必要になることがあります:
aws_devops_agent__investigate(title="Latency spike — prod side", agent_space_id="PROD_ID", priority="HIGH")
aws_devops_agent__investigate(title="Latency spike — stage side", agent_space_id="STAGE_ID", priority="HIGH")
両方の taskId を記録し、両方をポーリングしてください。結果はまとめて提示してください。
このパターンはまれです。通常は1つのスペースが問題を所有しています。 デフォルトでファンアウトしないでください。
やってはいけないこと
- すべての質問をすべてのスペースに投げ込まないでください。 処理が遅くなり、コストがかかり、ユーザーは3倍の出力を読まなければなりません。
- スコープを確認せずにファンアウトしないでください。 スペースの
descriptionや記録されているカバレッジに関連サービスが含まれていない場合は、そのスペースをスキップしてください。スコープ不一致のスペースに質問を送ると、「わかりません」を返さずにハングアップすることがよくあります。 - デフォルトでインベスティゲーションを並列起動しないでください。 1件あたり5〜8分かかります。インシデントを所有する1つのスペースを選択してください。
- 会話の途中でスペースをこっそり切り替えないでください。 フォローアップの質問で別のスペースが必要になった場合は、ユーザーに明示してください: 「ランブックを調べるためにナレッジスペースに切り替えます。」
タイムアウトの目安
chat ツールはレスポンス全体をサーバーサイドでバッファリングしてから返します。
複雑なクロスアカウントクエリは、スペースあたり30〜90秒かかることがあります。
90秒以内にスペースが応答しない場合は、スコープ不一致の可能性が高いです。
ハングアップせず、「Space X が90秒以内に応答しませんでした — スキップします(スコープ不一致の可能性があります)」のようなメッセージをユーザーに提示して次に進んでください。
関連情報
examples/multi-space-walkthrough.md— 完全なシナリオの例(本番インシデントにおけるステージングとの比較およびナレッジスペースのランブック参照)。setup-devops-agentスキル — 複数のAgentSpace、AWSプロファイル、シェルラッパーの初回設定。
原文(English)を表示
Querying multiple AgentSpaces
Pre-flight
If aws_devops_agent__list_agent_spaces is not in your available tools, the remote MCP server is not connected. Tell the user to ask "help me set up the AWS DevOps Agent" so the setup-devops-agent skill auto-loads.
Prerequisite: SigV4 auth required
Multi-space routing requires SigV4 authentication — Bearer tokens are scoped to a single AgentSpace and cannot route to other spaces.
Many real teams run more than one AgentSpace — typically a production space, a staging space, and a dedicated "knowledge" space that holds runbooks shared across accounts. Each space has its own set of associated AWS accounts, runbooks, and history.
This skill is the routing brain. Use it when the user has multiple spaces configured, or when a question genuinely spans accounts.
Discovering spaces
aws_devops_agent__list_agent_spaces()
→ {"agentSpaces": [{"agentSpaceId": "as-abc123", "name": "prod"}, ...]}
If only one space is returned, this skill doesn't apply — use chatting-with-aws-devops-agent or investigating-incidents-with-aws-devops-agent directly (no agent_space_id needed).
If more than one is returned, decide whether the user's question is:
| Question shape | Strategy |
|---|---|
| Scoped to one environment ("prod is broken") | Single space — pick the matching one |
| Spans environments ("compare prod vs staging") | Parallel — query each, synthesize |
| Generic knowledge ("what runbooks do we have for ECS?") | Route to the knowledge space if one is named that way |
| Ambiguous ("our service is slow") | Ask the user which environment, don't guess |
Per-session routing memory
If the user has a routing guide stored locally (e.g. .claude/aws-agents-for-devsecops.md, AGENTS.md, or per-project notes), read it once at the start of the session and use it as the routing table for the rest of the conversation. Format expected:
| Space | AWS Profile | Agent Space ID | Purpose |
|-------|-------------|----------------|---------|
| prod | acme-prod | as-abc123 | Production incidents, customer-facing services |
| stage | acme-stage | as-def456 | Pre-prod validation, integration testing |
| kb | acme-shared | as-ghi789 | Shared runbooks, cross-account knowledge |
If no guide exists, run discovery:
aws_devops_agent__list_agent_spaces()→ get all spaces.- For each space:
aws_devops_agent__chat(message="Summarize the AWS accounts, services, and runbooks you have access to.", agent_space_id="<SPACE_ID>")→ get a one-paragraph summary. - Offer to write the routing guide to the project (e.g.
.claude/aws-agents-for-devsecops.md,AGENTS.md, or per-project notes) so future sessions skip discovery.
Pattern A — Parallel queries, one synthesized answer
Use when the user wants a comparison: "compare prod and staging error rates", "is this issue happening in both accounts?", "audit costs across all our environments".
# 1. Query each space in parallel with environment-specific context
aws_devops_agent__chat(message="<question> | env=prod | <prod IaC context>", agent_space_id="PROD_ID")
→ {"executionId": "...", "answer": "..."}
aws_devops_agent__chat(message="<question> | env=stage | <stage IaC context>", agent_space_id="STAGE_ID")
→ {"executionId": "...", "answer": "..."}
# 2. Synthesize locally — present a side-by-side summary, not two separate dumps
Don't just paste both responses. Read both, identify what's the same vs. different, and tell the user the delta — that's the value.
Pattern B — Knowledge lookup, then per-space action
Use when one space holds runbooks/knowledge that informs work in another space.
# 1. Ask the knowledge space first
aws_devops_agent__chat(
message="What's our standard runbook for ECS 503 errors?",
agent_space_id="KB_ID"
)
→ {"answer": "<runbook text>"}
# 2. Apply that runbook in the target environment
aws_devops_agent__investigate(
title="ECS 503 errors on checkout-service. [Runbook from knowledge space] <runbook text> [Local context] ...",
agent_space_id="PROD_ID",
priority="HIGH"
)
The DevOps Agent doesn't share state between spaces — you bridge it by quoting the knowledge space's response into the investigation's title.
Pattern C — Targeted single-space query
Use when the user explicitly names a space or environment.
# Pick the matching agentSpaceId from your routing memory, pass it on the call
aws_devops_agent__chat(message="<question>", agent_space_id="<matched_space_id>")
If the routing is ambiguous and the user doesn't say, ask once — better than firing into the wrong account.
Pattern D — Investigations don't share state
Investigations are per-space. If an issue spans accounts, you may need two investigations:
aws_devops_agent__investigate(title="Latency spike — prod side", agent_space_id="PROD_ID", priority="HIGH")
aws_devops_agent__investigate(title="Latency spike — stage side", agent_space_id="STAGE_ID", priority="HIGH")
Track both taskIds. Poll both. Surface findings together.
This is rare — usually one space owns the problem. Don't fan out by default.
What NOT to do
- Don't blast every space with every question. It's slow, expensive, and the user has to read 3× as much output.
- Don't fan out without verifying scope. If a space's
descriptionor recorded coverage doesn't mention the relevant service, skip it — sending a question into a scope-mismatched space typically hangs rather than returning "I don't know." - Don't fire investigations in parallel by default. They take 5–8 minutes each. Pick the one space that owns the incident.
- Don't silently switch spaces mid-conversation. If a follow-up needs a different space, tell the user: "Switching to the knowledge space to look up the runbook."
Timeout guidance
The chat tool buffers the full response server-side before returning. Complex cross-account queries can take 30-90s per space. If a space doesn't respond within 90s, it's likely a scope mismatch — surface a message like "Space X did not respond within 90s — skipping (likely scope mismatch)" and move on rather than hanging.
See also
examples/multi-space-walkthrough.mdfor a fully worked scenario (prod incident with staging comparison and knowledge-space runbook lookup).- The
setup-devops-agentskill for first-time configuration of multiple AgentSpaces, AWS profiles, and shell wrappers.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。