Skip to content

Commit d1a02b1

Browse files
authored
fix(core): clarify subagent tool guidance (#39572)
1 parent 94ee274 commit d1a02b1

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

packages/core/src/tool/plugin/subagent.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@ export const name = "subagent"
1313

1414
const NO_TEXT = "Subagent completed without a text response."
1515
const backgroundStarted = (sessionID: SessionSchema.ID) =>
16-
`The subagent is working in the background (id: ${sessionID}). You will be notified automatically when it finishes. DO NOT sleep, poll, or proactively check on its progress.`
16+
[
17+
`The subagent is working in the background (id: ${sessionID}). You will be notified automatically when it finishes.`,
18+
"DO NOT sleep, poll for progress, ask the subagent for status, or duplicate this subagent's work; avoid working with the same files or topics it is using.",
19+
"Work on non-overlapping tasks, or briefly tell the user what you launched and end your response.",
20+
].join("\n")
1721

1822
export const Input = Schema.Struct({
19-
agent: Schema.String.annotate({ description: "The configured agent to run as the subagent" }),
20-
description: Schema.String.annotate({ description: "A short description of the subagent's task" }),
23+
agent: Schema.String.annotate({ description: "The type of specialized agent to use for this task" }),
24+
description: Schema.String.annotate({ description: "A short 3-5 word label for the task, displayed to the user" }),
2125
prompt: Schema.String.annotate({ description: "The task for the subagent to perform" }),
2226
background: Schema.optionalKey(Schema.Boolean).annotate({
2327
description:
24-
"Run the subagent in the background and return immediately. You will be notified when it completes. DO NOT poll its progress.",
28+
"Run the subagent in the background and return immediately. You will be notified when it completes. DO NOT sleep, poll, or proactively check on its progress.",
2529
}),
2630
})
2731

@@ -31,7 +35,8 @@ export const Output = Schema.Struct({
3135
output: Schema.String,
3236
})
3337
export const description = [
34-
"Spawn a subagent: a child session running a configured agent with fresh context.",
38+
"Spawns an agent in a child session to work on the specified task.",
39+
"Include all relevant context and instructions in the prompt because the child starts with fresh context.",
3540
"Foreground (default) runs the subagent to completion and returns its final response.",
3641
"Background mode (background=true) launches it asynchronously and returns immediately; you are notified when it finishes.",
3742
"Use background only for independent work that can run while you continue elsewhere.",

0 commit comments

Comments
 (0)