Now inviting automation leaders: publish your playbook as a skill, under your own name. Publish yours →
Automation Skills
All skills/n8n agents official/SUB_AGENTS
Reference · n8n agents official

SUB_AGENTS

Part of n8n agents official. Install the skill and your agent reads this page when it needs the depth.

Sub-agents and model routing

Every top-level Agent has the built-in delegate_subagent tool. A call looks like this (from a live run):

{ "subAgentId": "<agent id>", "taskName": "Reply with agent name and OK",
  "goal": "...", "context": "", "expectedOutput": "...", "difficulty": "low" }

The child starts clean: it sees goal, context, and expectedOutput, not the parent's conversation. Tell the parent (in useWhen or instructions) to pass everything the child needs in context.

Saved vs inline

Saved sub-agent Inline (no subAgentId)
What runs Another Agent in the same project, with its own instructions, tools, and model A copy of the parent
Configure subAgents.agents[]: { "agentId", "useWhen" } Nothing; always available
Model The child's own subAgents.modelsByDifficulty by the difficulty the parent picks, else the parent's model
Use for A specialist with tools or a model the parent shouldn't carry Parallel or long subtasks that need a clean context

useWhen (max 512 chars) is how the parent decides to delegate, like a tool description. Make it specific: "Delegate any question about invoices, refunds, or billing history" beats "billing stuff".

Rules

Model routing

<!-- TEMPORARY: model routing is manual and only covers inline delegation. Revisit if n8n adds automatic routing or routing for saved sub-agents. -->

There's no automatic routing. modelsByDifficulty maps low, medium, and high to { model, credential } for inline delegations only, and the parent picks the difficulty per call. Missing levels fall back to the parent's model. A typical setup: a strong parent model, with low mapped to a cheap fast model for lookups and formatting.

"subAgents": {
  "modelsByDifficulty": {
    "low": { "model": "openai/gpt-4.1-mini", "credential": "<id>" },
    "high": { "model": "<provider/strong-model>", "credential": "<id>" }
  }
}

List models and prices with discover_agent_assets kind=models provider=<provider> credentialId=<id>.

Publish your skill

Copy this prompt into Claude Code, Codex or any agent. It walks you through your first skill in about 20 minutes, with you as the author.

Click to copy.