Subagent

@Composable
fun Subagent(part: ToolPart, modifier: Modifier = Modifier, onToolApproval: (toolCallId: String, approved: Boolean) -> Unit? = null)(source)

A delegated agent run (the sub-agent pattern): who was asked, what they were asked to do, and their live work — reasoning, tool calls (approvable in place) and answer — nested under the delegating tool call.

Protocol-independent: it renders any ToolPart whose ToolPart.kind is a ToolKind.Delegation or that carries a nested run (ToolPart.subagent) — the backends map their protocol onto those (on-device sub-agents, AG-UI SUBAGENT_*, AI SDK tools whose output is a UIMessage…). While the run is live the header shows what the agent is doing; it opens by itself when a nested tool needs approval.

Parameters

onToolApproval

answers approval requests of the nested tools.