Skip to content
BENIBIX Learn

AgentDefinition

Also known as agents option, Agent SDK subagents, Claude Agent SDK AgentDefinition

The type for a subagent you set up in code. It has a description, its own prompt and its tools.

Think of it like

It is like a job card for a helper you send on a side task.

Example

Mia's agent writes code, then hands it to a reviewer subagent with read-only tools. The reviewer's notes come back as a tool result.

Why it matters

A subagent works in its own context, so a side task does not fill the main one.

Definition

AgentDefinition is the Agent SDK type for a subagent you set up in code, passed in the agents option. Two fields are required. The description tells Claude when to use it, and the prompt is its system prompt. You can also set its tools, model, skills and MCP servers. Claude starts one through the Agent tool, so that tool has to stay in the session.

Example code

typescript
agents: {
  reviewer: {
    description: "Reviews code for bugs",
    prompt: "You are a careful code reviewer.",
    tools: ["Read", "Grep"],
  },
}
A read-only reviewer subagent.

Common mistake

Writing a vague description. Claude reads it to pick a helper, so a vague one is rarely picked.

Key takeaways

  1. 1
    description and prompt. Required.
  2. 2
    Own tools and model. Optional.
  3. 3
    Started by the Agent tool. Keep it in the session.