서브에이전트

작업별 워크플로우를 위한 독립 컨텍스트를 가진 특화된 AI 어시스턴트

서브에이전트란?

서브에이전트는 자체 컨텍스트 윈도우, 도구 접근 권한, 특화된 지시를 가진 독립적인 Claude 인스턴스입니다. 코드를 탐색하고, 계획을 실행하고, 백그라운드에서 실행하고, 메인 세션의 컨텍스트를 소비하지 않고 요약된 결과를 반환할 수 있습니다.

Specific Purpose

Each subagent has a defined expertise area

Own Context Window

Separate from main conversation

Configurable Tools

Specific tool access per subagent

Custom System Prompt

Tailored instructions for each agent

NEW in 2.1

New Subagent Features

Async Subagents

Run subagents asynchronously with Ctrl+B backgrounding

🔀

Context Fork

Use context: fork in skill frontmatter for isolated execution

🎯

Agent Hooks

Define PreToolUse, PostToolUse, and Stop hooks in agent frontmatter

🔄

Disable Agents

Use Task(AgentName) syntax in disallowedTools to disable specific agents

내장 서브에이전트

Explore

Fast, read-only agent for searching and analyzing codebases

Model: Haiku (fast)

Tools: Read-only

Plan

Research agent used in plan mode to gather context

Model: Inherits

Tools: Read-only

general-purpose

Capable agent for complex, multi-step tasks

Model: Inherits

Tools: All tools

에이전트 Frontmatter 필드

FieldDescriptionExample
modelOverride model selectionopus, sonnet, haiku, inherit
skillsEnable specific skills["code-review", "testing"]
hooksDefine agent-specific hooks["pre-review"]
permissionModePermission handling modeinherit, default, bypassPermissions
apiKeyEnvVarCustom API key env variableCUSTOM_API_KEY
enableUndoEnable undo capabilitytrue, false
toolsRestrict available tools["Read", "Edit", "Bash"]
agent.md frontmatter example
---
model: opus
skills:
  - code-review
hooks:
  - security-check
permissionMode: inherit
tools:
  - Read
  - Edit
  - Grep
---

Quick Start

1. Open Subagents Interface

/agents

2. Create New Agent

Choose "Create New Agent" and select project-level or user-level

3. Define the Agent

  • Describe the agent's purpose
  • Select tools to grant access
  • Customize the system prompt

4. Use Your Agent

> code-reviewer 서브에이전트로 내 코드를 검토해줘

서브에이전트 예시

코드 리뷰어

Reviews code for quality, security, and best practices

Tools: Read, Grep, Glob, Bash

디버거

Analyzes errors and implements fixes

Tools: Read, Edit, Bash, Grep

Test Automation

Creates and runs tests automatically

Tools: Read, Write, Bash

Best Practices

1

Design Focused Agents

Create subagents with single, clear responsibilities

2

Write Detailed Prompts

Include specific instructions and examples

3

Limit Tool Access

Only grant necessary tools for better security

4

Version Control

Check project subagents into version control

Ready to Create Your First Subagent?

Start automating specialized tasks with custom AI assistants tailored to your workflow