@deepseek-ai/dsh-tool-subagent 0.2.1-alpha.1 → 0.2.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +71 -53
- package/README.md +62 -34
- package/README.zh.md +61 -33
- package/lib/index.js +201 -248
- package/lib/types/index.d.ts +6 -34
- package/lib/types/preset-selection.d.ts +43 -0
- package/locale/en.json +5 -0
- package/locale/model-selection-settings/en.json +5 -0
- package/locale/model-selection-settings/zh.json +5 -0
- package/locale/zh.json +6 -0
- package/package.json +37 -30
package/README.i18n.yaml
CHANGED
|
@@ -9,20 +9,23 @@
|
|
|
9
9
|
en: 686fb5136bef0a3b
|
|
10
10
|
zh: d25d6569174a01b5
|
|
11
11
|
/deepseek-ai-dsh-tool-subagent/summary:
|
|
12
|
-
en:
|
|
13
|
-
zh:
|
|
12
|
+
en: c09d40329253a9d8
|
|
13
|
+
zh: 91c1bbe5557bdda9
|
|
14
14
|
/deepseek-ai-dsh-tool-subagent/table-of-contents:
|
|
15
15
|
en: d152484eb41ac6b4
|
|
16
16
|
zh: 09388d293f9be9cb
|
|
17
17
|
/deepseek-ai-dsh-tool-subagent/use-this-package:
|
|
18
|
-
en:
|
|
19
|
-
zh:
|
|
18
|
+
en: 93f1701f5209ecb5
|
|
19
|
+
zh: 6310fd012400aead
|
|
20
20
|
/deepseek-ai-dsh-tool-subagent/use-this-package/minimal-configuration:
|
|
21
|
-
en:
|
|
22
|
-
zh:
|
|
23
|
-
/deepseek-ai-dsh-tool-subagent/use-this-package/
|
|
24
|
-
en:
|
|
25
|
-
zh:
|
|
21
|
+
en: 6a82283a51912841
|
|
22
|
+
zh: 35728acc16931bb4
|
|
23
|
+
/deepseek-ai-dsh-tool-subagent/use-this-package/managed-delegation:
|
|
24
|
+
en: bb715d037cde14bd
|
|
25
|
+
zh: a88e98c07115fbd1
|
|
26
|
+
/deepseek-ai-dsh-tool-subagent/use-this-package/selecting-a-child-preset:
|
|
27
|
+
en: 1950ef92bab0f46e
|
|
28
|
+
zh: 593f5f64ed9b5631
|
|
26
29
|
/deepseek-ai-dsh-tool-subagent/use-this-package/selecting-a-child-llm:
|
|
27
30
|
en: 0d37e3b3957515e4
|
|
28
31
|
zh: ea1a94b2f29e7d9a
|
|
@@ -30,23 +33,23 @@
|
|
|
30
33
|
en: 6ce5f749256a7e6c
|
|
31
34
|
zh: a4f2adb04a70d9cf
|
|
32
35
|
/deepseek-ai-dsh-tool-subagent/understand-the-implementation/design-concept:
|
|
33
|
-
en:
|
|
34
|
-
zh:
|
|
35
|
-
/deepseek-ai-dsh-tool-subagent/understand-the-implementation/
|
|
36
|
-
en:
|
|
37
|
-
zh:
|
|
38
|
-
/deepseek-ai-dsh-tool-subagent/understand-the-implementation/
|
|
39
|
-
en:
|
|
40
|
-
zh:
|
|
36
|
+
en: e9df1e3d504a3625
|
|
37
|
+
zh: 4eca7bb1bc6def62
|
|
38
|
+
/deepseek-ai-dsh-tool-subagent/understand-the-implementation/activation-ownership:
|
|
39
|
+
en: ef692c4d17290920
|
|
40
|
+
zh: b1d0d3dab011e2cd
|
|
41
|
+
/deepseek-ai-dsh-tool-subagent/understand-the-implementation/result-acknowledgement:
|
|
42
|
+
en: 3cdb913209febc42
|
|
43
|
+
zh: ea6ebfbe9d21fb3e
|
|
41
44
|
/deepseek-ai-dsh-tool-subagent/understand-the-implementation/context-sensitive-wording:
|
|
42
45
|
en: 1733728ac5aa6bb0
|
|
43
46
|
zh: 341ffc6e21a289af
|
|
44
47
|
/deepseek-ai-dsh-tool-subagent/understand-the-implementation/source-map:
|
|
45
|
-
en:
|
|
46
|
-
zh:
|
|
48
|
+
en: ce5147d9e1b2849c
|
|
49
|
+
zh: 67a707f05b2b7dc5
|
|
47
50
|
/deepseek-ai-dsh-tool-subagent/further-exploration:
|
|
48
|
-
en:
|
|
49
|
-
zh:
|
|
51
|
+
en: fa3c9a967b636afb
|
|
52
|
+
zh: a9ce930a9766d5cb
|
|
50
53
|
/deepseek-ai-dsh-tool-subagent/model-experience:
|
|
51
54
|
en: 215e7ba838619b7b
|
|
52
55
|
zh: a311da3843709f90
|
|
@@ -54,11 +57,11 @@
|
|
|
54
57
|
en: e4c7376d4f29dbd5
|
|
55
58
|
zh: 6b7a9eaf69c9ea53
|
|
56
59
|
/deepseek-ai-dsh-tool-subagent/model-experience/tool-schema/what-the-model-sees:
|
|
57
|
-
en:
|
|
58
|
-
zh:
|
|
60
|
+
en: cdaa88b47ba03e23
|
|
61
|
+
zh: 2b7429db53e0aea7
|
|
59
62
|
/deepseek-ai-dsh-tool-subagent/model-experience/tool-schema/token-effect:
|
|
60
|
-
en:
|
|
61
|
-
zh:
|
|
63
|
+
en: 0c6cf11d65ba83dc
|
|
64
|
+
zh: 6e2b2e64bf1f18f2
|
|
62
65
|
/deepseek-ai-dsh-tool-subagent/model-experience/tool-schema/kv-cache-effect:
|
|
63
66
|
en: 46f736c6c389052a
|
|
64
67
|
zh: a7765541030e9104
|
|
@@ -78,44 +81,59 @@
|
|
|
78
81
|
en: cf78b9dd5596495f
|
|
79
82
|
zh: bd44560f8c2435e8
|
|
80
83
|
/deepseek-ai-dsh-tool-subagent/model-experience/system-prompt/what-the-model-sees:
|
|
81
|
-
en:
|
|
82
|
-
zh:
|
|
84
|
+
en: 64a1c2edb455950c
|
|
85
|
+
zh: 15d280ff2c918672
|
|
83
86
|
/deepseek-ai-dsh-tool-subagent/model-experience/system-prompt/what-the-model-sees/tool-guidance-section:
|
|
84
87
|
en: 82b3cd08b3961c98
|
|
85
88
|
zh: bdc2a34bcea16cac
|
|
86
89
|
/deepseek-ai-dsh-tool-subagent/model-experience/system-prompt/token-effect:
|
|
87
|
-
en:
|
|
88
|
-
zh:
|
|
90
|
+
en: 58ee76659f75c73e
|
|
91
|
+
zh: 726c5b789e96677c
|
|
89
92
|
/deepseek-ai-dsh-tool-subagent/model-experience/system-prompt/kv-cache-effect:
|
|
90
|
-
en:
|
|
91
|
-
zh:
|
|
92
|
-
/deepseek-ai-dsh-tool-subagent/model-experience/
|
|
93
|
-
en:
|
|
94
|
-
zh:
|
|
95
|
-
/deepseek-ai-dsh-tool-subagent/model-experience/
|
|
96
|
-
en:
|
|
97
|
-
zh:
|
|
98
|
-
/deepseek-ai-dsh-tool-subagent/model-experience/
|
|
99
|
-
en:
|
|
100
|
-
zh:
|
|
101
|
-
/deepseek-ai-dsh-tool-subagent/model-experience/
|
|
93
|
+
en: eaee0378bf87c980
|
|
94
|
+
zh: 2783a481ee349f1e
|
|
95
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/runtime-depth-context:
|
|
96
|
+
en: 1e58e87365d88e45
|
|
97
|
+
zh: 7648aa3b3865057f
|
|
98
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/runtime-depth-context/what-the-model-sees:
|
|
99
|
+
en: fde048c427103086
|
|
100
|
+
zh: 6614730cc00f02e4
|
|
101
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/runtime-depth-context/what-the-model-sees/depth-limit-notice:
|
|
102
|
+
en: 0ae8dbcee66d0cd6
|
|
103
|
+
zh: 5a69283739ae59e0
|
|
104
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/runtime-depth-context/token-effect:
|
|
105
|
+
en: dae9cd59b9649b5a
|
|
106
|
+
zh: 8bb35289ebaeaf7b
|
|
107
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/runtime-depth-context/kv-cache-effect:
|
|
108
|
+
en: 9e6e8bc993992908
|
|
109
|
+
zh: 4de1e9d85ab3bfca
|
|
110
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/start-result:
|
|
111
|
+
en: 45854c8f4da73af7
|
|
112
|
+
zh: 7a9803ca8c03c40f
|
|
113
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/start-result/what-the-model-sees:
|
|
114
|
+
en: 15772cb4c28bf562
|
|
115
|
+
zh: 7452e7a7114d587c
|
|
116
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/start-result/token-effect:
|
|
117
|
+
en: 807d71626c81c858
|
|
118
|
+
zh: ba4b85709fa46c84
|
|
119
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/start-result/kv-cache-effect:
|
|
102
120
|
en: f5d5f97a153f7c70
|
|
103
121
|
zh: 3d6bc05b9eadfbc2
|
|
104
|
-
/deepseek-ai-dsh-tool-subagent/model-experience/
|
|
105
|
-
en:
|
|
106
|
-
zh:
|
|
107
|
-
/deepseek-ai-dsh-tool-subagent/model-experience/
|
|
108
|
-
en:
|
|
109
|
-
zh:
|
|
110
|
-
/deepseek-ai-dsh-tool-subagent/model-experience/
|
|
111
|
-
en:
|
|
112
|
-
zh:
|
|
113
|
-
/deepseek-ai-dsh-tool-subagent/model-experience/
|
|
122
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/completion-delivery:
|
|
123
|
+
en: b6ed0eef154aa546
|
|
124
|
+
zh: 34160884aa30ffec
|
|
125
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/completion-delivery/what-the-model-sees:
|
|
126
|
+
en: 8f5e3a083eb7f807
|
|
127
|
+
zh: 6bfc2b38f49a6f79
|
|
128
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/completion-delivery/token-effect:
|
|
129
|
+
en: 615348e27c0c9bc0
|
|
130
|
+
zh: 1655fdbc42932909
|
|
131
|
+
/deepseek-ai-dsh-tool-subagent/model-experience/completion-delivery/kv-cache-effect:
|
|
114
132
|
en: f5d5f97a153f7c70
|
|
115
133
|
zh: 3d6bc05b9eadfbc2
|
|
116
134
|
/deepseek-ai-dsh-tool-subagent/known-limitations-and-deferred-work:
|
|
117
|
-
en:
|
|
118
|
-
zh:
|
|
135
|
+
en: c17c91a188bb0d8c
|
|
136
|
+
zh: d77c1ffcf1eca737
|
|
119
137
|
/deepseek-ai-dsh-tool-subagent/known-limitations-and-deferred-work/dev-note:
|
|
120
138
|
en: e67f633dc6fe7773
|
|
121
139
|
zh: 3bb0c20c93f16f98
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
Use this package to give an agent a named tool that delegates work to a configured
|
|
12
|
+
Use this package to give an agent a named tool that delegates work to a configured backend. Every call starts a managed activation and returns a child id; the runtime owns completion notices and cleanup. Local children support messages and restoration, while external backends execute one task and return their final answer through the completion notice. Supported backends can expose approved child LLM routes. Each instance can select a child preset and depth limit.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
|
@@ -25,6 +25,8 @@ Use this package to give an agent a named tool that delegates work to a configur
|
|
|
25
25
|
<a id="use-this-package"></a>
|
|
26
26
|
## Use this package
|
|
27
27
|
|
|
28
|
+
The optional `cwd` argument selects the child's initial working directory. Relative paths resolve against the caller's current directory; omission inherits it. Existing children retain their own directories when the caller changes directory.
|
|
29
|
+
|
|
28
30
|
Mount one instance per delegation target, each with a distinct `toolName`. The tool exists exactly while its provider does, so sibling load order and provider reloads never strand it.
|
|
29
31
|
|
|
30
32
|
### Minimal configuration
|
|
@@ -45,22 +47,29 @@ Load the subagent service, an in-process or remote backend, and this tool; then
|
|
|
45
47
|
| `provider` | required | Provider name on `ctx.subagents` (e.g. `spawn`, `fork`, `acp`) |
|
|
46
48
|
| `toolName` | `subagent` | Model-facing tool name; distinct for every loaded instance |
|
|
47
49
|
| `modelSelectionSettings` | `false` | Sample the Host's exact-route authorization preference for each top-level Session; a standing preset observes matching Sessions, while direct Agent setup passes its Session explicitly; requires provider `agentOptions` support |
|
|
48
|
-
| `enableRunInBackground` | `true` | Expose `run_in_background`; disabling also rejects forced background calls |
|
|
49
|
-
| `backgroundMode` | `one-shot` | Background policy: `one-shot` defaults calls to foreground; `continuable` defaults them to background and requires the provider's `prepareContinuable` capability |
|
|
50
50
|
| `agentOptions` | — | Configured child `provider`, `model`, adapter-owned `reasoningEffort`, and positive `maxTokens` defaults; requires provider `agentOptions` support and overlays any provider-owned route defaults |
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
51
|
+
| `agentPreset` | — | Default independent child preset id; requires in-process spawn |
|
|
52
|
+
| `allowedAgentPresets` | — | Non-empty preset-id allowlist exposed as the model's optional `agent_preset` enum; must include `agentPreset` when both are set |
|
|
53
53
|
| `maxDepth` | Host setting (`1`) | Absolute delegation-depth cap (`0` forbids delegation); `'provider-managed'` sends no cap to an out-of-process provider |
|
|
54
54
|
|
|
55
55
|
The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-tool-subagent) is the exhaustive source for every accepted field and its JSDoc.
|
|
56
56
|
|
|
57
|
-
###
|
|
57
|
+
### Managed delegation
|
|
58
|
+
|
|
59
|
+
Every call returns `started subagent <childId>` after the runtime accepts the child. It does not wait for the child's result. The activation owns the work independently of the completed tool call; the runtime sends a completion notice and releases execution resources.
|
|
60
|
+
|
|
61
|
+
Every backend’s completion notice carries its final answer. Local Spawn and Fork children can also send messages, accept more work through `send_message` while active, or resume after settling. Codex, Claude Code, ACP, and DSH SDK backends do not accept follow-up messages.
|
|
62
|
+
|
|
63
|
+
`maxDepth` caps recursion (`0` forbids delegation); omission reads the current Host `subagent.maxDepth` setting, initially `1`, at each delegation. A numeric depth requires a provider with the `depthLimit` capability; `'provider-managed'` leaves the budget to an out-of-process provider. The tool stays visible at the cap; each attempted start checks the calling agent's current depth and rejects with an errored result.
|
|
64
|
+
|
|
65
|
+
<a id="selecting-a-child-preset"></a>
|
|
66
|
+
### Selecting a child preset
|
|
58
67
|
|
|
59
|
-
|
|
68
|
+
Set `agentPreset` to give every child an independent preset by default. Set `allowedAgentPresets` to let the model choose an id through `agent_preset`; without this allowlist, the model cannot override the configured choice. Only in-process spawn supports these options; fork and external backends reject them.
|
|
60
69
|
|
|
61
|
-
|
|
70
|
+
The configured default and allowlist must name declared presets. A tool inside a preset checks these ids and reads their descriptions during Agent initialization; a Host-mounted tool performs this check when it loads. This check does not activate candidate presets. Activation failures reject the selected preset when the child is composed. Without either selection field, the tool does not require the preset service. An omitted model choice uses the configured `agentPreset`, or joins the parent's current preset revision when no default is configured. Any explicit id mounts the currently available revision, even when it matches the parent's id.
|
|
62
71
|
|
|
63
|
-
|
|
72
|
+
Compose persona and tools in the [preset plugin list](../../preset/agent-preset-registry/README.md). Tool configuration containing `persona` or `toolFilter` fails at load with a migration error. Local children use the shared [preset restoration rules](../subagent/README.md#restoring-child-composition).
|
|
64
73
|
|
|
65
74
|
### Selecting a child LLM
|
|
66
75
|
|
|
@@ -80,15 +89,15 @@ This section explains how the tool mirrors provider lifecycle and settles runs;
|
|
|
80
89
|
|
|
81
90
|
### Design concept
|
|
82
91
|
|
|
83
|
-
One instance is one provider plus one tool name. The plugin mirrors provider lifecycle: it registers the tool when the named provider appears and disposes it when the provider leaves, so sibling load order and HMR replacement cannot strand a dangling tool. Direct Agent setup passes its unpublished Session explicitly and awaits installation before publication. A
|
|
92
|
+
One instance is one provider plus one tool name. The plugin mirrors provider lifecycle: it registers the tool when the named provider appears and disposes it when the provider leaves, so sibling load order and HMR replacement cannot strand a dangling tool. Direct Agent setup passes its unpublished Session explicitly and awaits installation before publication. A standing preset with model or preset selection receives each matching Agent through `agent/created`, validates preset references, selects any model policy from its Session, and awaits installation through its Context; installation failure rejects creation. A numeric `maxDepth` or configured LLM selection the provider cannot enforce fails the mount instead of the first delegation. At most one instance in a tool scope may own model selection because `list_subagent_models` has a global name.
|
|
84
93
|
|
|
85
|
-
###
|
|
94
|
+
### Activation ownership
|
|
86
95
|
|
|
87
|
-
|
|
96
|
+
The tool calls `ctx.subagents.startActivation()` with parent delivery selected. The runtime owns startup cancellation, execution, outcome reporting, and cleanup. A startup failure is an errored tool result; failures after publication arrive through the completion notice, with diagnostics and partial output preserved by the runtime.
|
|
88
97
|
|
|
89
|
-
###
|
|
98
|
+
### Result acknowledgement
|
|
90
99
|
|
|
91
|
-
|
|
100
|
+
The canonical tool result is `{ kind: 'activation', subagentId }`. It contains no execution Promise or final output; programmatic consumers that need to await results use the subagent service directly.
|
|
92
101
|
|
|
93
102
|
### Context-sensitive wording
|
|
94
103
|
|
|
@@ -98,7 +107,8 @@ The tool's description derives from `provider.inheritsParentContext`: a fresh ch
|
|
|
98
107
|
|
|
99
108
|
| File | Role |
|
|
100
109
|
|---|---|
|
|
101
|
-
| [`src/index.ts`](src/index.ts) | Tool registration, lifecycle mirroring,
|
|
110
|
+
| [`src/index.ts`](src/index.ts) | Tool registration, provider lifecycle mirroring, activation requests |
|
|
111
|
+
| [`src/preset-selection.ts`](src/preset-selection.ts) | Configured preset validation, model allowlist, and description guidance |
|
|
102
112
|
| [`src/model-selection.ts`](src/model-selection.ts) | Request/config merge and live LLM route preflight |
|
|
103
113
|
| [`src/model-selection-settings.ts`](src/model-selection-settings.ts) | Host-owned opt-in setting sampled for new Sessions |
|
|
104
114
|
| [`src/model-selection-state.ts`](src/model-selection-state.ts) | Session event that records and inherits the sampled decision |
|
|
@@ -113,12 +123,11 @@ The tool's description derives from `provider.inheritsParentContext`: a fresh ch
|
|
|
113
123
|
|
|
114
124
|
Read these pages when the package-level contract is not enough; they move from the tool's runtime behavior to the seam it delegates over and the adjacent child tools.
|
|
115
125
|
|
|
116
|
-
- [Subagent subsystem](../../../docs/subsystems/subagent.md) — providers,
|
|
126
|
+
- [Subagent subsystem](../../../docs/subsystems/subagent.md) — providers, activations, results, and continuation.
|
|
117
127
|
- [dsh-tool-subagent-control](../tool-subagent-control/README.md) — messaging, interrupt, and listing tools for continuable children.
|
|
118
|
-
- [Generated tool catalog](../../../docs/tool-catalog.md#deepseek-aidsh-tool-subagent) — the default schema and
|
|
128
|
+
- [Generated tool catalog](../../../docs/tool-catalog.md#deepseek-aidsh-tool-subagent) — the default schema and backend-specific wording.
|
|
119
129
|
- [Generated configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-tool-subagent) — every accepted config field.
|
|
120
|
-
- [
|
|
121
|
-
- [historical Model-selected subagent routes](../../../.agents/notes/archived/feature/2026-08-18-model-selected-subagent-routes.md) — selection policy, inheritance, discovery, and the fork restriction.
|
|
130
|
+
- [Historical model-selected subagent routes](../../../.agents/notes/archived/feature/2026-08-18-model-selected-subagent-routes.md) — selection policy, inheritance, discovery, and the fork restriction.
|
|
122
131
|
|
|
123
132
|
-----
|
|
124
133
|
|
|
@@ -129,11 +138,11 @@ Read these pages when the package-level contract is not enough; they move from t
|
|
|
129
138
|
|
|
130
139
|
#### What the model sees
|
|
131
140
|
|
|
132
|
-
The
|
|
141
|
+
The generated default [`subagent` schema](../../../docs/tool-catalog.md#deepseek-aidsh-tool-subagent) appears under the configured tool name while its provider exists. An enabled Session policy adds `provider`, `model`, and `reasoning_effort` plus route guidance; the backend must support `agentOptions`. `allowedAgentPresets` adds the `agent_preset` enum and guidance from the presets' display descriptions. Context inheritance and continuation support determine the task and follow-up descriptions. A tool restriction removes both the schema and its `tool:<toolName>` guidance section.
|
|
133
142
|
|
|
134
143
|
#### Token effect
|
|
135
144
|
|
|
136
|
-
Fixed schema cost per parent request;
|
|
145
|
+
Fixed schema cost per parent request; LLM selection adds three parameters, while preset selection adds one enum parameter and preset descriptions. Each tool instance adds one schema and one short system-prompt section.
|
|
137
146
|
|
|
138
147
|
#### KV Cache effect
|
|
139
148
|
|
|
@@ -157,45 +166,65 @@ The schema is prefix-stable across adapter registration and catalog changes. Eac
|
|
|
157
166
|
|
|
158
167
|
#### What the model sees
|
|
159
168
|
|
|
160
|
-
|
|
169
|
+
Visible delegation tools share one guidance paragraph, listing tools in name order and instructing the model to start independent delegations together and keep working while they run, and to end its turn instead of sleeping or polling when only waiting for their results remains. Hidden or unavailable tools are omitted; no guidance appears when none are visible. With both `subagent` and `subagent_fork` visible, the text is:
|
|
161
170
|
|
|
162
171
|
##### Tool-guidance section
|
|
163
172
|
|
|
164
173
|
```markdown
|
|
165
|
-
Start independent subagent
|
|
174
|
+
Start independent delegations with `subagent` or `subagent_fork` together in one assistant message and continue useful work while they run. When only waiting for their results remains, end your turn instead of sleeping or polling; the next result starts a new turn.
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### Token effect
|
|
178
|
+
|
|
179
|
+
At most one short delegation paragraph per parent request, listing the tool names visible to that request.
|
|
180
|
+
|
|
181
|
+
#### KV Cache effect
|
|
182
|
+
|
|
183
|
+
Prefix-stable while the visible tool names are unchanged; adding or removing a visible tool changes the paragraph.
|
|
184
|
+
|
|
185
|
+
### Runtime depth context
|
|
186
|
+
|
|
187
|
+
#### What the model sees
|
|
188
|
+
|
|
189
|
+
When the calling agent reaches or exceeds a visible tool's effective numeric depth cap, an optional runtime-context snapshot tells it to do the work directly. The cap is resolved again at each request, including after settings changes or session resume. Hidden tools and `provider-managed` limits contribute no depth text. For a child at depth one with a cap of one:
|
|
190
|
+
|
|
191
|
+
##### Depth-limit notice
|
|
192
|
+
|
|
193
|
+
```markdown
|
|
194
|
+
Delegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly.
|
|
166
195
|
```
|
|
167
196
|
|
|
168
197
|
#### Token effect
|
|
169
198
|
|
|
170
|
-
One short
|
|
199
|
+
One short contribution per capped tool joins the user-role runtime-context snapshot. Unchanged snapshots are not appended again; agents below the cap receive no additional text. `includeRuntimeContext: false` suppresses this notice without changing runtime depth enforcement.
|
|
171
200
|
|
|
172
201
|
#### KV Cache effect
|
|
173
202
|
|
|
174
|
-
|
|
203
|
+
Depth changes do not alter the system prompt or tool schemas. Updated runtime context appends after existing history; the provider still enforces the cap if the model attempts delegation.
|
|
175
204
|
|
|
176
|
-
###
|
|
205
|
+
### Start result
|
|
177
206
|
|
|
178
207
|
#### What the model sees
|
|
179
208
|
|
|
180
|
-
The call retains the description and prompt. Success
|
|
209
|
+
The call retains the task description and prompt. Success returns `started subagent <childId>`; startup rejection returns an error. Child execution details are delivered separately from this acknowledgement.
|
|
181
210
|
|
|
182
211
|
#### Token effect
|
|
183
212
|
|
|
184
|
-
The prompt and
|
|
213
|
+
The prompt and acknowledgement remain in parent history until compaction; child working context remains in the child.
|
|
185
214
|
|
|
186
215
|
#### KV Cache effect
|
|
187
216
|
|
|
188
217
|
Append-only; newly visible content follows the reusable request prefix and does not invalidate existing KV-cache entries.
|
|
189
218
|
|
|
190
|
-
###
|
|
219
|
+
### Completion delivery
|
|
191
220
|
|
|
192
221
|
#### What the model sees
|
|
193
222
|
|
|
194
|
-
|
|
223
|
+
Answer delivery follows the managed delegation rules above. The returned child id identifies subsequent control and catalog operations; only backends with continuation support accept follow-up messages.
|
|
195
224
|
|
|
196
225
|
#### Token effect
|
|
197
226
|
|
|
198
|
-
|
|
227
|
+
Messages and completion notices append to parent history independently of the start acknowledgement. The tool result itself contains no final output.
|
|
199
228
|
|
|
200
229
|
#### KV Cache effect
|
|
201
230
|
|
|
@@ -208,10 +237,9 @@ Append-only; newly visible content follows the reusable request prefix and does
|
|
|
208
237
|
|
|
209
238
|
These limits define what this tool does not return or enforce; they are current package constraints.
|
|
210
239
|
|
|
211
|
-
- **
|
|
212
|
-
- **Duplicate names across waiting one-shot instances are detected late** (`TODO(subagent-dup-toolname)`) — continuable instances reserve their prompt-section name during plugin application, but preventing provider-registration rollback for waiting one-shot instances requires a registry of intended names.
|
|
240
|
+
- **This tool does not wait for results** — use the completion notice or child messages. Programmatic result waiting belongs to the subagent service.
|
|
213
241
|
- **Shipped fork tools cannot select a child LLM route** — they inherit the parent's provider and model to keep the copied conversation prefix eligible for KV Cache reuse. Re-enable selection only when route changes preserve reuse or expose a bounded recomputation cost.
|
|
214
|
-
- **
|
|
242
|
+
- **Depth limits are fixed per instance** — independently named tools can set different caps. LLM selection requires an enabled per-Session preference and a provider that advertises `agentOptions`; both in-process providers and DSH SDK advertise it, while ACP, Codex, and Claude Code reject it rather than ignore it.
|
|
215
243
|
|
|
216
244
|
<a id="dev-note"></a>
|
|
217
245
|
### Dev Note
|