Class SubagentDeclaration.Builder
java.lang.Object
io.agentscope.harness.agent.subagent.SubagentDeclaration.Builder
- Enclosing class:
- SubagentDeclaration
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds theSubagentDeclaration.description(String description) Sets the human-readable description the orchestrator uses to decide when to delegate (required).enablePendingToolRecovery(Boolean enable) Overrides pending-tool recovery for this local subagent.exposeToUser(Boolean exposeToUser) Per-type policy for exposing spawned instances as user-addressable threads.Optional HTTP headers for the remote task server (e.g.hidden(boolean hidden) Hide this declaration from the LLM's available-subagent list.inheritParentPermissions(boolean inheritParentPermissions) Whentrue(default), parent DENY permission rules are propagated to the child at spawn time.inlineAgentsBody(String body) Sets the inline system-prompt body for lightweight subagents that do not need a dedicated definition workspace.maxIters(int maxIters) Deprecated.mode(SubagentDeclaration.Mode mode) Sets theSubagentDeclaration.Mode.Optional model override resolved viaModelRegistry.Sets the unique name / agent-id for this subagent (required).persistSession(boolean persistSession) Whentrue, the subagent's spawn key is derived deterministically from (parentSessionId, agentId, label), enabling state recovery across parent calls and process restarts.remoteAskPolicy(RemoteAskPolicy remoteAskPolicy) Policy for resolving remote HITL confirmations.remoteContextAttributes(Map<String, Object> remoteContextAttributes) Static attributes sent ascontext.attributeswith every submission to this remote subagent (e.g. tenant or deployment tags).remoteStreamDetail(RemoteStreamDetail remoteStreamDetail) How much of the remote event stream to forward.remoteStreaming(Boolean remoteStreaming) Whether remote subagent events should be streamed back into the parent's event stream.steps(int steps) Maximum reasoning iterations (default 10).temperature(Double temperature) Optional sampling temperature override.Tool allowlist: when non-empty, only inherited parent tools with listed names are kept.Optional nucleus-sampling (top-p) override.Remote task server base URL.Optional model-variant identifier (e.g.Points this declaration at an external definition workspace.workspaceMode(WorkspaceMode mode) Sets the workspace resolution mode.
-
Method Details
-
name
Sets the unique name / agent-id for this subagent (required). -
description
Sets the human-readable description the orchestrator uses to decide when to delegate (required). -
workspaceMode
Sets the workspace resolution mode. Defaults toWorkspaceMode.ISOLATED.- Parameters:
mode- workspace mode;nullis treated asWorkspaceMode.ISOLATED
-
workspace
Points this declaration at an external definition workspace.Mutually exclusive with
inlineAgentsBody(String): passing both a non-null path and a non-blank inline body will causebuild()to throw.- Parameters:
workspacePath- absolute path, or path relative tomainWorkspacewhen set via a Markdown front matter file
-
inlineAgentsBody
Sets the inline system-prompt body for lightweight subagents that do not need a dedicated definition workspace.Mutually exclusive with
workspace(Path).- Parameters:
body- the system-prompt body text (Markdown); may benullor blank
-
model
Optional model override resolved viaModelRegistry. Falls back to the parent model when blank or unresolvable. -
maxIters
Deprecated.since Phase A — usesteps(int). Equivalent in behaviour.Maximum reasoning iterations (default 10). -
steps
Maximum reasoning iterations (default 10). -
temperature
Optional sampling temperature override.null(default) means inherit the parent agent's value. Typical range0.0 – 2.0. -
topP
Optional nucleus-sampling (top-p) override.null(default) means inherit the parent. Typical range0.0 – 1.0. -
variant
Optional model-variant identifier (e.g."thinking"for DashScope thinking-mode variants). Blank /nullmeans no variant transform; parent variant — if any — is inherited via builder copy. -
mode
-
persistSession
Whentrue, the subagent's spawn key is derived deterministically from (parentSessionId, agentId, label), enabling state recovery across parent calls and process restarts. Defaults tofalse. -
inheritParentPermissions
Whentrue(default), parent DENY permission rules are propagated to the child at spawn time. Set tofalseonly when the child requires permissions that the parent explicitly denies (rare). -
exposeToUser
Per-type policy for exposing spawned instances as user-addressable threads.TRUEforces exposure,FALSEforbids it (overriding an LLM request), andnull(default) defers to theRuntimeContextoverride and then the LLM'sexpose_to_userargument. -
enablePendingToolRecovery
Overrides pending-tool recovery for this local subagent. Passnullto inherit the parent setting (the default). Permission confirmations are never auto-recovered.- Parameters:
enable- whether to enable recovery, ornullto inherit- Returns:
- this builder
-
tools
Tool allowlist: when non-empty, only inherited parent tools with listed names are kept. Child-local tool registrations are unaffected. -
skills
-
url
Remote task server base URL. Mutually exclusive withworkspace(Path)and a non-blankinlineAgentsBody(String). -
headers
Optional HTTP headers for the remote task server (e.g.Authorization). Only used whenurl(String)is set. -
remoteStreaming
Whether remote subagent events should be streamed back into the parent's event stream.null(default) is treated astrue. Only relevant whenurl(String)is set. -
remoteStreamDetail
How much of the remote event stream to forward.null(default) is treated asRemoteStreamDetail.FULL;RemoteStreamDetail.VERBOSEforwards every event the remote agent emits, matching a local subagent. Only relevant whenremoteStreaming(Boolean)is enabled. -
remoteAskPolicy
Policy for resolving remote HITL confirmations.nullis treated asRemoteAskPolicy.DENY. Only relevant whenurl(String)is set. -
remoteContextAttributes
public SubagentDeclaration.Builder remoteContextAttributes(Map<String, Object> remoteContextAttributes) Static attributes sent ascontext.attributeswith every submission to this remote subagent (e.g. tenant or deployment tags). Values must be JSON-serializable. Per call attributes set on the parent'sRuntimeContextare merged on top. Only relevant whenurl(String)is set. -
build
Builds theSubagentDeclaration.- Throws:
IllegalArgumentException- ifnameordescriptionis blank, or mutually exclusive fields are combined (workspace vs inline vs remote URL)
-
steps(int).