A sub-agent is aDocumentation Index
Fetch the complete documentation index at: https://docs.ixo.world/llms.txt
Use this file to discover all available pages before exploring further.
PluginSubAgent the runtime auto-wraps as a tool (e.g. weather_planner_agent). Use one when a task needs more than one tool call in sequence or its own prompt.
Build the inner tools the sub-agent will call
Sub-agents own a private tool list. Reuse plugin tools or define new ones in the same file.Canonical source: weather-sub-agent.ts.
Define the PluginSubAgent
Give the sub-agent a
name (the tool the main agent sees), a description that reads like a tool description, a systemPrompt, and its tools.systemPrompt and tools can both be functions of PluginContext for late binding. See buildWeatherPlannerSubAgent in weather-sub-agent.ts.Return it from getSubAgents(ctx)
The runtime wraps each sub-agent as a tool named See
<name> and exposes it to the main agent.getSubAgents in weather.plugin.ts.Set forwardTools to surface inner work
By default, the main agent only sees the sub-agent’s final string. Forward inner tool calls into the main chat so the UI renders them.Runtime-injected passthrough tools (e.g. memory CRUD) are never forwarded.
What to know before shipping
- The sub-agent’s
namemust be unique across all loaded plugins — same namespace as regular tools. Prefix with the agent role (e.g.weather_planner_agent). modeldefaults to'subagent'. Use'main'for a top-tier model,'utility'for a cheaper one.- Sub-agent middleware (the
middlewaresfield) only runs inside the sub-agent’s loop, not the main agent’s chain. onComplete(result, ctx)fires after the last turn — use it for follow-up events.- If sub-agent init throws, the runtime logs and skips that contribution for that request; the rest of the agent build continues.
Where to read next
Add a tool
For single-call work that doesn’t need a sub-agent.
Add a middleware
Main-agent vs sub-agent middleware.