run
Launch a sub-agent and wait until it finishes in one call, returning the result and handling approval requests or task polling for MCP clients.
Instructions
Spawn a sub-agent run and wait in the same call until it finishes; takes the same arguments as spawn and returns the run as await does. Clients that opt into MCP Tasks get a task to poll instead, and an approval inside the run arrives as the task's input request. Other clients are asked approvals the way await asks them; without elicitation the call returns the run with status AwaitingApproval. Cancelling the call cancels the run.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task | Yes | What the sub-agent should do. | |
| model | No | Model to run on; defaults to the runtime's model. | |
| tools | No | Names of the tools this run may use; all configured tools when omitted. | |
| parent | No | Handle of the run this one belongs to; cancelling the parent cancels it. | |
| system | No | Optional system prompt for the sub-agent. | |
| maxTokens | No | Longest reply per model turn, in tokens; 0 leaves it to the engine. Engines that reserve memory per request (SGLang) batch far fewer requests without it. | |
| approveTools | No | Tools whose every call waits for the user's approval, on top of tools their server marks destructive. | |
| budgetTokens | No | Prompt plus completion tokens this run and every run under it may use; over it, the subtree is cancelled. | |
| maxToolCalls | No | Tool calls allowed before the sub-agent must answer without tools. | |
| serviceClass | No | interactive (default) or batch. Batch runs yield to interactive ones. | interactive |
| budgetSeconds | No | Wall-clock seconds this run may take, its subtree included; when they pass, the subtree is cancelled. | |
| budgetToolCalls | No | Tool calls this run and every run under it may make; over it, the subtree is cancelled. | |
| parallelToolCalls | No | Let the model ask for several tool calls in one reply, run at once. Off by default: Llama 3.x takes one call per reply. |