SubAgent
class SubAgent(val name: String, val description: String, val backend: (ToolApprover) -> ChatBackend)(source)
One delegate of SubAgents: a named agent with its own instructions, model and tools, reached through backend. Any ChatBackend works — an on-device loop, an AG-UI or AI SDK server, or a remote A2A agent.
Parameters
backend
builds the delegate's backend for one delegation, given the approver of the enclosing chat (its tools ask the same user).