Subagents
The Agent tool delegates large or context-heavy subtasks to subagents that run in isolated sessions: each child sees only the prompt you pass it (never the parent conversation) and returns only its final text. Isolation keeps the parent's context clean — you get the answer without paying for the exploration that produced it.
Declaring a subagent
A subagent is an agents/*.md file with YAML frontmatter; the body becomes the subagent's system prompt:
Loading order (later directories override earlier ones by name):
- Global:
~/.lite-agent/agents - Project:
<workdir>/.lite-agent/agents agentsDirconfig option, if set
A built-in general-purpose agent (inherits the parent's full tool set and model) is always seeded, so subagents work with zero files. Set agents: false to disable the whole capability.
Dispatch
One Agent call takes a batch of tasks; entries in a single call run in parallel (bounded concurrency), and each result block is labeled with an agentId that can be passed back as resume to continue that subagent later:
By default the call blocks until all children finish; run_in_background: true makes it fire-and-forget, with the aggregated results delivered later as a <background-task-completed> notification.
Subagents run without the parent's permission gate and onApproval handler by default — an interactive approval handler cannot service parallel children. The sandbox still wraps every command. Pass subagentPermission (allow/deny rules, not ask) to gate subagent runs.
Programmatic access
Use AgentLoader / builtinAgents directly if you need the same loading mechanism outside createLiteAgent.
See also
- Built-in tools — the
Agenttool and how to disable it (agents: false). - Skills — the other markdown-driven, on-demand capability.
- Permissions — write the allow/deny rules
subagentPermissionexpects. - Custom tools — add tools your subagents can inherit.