# AgentDefinition

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

**Field:** Artificial Intelligence  
**Category:** Claude Agent SDK  
**Also known as:** agents option, Agent SDK subagents, Claude Agent SDK AgentDefinition

## Think of it like

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

## 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

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.

## 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.

## Why it matters

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

## Common mistake

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

## Three principles

- **description and prompt.** Required.
- **Own tools and model.** Optional.
- **Started by the Agent tool.** Keep it in the session.

## Related terms

- [Subagent](https://learn.benibix.com/term/ai/subagent)
- [--agents Flag](https://learn.benibix.com/term/ai/agents-flag)
- [Agent Tool](https://learn.benibix.com/term/ai/agent-tool)

---

Source: https://learn.benibix.com/term/ai/agent-definition
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-20
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
