# Subagents

Focused helpers the AI hands work to inside an agent team. Use the built-in subagents or write your own with their own instructions, tool access and step budget.

A subagent takes one focused job, such as research or review, works on it with its own instructions, then reports back to the main AI. The main AI decides when to hand off a task, based on each subagent's description.

Settings open on Customize, Subagents chip, with the built-in subagents and the New Subagent button.

> [!NOTE]
>
> **Subagents run inside agent teams**
>
> Subagents run only inside [agent teams](/features/ai/agent-teams). When teams are on for the project, the AI can give a team member one of these roles, and it runs on the chat's model. When teams are off, your subagents stay saved but do not run, until you turn teams on or pick the **Ultracode** effort for a session.

## What you can do

- Rely on the built-in subagents that ship with Lyna.
- Create your own subagents for jobs you repeat.
- Limit a subagent to reading only, or give it full access.
- Set how many steps it can take before it reports back.
- Give a subagent a task yourself: type `@` in the message box and pick it in **Agents**. See [Agent teams](/features/ai/agent-teams).

## Built-in subagents

| Subagent  | What it does                                                                |
| --------- | --------------------------------------------------------------------------- |
| `explore` | Researches the codebase, finds files and gathers context.                   |
| `general` | Handles any task: reads and edits files, and runs commands.                 |
| `verify`  | Checks that code is correct by reading it and running type checks and lint. |
| `plan`    | Explores the codebase and drafts a detailed implementation plan.            |

## Create a subagent

1. ### Open Subagents

   Open **Settings > AI > Customize**, pick the **Subagents** chip and choose **New Subagent**.
2. ### Fill in the form

   | Field             | What to enter                                                                                                  |
   | ----------------- | -------------------------------------------------------------------------------------------------------------- |
   | **Name**          | Lowercase letters, numbers and hyphens, for example `code-reviewer`.                                           |
   | **Description**   | When the assistant should use this agent. Write it as a clear trigger.                                         |
   | **Tool access**   | **Read only** (reads and searches, changes nothing) or **Full access** (reads and edits files, runs commands). |
   | **Max steps**     | The most tool calls it makes before it reports back.                                                           |
   | **System prompt** | The agent's instructions.                                                                                      |
3. ### Save

   The subagent is saved as `.lyna_ai/agents/<name>.md` in your project. The AI can use it from the next message.

## The file format

```markdown
---
name: reviewer
description: Reviews a change for correctness, routing conventions and test coverage. Use before merging.
toolAccess: read-only
maxSteps: 12
---

You are a code reviewer for a React, TypeScript and Tailwind CSS project.
Report findings as a short list with file and line references. Do not modify files.
```

If you leave out `toolAccess`, the agent is read only. If you leave out `maxSteps`, it gets 15 steps.

> [!NOTE]
>
> **Give reviewers read-only access**
>
> Researchers and reviewers do not need to change code. Read-only access keeps them from editing files by mistake.

Subagents added by plugins show with a **Plugin** label and are read only. Built-in subagents cannot be edited.

## Related

- [Agent teams](/features/ai/agent-teams): Several agents in parallel.
- [Skills](/features/ai/skills): Reusable instructions.
- [Agent Review](/features/code/agent-review): A built-in reviewer that finds issues in your changes.
- [Hooks](/features/ai/hooks): React to Sub-agent Start and Stop.
