Subagents
Subagents are specialized AI assistants in Codely CLI designed to handle specific types of tasks. They allow you to delegate work to AI agents configured with task-specific prompts, tools, and behaviors.
What are Subagents?
Subagents are independent AI assistants with the following characteristics:
- Specialized Tasks - Each subagent is configured with a focused system prompt for a specific type of work
- Independent Context - They maintain their own conversation history, separate from the main conversation
- Controlled Tool Access - You can configure which tools each subagent can access
- Autonomous Work - Once given a task, they work independently until completion or failure
- Detailed Feedback - You can view their progress, tool usage, and execution statistics in real-time
The subagent system significantly improves efficiency and output quality by breaking down complex tasks and handling them with specialized agents.
Key Advantages
- Task Specialization - Create agents optimized for specific workflows (testing, documentation, refactoring, etc.)
- Context Isolation - Separate specialized work from the main conversation
- Reusability - Save and reuse agent configurations across projects and sessions
- Controlled Access - Limit tools each agent can use for improved security and focus
- Progress Visibility - Monitor agent execution with real-time progress updates
How Subagents Work
- Configuration - Create subagent configurations defining behavior, tools, and system prompts
- Delegation - The main AI can automatically delegate tasks to appropriate subagents
- Execution - Subagents work independently, using their configured tools to complete tasks
- Results - Return results and execution summaries to the main conversation
Quick Start
Viewing Available Agents
List all available subagents:
/agents list
Viewing Agent Details
View detailed information about a specific agent:
/agents info <agent_name>
Reloading Configuration
After modifying agent configuration, reload to apply changes:
/agents reload
Using Subagents
The simplest way is to directly tell the main AI what you need, and it will automatically select the appropriate subagent:
Write comprehensive tests for the authentication module
The main AI will automatically recognize this is a testing task and delegate it to the testing expert subagent.
You can also explicitly specify which subagent to use:
Let the testing-expert subagent create unit tests for the payment module
Creating Custom Subagents
Storage Location
Subagent configuration files are stored in the following locations:
- Project Level:
.codely-cli/agents/(higher priority) - User Level:
~/.codely-cli/agents/(fallback)
This allows you to have project-specific agents and personal agents that work for all projects.