Skip to main content

Module subagent

Module subagent 

Source
Expand description

Delegated Agent System

Provides a system for delegating specialized tasks to focused child agents. Each delegated child run uses an isolated child session with restricted permissions.

§Architecture

Parent Session
  └── Task Tool
        ├── AgentRegistry (lookup agent definitions)
        └── Child Session (isolated execution)
              ├── Restricted permissions
              ├── Optional model override
              └── Event forwarding to parent

§Built-in Agents

  • explore: Fast codebase exploration (read-only)
  • general: Multi-step task execution
  • plan: Read-only planning mode
  • verification: Adversarial verification specialist
  • review: Code review specialist

§Loading Agents from Files

Agents can be loaded from YAML or Markdown files:

§YAML Format

name: my-agent
description: Custom agent for specific tasks
hidden: false
max_steps: 30
permissions:
  allow:
    - read
    - grep
  deny:
    - write
prompt: |
  You are a specialized agent...

§Markdown Format

---
name: my-agent
description: Custom agent
max_steps: 30
---
# System Prompt
You are a specialized agent...

Structs§

AgentDefinition
Agent definition
AgentRegistry
Agent registry for managing agent definitions
ModelConfig
Model configuration for agent.
WorkerAgentSpec
Reproducible recipe for a disposable worker/subagent.

Enums§

ConfirmationInheritance
How a child run resolves tools that require confirmation (PermissionDecision::Ask).
WorkerAgentKind
Cattle-style worker agent role.

Functions§

builtin_agents
Create built-in agent definitions
load_agents_from_dir
Load all agent definitions from a directory
parse_agent_md
Parse an agent definition from Markdown with YAML frontmatter
parse_agent_yaml
Parse an agent definition from YAML content.

Type Aliases§

CattleAgentKind
Backward-friendly alias for callers that name this pattern cattle mode.
CattleAgentSpec
Backward-friendly alias for callers that name this pattern cattle mode.