- A single agent that handles design, networking, and security accumulates a huge context and needs broad permissions. That increases the blast radius for misconfigurations and makes debugging hard.
- When network topology, firewall rules, and security audits all live in one conversation, unrelated details crowd each other, and authority is not separated.
- A subagent is a focused Claude agent spawned by a parent (orchestrator) to perform one task.
- Each subagent has:
- its own conversation context (so domain chatter doesn’t interfere),
- a narrow toolset (principle of least privilege),
- a system prompt that defines its role and constraints.
Registering subagents
- Register subagents by passing a list of agent definition objects to the SDK client.
- If you start a definition with “Use proactively”, Claude will select that specialist automatically when a request matches the description.
- Network agent: creates the VPC, subnets, route tables, and attaches gateways.
- Security agent: creates security groups, NACLs, policy checks and performs audits.
- Orchestrator (parent): decomposes requests, delegates to subagents via the Task tool, and aggregates results.

- Limit each subagent to only the tools necessary for its job.
- Example tool sets:
- Network agent:
["Bash", "Read"](run AWS CLI commands and inspect state). - Security agent:
["Bash", "Read"](create and audit security rules). - Orchestrator (parent):
["Bash", "Read", "Write"](coordinate and perform higher-privilege tasks).
- Network agent:
- Narrow tool access reduces the blast radius and enforces separation of duties at runtime. Combine this with a precise system prompt for defense in depth: neither the network agent nor the security agent should be able to perform the other’s responsibilities, either by prompt or by tools.
Restrict tools to the minimum required for each agent. Combined with a precise system prompt, this reduces risk by enforcing separation of duties.
Order matters: create networking resources (VPC, subnets, route tables) before attaching security controls that depend on resource IDs. Also ensure credentials and IAM roles used by agents follow least privilege rules.
- The network agent runs first to create the underlying resources:
- VPC: 10.0.0.0/16
- Public subnets with a route to an Internet Gateway (for the web tier)
- Private subnets with no direct internet route (for app and DB tiers)
- The security agent runs next to apply policies:
- Create security groups for web, app, and database tiers (default deny, explicit allow).
- Create subnet-edge NACLs to harden ingress/egress at the subnet level.
- Apply rules: web tier allows 80/443 from the internet; app accepts traffic only from the web security group; db accepts traffic only from the app security group.

- Use a stateful client so conversation context (and resource IDs) persist across turns.
- A typical run has four turns:
- Orchestrator plans a complete VPC for a three-tier web app and determines necessary resources and dependency order.
- Orchestrator delegates to the network configurator using the Task tool.
- The network agent runs
Bashcommands (e.g.,aws ec2 create-vpc) and returns real resource IDs.
- Orchestrator passes the created resource IDs to the security specialist.
- The security agent creates security groups and NACLs with the correct allow/deny rules for each tier.
- Orchestrator verifies the final state, checks least privilege across tiers, and returns a consolidated report.
- Register each subagent as a definition object and supply the
toolsfield to enforce least privilege.
- Add extra specialists (e.g., audit-specialist, iam-manager, terraform-applier) to plug in external tools or cross-check configurations.
- Use the Task tool for delegation so the orchestrator never calls subagents directly — Claude chooses the right specialist automatically based on description.
Links and references
- AWS VPC documentation
- Principle of Least Privilege (Microsoft)
- Claude/Anthropic general docs: https://www.anthropic.com/