Recipes · Chapter 37 of 63
Create a Custom Agent
Create a Kiro custom agent as a Markdown file in .kiro/agents/, set its tools field, and switch to it mid-session or with kiro-cli --agent.
All levels 3 min read last reviewed 2026-09-04
◎ Learning objective
Create a named agent with its own prompt and tool set, and start a session as that agent.
A custom agent is a named persona with its own system prompt, model, and tool set. You create one as a file in .kiro/agents/, and it appears in the agent selector as soon as you save.
When to use this
Create an agent when a job repeats and needs different permissions from your normal work: a reviewer that reads but never writes, a migration agent that must not touch production, a documentation agent with no shell access. One generalist agent accumulates generalist permissions, which is the thing you are trying to avoid.
Steps
-
Choose the scope. Team agents go in
.kiro/agents/inside the repository. Personal agents go in~/.kiro/agents/. Both folders are shared by the IDE and the CLI. -
Create the Markdown file. The IDE reads YAML front matter and treats the body as the system prompt.
.kiro/agents/docs-writer.md--- description: Writes and edits project documentation only. tools: [read, write] --- You maintain the documentation in docs/. Read the source before you write. Match the existing headings and tone. Never edit code outside docs/, and never run shell commands. -
Set
toolsto the smallest set that works. The categories areread,write,shell,web, and@builtin. Leave out anything the job does not need. -
Add
modelif the job wants a specific model rather than your default,mcpServersif it needs particular external tools, andpermissionsfor finer rules. -
Write the body as instructions to the agent, not as a description of it. Say what to do, what to check, and what never to do.
-
Save the file. The agent appears in the IDE selector immediately, and you can switch to it mid-session.
-
In the CLI, create one with
/agent create docs-writer -D "writes documentation", and add--manualto edit the configuration directly. Switch mid-session with/agent swap, or start a session as the agent withkiro-cli --agent docs-writer.
Check it worked
Start a session as the agent and ask it to do something outside its remit. A docs-writer with tools: [read, write] should refuse to run a shell command rather than ask permission for one. Then give it a task inside its remit and confirm it works without a stream of approval prompts. Fewer prompts and a hard ceiling are the two payoffs.
Common problems
- The agent does not appear. Check the file is in
.kiro/agents/or~/.kiro/agents/and that the YAML front matter parses. Save the file to trigger a reload. - A name clash. A project agent supersedes a global agent with the same name, and Kiro warns you. Rename one.
- The agent still asks for everything.
toolslimits categories; individual actions are still permission-checked. Pair the agent with rules in permissions.yaml. - The prompt reads like a bio. “You are a helpful documentation expert” changes nothing. Concrete rules do.
- Changes need a restart. The CLI hot-reloads agent and MCP settings on save since v2.10.0, so you should keep your history. If a change does not take, check you edited the scope you are running from.
Related
- Custom agents covers the concept and both file formats.
- Build a read-only reviewer agent is the highest-value first agent.
- Kiro CLI Guide lists the agent commands.
Frequently asked questions
How do I create an agent in Kiro?
In the IDE, add a Markdown file to .kiro/agents/ with YAML front matter for description, model, tools, mcpServers, and permissions, and the system prompt as the body. The agent appears in the selector when you save. In the CLI, run /agent create <name> -D "description", and add --manual to edit the configuration in your editor.
How do I create an agent in Kiro CLI?
Run /agent create my-agent -D "description" inside a session. Add --manual to open the configuration in your editor. Switch personas mid-session with /agent swap, or start a session as one with kiro-cli --agent my-agent.
What can I put in the tools field?
Kiro's tools documentation names the categories read, write, shell, web, and @builtin. Listing only the categories an agent needs is the simplest way to give it a hard ceiling on what it can do.
☰ Chapter summary
- IDE custom agents are Markdown files in .kiro/agents/ (project) or ~/.kiro/agents/ (global).
- YAML front matter carries description, model, tools, mcpServers, and permissions; the body is the system prompt.
- The tools field takes the categories read, write, shell, web, and @builtin.
- A project agent supersedes a global agent with the same name, and Kiro warns about the clash.
- In the CLI use /agent create to make one, /agent swap to switch, and kiro-cli --agent <name> to start as one.
All chapter summaries are collected on the revision page.
Related chapters
- ConceptsCustom AgentsCustom agents are scoped versions of Kiro with their own prompt, tools, and model. File formats, the tools field, scopes, and how to create one.
- RecipesBuild a Read-Only Reviewer AgentCreate a Kiro agent that can read your codebase but cannot write or run commands, then back the ceiling with deny rules in permissions.yaml.
- RecipesSet Up permissions.yamlControl what Kiro's agent may do with permissions.yaml: the capability list, the deny over ask over allow order, match and exclude globs, and the six scopes.
- Hands-onKiro CLI GuideInstall kiro-cli, drive sessions with slash commands, manage agents and context, and take the agent into scripts and CI.
- Hands-onAdvanced TutorialA production-shaped workflow that combines specs, steering, hooks, MCP, custom agents, and skills, written for engineers who already know the basics.