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.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
Compiles the definition onto runtime, with no parent: for BoundAgent.run on a top-level thread. It calls client with options unless withModel set both, and traces to tracing (rule 16: a child never has tracing of its own; design 4.47). With no parent there is nothing to inherit: a tool or middleware grant naming anything is refused, and the child's own subagents are offered only when delegation is granted, under the default DelegationConfig. Refuses an invalid id, a blank description, a budget value that is not positive, and whatever AgentBuilder.build() refuses for the child.
Compiles the definition onto runtime, with no parent: for BoundAgent.run on a top-level thread. It calls client with options unless withModel set both, and traces to tracing (rule 16: a child never has tracing of its own; design 4.47). With no parent there is nothing to inherit: a tool or middleware grant naming anything is refused, and the child's own subagents are offered only when delegation is granted, under the default DelegationConfig. Refuses an invalid id, a blank description, a budget value that is not positive, and whatever AgentBuilder.build() refuses for the child.
Attributes
The subagent's id: its agent id, and the subagent_type or the task_<id> tool name the parent model uses.
The subagent's id: its agent id, and the subagent_type or the task_<id> tool name the parent model uses.
Attributes
What the parent does when the child fails; ChildFailure.Report by default.
What the parent does when the child fails; ChildFailure.Report by default.
Attributes
The child's own harness (AgentBuilder.withHarness), over the child's own thread.
The child's own harness (AgentBuilder.withHarness), over the child's own thread.
Attributes
What the child takes from the agent it is bound to (design 4.45), replacing Inheritance.none: the parent's tools and middleware it is granted, its budget, and whether it may delegate. See Inheritance.
What the child takes from the agent it is bound to (design 4.45), replacing Inheritance.none: the parent's tools and middleware it is granted, its budget, and whether it may delegate. See Inheritance.
Attributes
Renders the input as the child's first user message, replacing the default (see the class description).
Renders the input as the child's first user message, replacing the default (see the class description).
Attributes
Model calls per child turn (AgentBuilder.withMaxSteps); at the limit the task is refused StepLimitReached.
Model calls per child turn (AgentBuilder.withMaxSteps); at the limit the task is refused StepLimitReached.
Attributes
Appends middleware to the child's own stack, in order.
Appends middleware to the child's own stack, in order.
Attributes
The client and options the child calls; by default the client and options of the agent it is bound to (a model is not a capability, so it is inherited unless set). DelegationPlan shows which applies.
The client and options the child calls; by default the client and options of the agent it is bound to (a model is not a capability, so it is inherited unless set). DelegationPlan shows which applies.
Attributes
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.
Attributes
Appends agents to the child's own subagents, in order. The child is offered them only when its inheritance grants delegation (Inheritance.delegate) and its depth is below its parent's DelegationConfig.maxDepth; otherwise it has no task tools (rule 15).
Appends agents to the child's own subagents, in order. The child is offered them only when its inheritance grants delegation (Inheritance.delegate) and its depth is below its parent's DelegationConfig.maxDepth; otherwise it has no task tools (rule 15).
Attributes
The child's system prompt; refused beside withHarness, as AgentBuilder.withSystemPrompt is.
The child's system prompt; refused beside withHarness, as AgentBuilder.withSystemPrompt is.
Attributes
The child's own tools, replacing any set before. It has no other tool of its parent's (rule 15).
The child's own tools, replacing any set before. It has no other tool of its parent's (rule 15).