0Pricing
Claude Architect · 강의

에이전트 정의하기

name, description, system_prompt 및 allowed_tools를 정의합니다

에이전트 정의하기은(는) CoddyKit의 무료 Claude Architect 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Claude Architect 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Claude Architect 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

What an Agent Definition Is

An agent in the Claude Agent SDK is not magic. It is a small, explicit configuration that tells the model who it is and what it is allowed to do.

An AgentDefinition has four core fields:

  • name — a short identifier used to route work to this agent
  • description — what this agent is for (this is how a coordinator decides to delegate to it)
  • system_prompt — the durable instructions that shape behavior
  • allowed_tools — the exact set of tools this agent may call

Get these four right and the agent behaves predictably. Get them wrong and you get misrouting, scope creep, and unreliable tool selection.

The Shape of a Definition

Here is the minimal skeleton of an agent definition. Notice that every field carries weight: nothing here is decorative.

The allowed_tools list follows the principle of least privilege — grant only the tools the role actually needs.

agent = AgentDefinition(
    name="refund_specialist",
    description=(
        "Handles customer refund requests after identity "
        "verification. Use for billing disputes and order "
        "cancellations."
    ),
    system_prompt=(
        "You are a careful refund specialist. Always verify "
        "the customer's identity before processing anything."
    ),
    allowed_tools=["get_customer", "lookup_order", "process_refund"],
)

name — The Routing Key

The name is a stable identifier. In a multi-agent, hub-and-spoke system the coordinator routes work to subagents, and the name is how a specific agent is addressed.

Keep names short, lowercase, and role-based: research_agent, code_reviewer, refund_specialist.

But remember a key exam fact: names are NOT the primary selection mechanism. When the model decides whether to use a tool or agent, it leans on the description, not the name. So a clear name helps humans, but the description does the real routing work.

description — How Delegation Happens

The description is the field a coordinator reads to decide when to hand work to this agent. It is the single most important field for correct routing.

A strong description states:

  • Purpose — what the agent does
  • Applicability boundaries — when to use it and when NOT to

Vague or overlapping descriptions across agents cause misrouting: the coordinator picks the wrong specialist. Make each agent's description distinct so there is no ambiguity about who owns which job.

research_agent = AgentDefinition(
    name="research_agent",
    description=(
        "Searches the web and summarizes findings WITH citations "
        "for open-ended factual questions. Do NOT use for code "
        "changes or refunds."
    ),
    system_prompt="You are a meticulous research assistant...",
    allowed_tools=["WebSearch", "WebFetch"],
)

system_prompt — Durable Behavior

The system_prompt sets the agent's persistent identity and rules. It persists across every turn of the agentic loop, so put your stable behavioral guarantees here.

Write explicit criteria, not vague encouragement. Compare:

  • Vague: "Be careful with refunds."
  • Explicit: "Never call process_refund until get_customer has returned a verified customer ID."

Explicit instructions consistently outperform vague ones. The model can act on a concrete rule; it cannot reliably act on "be more careful".

system_prompt = (
    "You are a refund specialist.\n"
    "- Always call get_customer FIRST and confirm a verified ID.\n"
    "- Only refund the exact order the customer names.\n"
    "- If multiple customers match, ask for more identifiers; "
    "never guess."
)

Prompts Are Probabilistic

Here is a subtle but exam-critical point. The system_prompt guides behavior — but guidance is roughly 90% reliable, not 100%.

If a rule has financial, legal, or safety consequences, do NOT rely on the prompt alone. Enforce it deterministically with a hook.

  • Prompt: "Don't refund more than $500" — works most of the time (~90%).
  • Hook: a PostToolUse / outgoing-call hook that blocks any refund over $500 — works 100% of the time.

So: put behavior in the system_prompt, but put hard guarantees in hooks. Defining an agent well means knowing which rules belong where.

allowed_tools — Least Privilege

The allowed_tools field scopes exactly which tools the agent can reach. This is your primary safety boundary: an agent simply cannot call a tool that is not on its list.

Scope tools to the role. A refund agent does not need WebSearch; a research agent does not need process_refund. Granting extra tools is not convenience — it is risk and it degrades selection accuracy.

# Least privilege: each agent sees only its own tools
support_agent.allowed_tools = [
    "get_customer", "lookup_order",
    "process_refund", "escalate_to_human",
]
# NOT: every tool in the system

How Many Tools Is Right?

More tools is not better. Tool selection reliability has a sweet spot:

  • 4–5 tools per agent is optimal.
  • 18+ tools measurably degrades selection — the model misroutes among too many similar options.

If an agent's allowed_tools list is getting long, that is a design smell. Split the work across focused subagents, each with a tight tool set and a distinct description. Narrow scope is what makes each agent reliable.

Tool Descriptions Drive Selection

Defining the agent's tools is half the job; defining each tool's description is the other half. Tool descriptions — not tool names — are how the model decides which tool to call.

A good tool description includes:

  • purpose
  • return values
  • input formats with examples
  • edge cases and applicability boundaries

Overlapping or ambiguous tool descriptions cause the same misrouting problem as ambiguous agent descriptions, one layer down.

{
  "name": "lookup_order",
  "description": "Fetch an order by its ID. Input: order_id like 'ORD-10293'. Returns status, items, and total. Use AFTER get_customer verifies identity. Returns an empty result (not an error) if no order matches.",
  "input_schema": {
    "type": "object",
    "properties": {"order_id": {"type": "string"}},
    "required": ["order_id"]
  }
}

A Coordinator Needs the Task Tool

When you define a coordinator in a hub-and-spoke system, it delegates to subagents. For that to work, the coordinator's allowed_tools must include "Task" — that is the tool it uses to spawn subagents.

One more critical fact: subagents do NOT inherit the coordinator's conversation history. Every subagent starts fresh, so all needed context must be passed explicitly in the subagent's prompt. The definition controls capability; the prompt at delegation time controls context.

coordinator = AgentDefinition(
    name="coordinator",
    description="Decomposes the request and delegates to specialists.",
    system_prompt="Break the task into subtasks. Pass ALL needed context to each subagent explicitly.",
    allowed_tools=["Task"],  # required to delegate
)

Putting It Together

A well-defined agent reads almost like a job posting:

  • name: a stable handle for routing
  • description: a precise statement of purpose and boundaries, so a coordinator delegates correctly
  • system_prompt: explicit, durable behavioral rules (probabilistic — pair with hooks for hard guarantees)
  • allowed_tools: a tight, least-privilege set, ideally 4–5 tools, each with a rich description

When all four are tight and non-overlapping, the agent does one job well. That is the foundation every multi-agent architecture is built on.

Quick Check

A scenario-based decision about defining an agent.

Recap: Defining an Agent

Key takeaways:

  • An AgentDefinition = name, description, system_prompt, allowed_tools.
  • description (not name) drives delegation and tool/agent selection — keep it precise and non-overlapping.
  • system_prompt sets durable, explicit behavior, but is only ~90% reliable; enforce financial/legal/safety rules with hooks (100% deterministic).
  • allowed_tools = least privilege; aim for 4–5 tools, since 18+ degrade selection. Each tool needs a rich description.
  • A coordinator must include "Task" in allowed_tools, and subagents inherit NO history — pass context explicitly.

Define narrow, define clearly, and every agent you build becomes predictable.

자주 묻는 질문

“에이전트 정의하기” 강의는 무료인가요?

네 — “에이전트 정의하기” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Claude Architect 강의 전체를 잠금 해제할 수 있습니다. Claude Architect 강의에는 총 4개의 강의가 포함되어 있습니다.

“에이전트 정의하기”에서 뭘 배우나요?

name, description, system_prompt 및 allowed_tools를 정의합니다 브라우저에서 직접 실행하는 실습 코드로 Claude Architect을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Claude Architect을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Claude Architect은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.

“에이전트 정의하기” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Claude Architect 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Claude Architect 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 에이전트 SDK 구성 요소
  2. 에이전트 정의하기
  3. Task 도구와 allowedTools
  4. 최소 권한 원칙
← Claude Architect(으)로 돌아가기