Interface: CreateSubAgentToolOptions
@providerprotocol/agents / index / CreateSubAgentToolOptions
Interface: CreateSubAgentToolOptions
Section titled “Interface: CreateSubAgentToolOptions”Defined in: src/subagent/index.ts:75
Configuration options for creating a sub-agent tool.
Defines how an agent should be exposed as a callable tool, including its name, parameters, and how to transform tool arguments into prompts.
createSubAgentTool for usage examples
Properties
Section titled “Properties”agent:
Agent
Defined in: src/subagent/index.ts:82
The agent instance to expose as a tool.
This agent will be invoked when the parent agent calls the tool. The sub-agent executes independently with its own tools and system prompt.
buildPrompt()
Section titled “buildPrompt()”buildPrompt: (
params) =>string
Defined in: src/subagent/index.ts:117
Transforms tool parameters into a prompt string for the sub-agent.
This function receives the arguments generated by the parent agent’s model and should return a natural language prompt for the sub-agent.
Parameters
Section titled “Parameters”params
Section titled “params”Record<string, unknown>
The tool arguments matching the parameters schema
Returns
Section titled “Returns”string
A prompt string to send to the sub-agent
description
Section titled “description”description:
string
Defined in: src/subagent/index.ts:98
Description of what the tool does.
This is provided to the parent agent’s model to help it decide when to use this tool. Be specific about the sub-agent’s capabilities.
name:
string
Defined in: src/subagent/index.ts:90
Unique name for the tool.
Must be unique within the parent agent’s tool set. This name is used by the parent agent’s model to invoke the sub-agent.
parameters
Section titled “parameters”parameters:
JSONSchema
Defined in: src/subagent/index.ts:106
JSON Schema defining the tool’s input parameters.
The parent agent’s model will generate arguments matching this schema
when invoking the tool. These arguments are passed to buildPrompt.
stream?
Section titled “stream?”
optionalstream:boolean
Defined in: src/subagent/index.ts:140
Whether to stream the sub-agent execution.
When true, inner events from the sub-agent (text deltas, tool calls, etc.)
are forwarded to the parent through subagent_event events, enabling
real-time visibility into sub-agent progress.
When false, only subagent_start and subagent_end events are emitted.
Default Value
Section titled “Default Value”truesubagentType?
Section titled “subagentType?”
optionalsubagentType:string
Defined in: src/subagent/index.ts:127
Identifier for the sub-agent type used in event payloads.
Useful for distinguishing between different sub-agent types in logs
and event handlers. Defaults to the tool name if not specified.
Default Value
Section titled “Default Value”The tool name