A subagent's definition (design 4.44): an agent that takes a typed input I and gives back a typed report O, run on a thread of its own, with a fresh conversation, its own tools and middleware only, and nothing of its parent's (rule 15). A parent offers it with AgentBuilder.withSubagents, which compiles it with bind at the parent's build(); BoundAgent.run runs one with no parent.
Only typed data crosses (rule 17): the parent sends I, rendered as the child's first user message - by default a TaskRequest's description as it is, any other input as its canonical JSON under one line naming the subagent (withInputText replaces that) - and gets back O, decoded from the child's answer. For a TypedAgent.text subagent the answer itself is the report; otherwise the child answers in O's schema (AgentBuilder.withOutput).
A definition holds clients and functions, not data: it is immutable, and every with* returns a new one. Its id ([a-zA-Z0-9_-]{1,52}) and description (not blank) are checked when it is bound.
Compiles the definition onto runtime, calling parentClient unless withModel set a client, and tracing to the parent's tracing (rule 16: a child never has tracing of its own; design 4.47). Refuses an invalid id, a blank description, and whatever AgentBuilder.build() refuses for the child.
Compiles the definition onto runtime, calling parentClient unless withModel set a client, and tracing to the parent's tracing (rule 16: a child never has tracing of its own; design 4.47). Refuses an invalid id, a blank description, and whatever AgentBuilder.build() refuses for the child.
Streams the child's model answers (AgentBuilder.withStreaming), so a parent subscription made with nested = true sees the child's AgentEvents.TextDeltas as they arrive (design 4.47). Off by default.
Streams the child's model answers (AgentBuilder.withStreaming), so a parent subscription made with nested = true sees the child's AgentEvents.TextDeltas as they arrive (design 4.47). Off by default.