$npx -y skills add aws/agent-toolkit-for-aws --skill coordinating-multi-space-devops-agentCoordinate 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
| 1 | # Querying multiple AgentSpaces |
| 2 | |
| 3 | ## Pre-flight |
| 4 | |
| 5 | 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. |
| 6 | |
| 7 | ## Prerequisite: SigV4 auth required |
| 8 | |
| 9 | Multi-space routing requires **SigV4 authentication** — Bearer tokens are scoped to a single AgentSpace and cannot route to other spaces. |
| 10 | |
| 11 | 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. |
| 12 | |
| 13 | This skill is the routing brain. Use it when the user has multiple spaces configured, or when a question genuinely spans accounts. |
| 14 | |
| 15 | ## Discovering spaces |
| 16 | |
| 17 | ``` |
| 18 | aws_devops_agent__list_agent_spaces() |
| 19 | → {"agentSpaces": [{"agentSpaceId": "as-abc123", "name": "prod"}, ...]} |
| 20 | ``` |
| 21 | |
| 22 | 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). |
| 23 | |
| 24 | If more than one is returned, decide whether the user's question is: |
| 25 | |
| 26 | | Question shape | Strategy | |
| 27 | |---------------|----------| |
| 28 | | Scoped to one environment ("prod is broken") | Single space — pick the matching one | |
| 29 | | Spans environments ("compare prod vs staging") | **Parallel** — query each, synthesize | |
| 30 | | Generic knowledge ("what runbooks do we have for ECS?") | Route to the **knowledge** space if one is named that way | |
| 31 | | Ambiguous ("our service is slow") | **Ask the user** which environment, don't guess | |
| 32 | |
| 33 | ## Per-session routing memory |
| 34 | |
| 35 | 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: |
| 36 | |
| 37 | ```markdown |
| 38 | | Space | AWS Profile | Agent Space ID | Purpose | |
| 39 | |-------|-------------|----------------|---------| |
| 40 | | prod | acme-prod | as-abc123 | Production incidents, customer-facing services | |
| 41 | | stage | acme-stage | as-def456 | Pre-prod validation, integration testing | |
| 42 | | kb | acme-shared | as-ghi789 | Shared runbooks, cross-account knowledge | |
| 43 | ``` |
| 44 | |
| 45 | If no guide exists, run discovery: |
| 46 | |
| 47 | 1. `aws_devops_agent__list_agent_spaces()` → get all spaces. |
| 48 | 2. 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. |
| 49 | 3. 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. |
| 50 | |
| 51 | ## Pattern A — Parallel queries, one synthesized answer |
| 52 | |
| 53 | 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". |
| 54 | |
| 55 | ``` |
| 56 | # 1. Query each space in parallel with environment-specific context |
| 57 | aws_devops_agent__chat(message="<question> | env=prod | <prod IaC context>", agent_space_id="PROD_ID") |
| 58 | → {"executionId": "...", "answer": "..."} |
| 59 | |
| 60 | aws_devops_agent__chat(message="<question> | env=stage | <stage IaC context>", agent_space_id="STAGE_ID") |
| 61 | → {"executionId": "...", "answer": "..."} |
| 62 | |
| 63 | # 2. Synthesize locally — present a side-by-side summary, not two separate dumps |
| 64 | ``` |
| 65 | |
| 66 | **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. |
| 67 | |
| 68 | ## Pattern B — Knowledge lookup, then per-space action |
| 69 | |
| 70 | Use when one space holds runbooks/knowledge that informs work in another space. |
| 71 | |
| 72 | ``` |
| 73 | # 1. Ask the knowledge space first |
| 74 | aws_devops_agent__chat( |
| 75 | message="What's our standard runbook for ECS 503 errors?", |
| 76 | agent_space_id="KB_ID" |
| 77 | ) |
| 78 | → {"answer": "<runbook text>"} |
| 79 | |
| 80 | # 2. Apply that runbook in the target environment |
| 81 | aws_devops_agent__investigate( |
| 82 | title="ECS 503 errors on checkout-service. [Runbook from knowledge space] <runbook text> [Local context] ...", |
| 83 | agent_space_id="PROD_ID", |
| 84 | priority="HIGH" |
| 85 | ) |
| 86 | ``` |
| 87 | |
| 88 | The DevOps Agent doesn't share state between spaces — you bridge it by quoting the knowledge space's response into the investigation's `title`. |
| 89 | |
| 90 | ## Pattern C — Targeted single-space query |
| 91 | |
| 92 | Use when the user explicitly names a space or environment. |
| 93 | |
| 94 | ``` |
| 95 | # Pick the matching agentSpaceId from your rout |