Skip to content

Commit 78c79e9

Browse files
committed
Give base2 the set_output tool so subagents can use it
1 parent 54f477b commit 78c79e9

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

.agents/base2/base2.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export function createBase2(
5353
'str_replace',
5454
'write_file',
5555
'ask_user',
56+
'set_output',
5657
),
5758
spawnableAgents: buildArray(
5859
'file-picker',

common/src/tools/params/tool/set-output.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ const inputSchema = z
1212
'JSON object to set as the agent output. This completely replaces any previous output. If the agent was spawned, this value will be passed back to its parent. If the agent has an outputSchema defined, the output will be validated against it.',
1313
)
1414
const description = `
15-
You must use this tool as it is the only way to report any findings to the user. Nothing else you write will be shown to the user.
15+
Subagents must use this tool as it is the only way to report any findings. Nothing else you write will be visible to the user/parent agent.
1616
17-
Please set the output with all the information and analysis you want to pass on to the user. If you just want to send a simple message, use an object with the key "message" and value of the message you want to send.
17+
Please set the output with all the information and analysis you want to pass on. If you just want to send a simple message, use an object with the key "message" and value of the message you want to send.
1818
Example:
1919
${$getNativeToolCallExampleString({
2020
toolName,

common/src/types/dynamic-agent-template.ts

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -244,23 +244,24 @@ export const DynamicAgentTemplateSchema = DynamicAgentDefinitionSchema.extend({
244244
path: ['toolNames'],
245245
},
246246
)
247-
.refine(
248-
(data) => {
249-
// If 'set_output' tool is included, outputMode must be 'structured_output'
250-
if (
251-
data.toolNames.includes('set_output') &&
252-
data.outputMode !== 'structured_output'
253-
) {
254-
return false
255-
}
256-
return true
257-
},
258-
{
259-
message:
260-
"'set_output' tool requires outputMode to be 'structured_output'. Change outputMode to 'structured_output' or remove 'set_output' from toolNames.",
261-
path: ['outputMode'],
262-
},
263-
)
247+
// Note(James): Disabled so that a parent agent can have set_output tool and 'last_message' outputMode while its subagents use 'structured_output'. (The set_output tool must be included in parent to preserver prompt caching.)
248+
// .refine(
249+
// (data) => {
250+
// // If 'set_output' tool is included, outputMode must be 'structured_output'
251+
// if (
252+
// data.toolNames.includes('set_output') &&
253+
// data.outputMode !== 'structured_output'
254+
// ) {
255+
// return false
256+
// }
257+
// return true
258+
// },
259+
// {
260+
// message:
261+
// "'set_output' tool requires outputMode to be 'structured_output'. Change outputMode to 'structured_output' or remove 'set_output' from toolNames.",
262+
// path: ['outputMode'],
263+
// },
264+
// )
264265
.refine(
265266
(data) => {
266267
// If spawnableAgents array is non-empty, 'spawn_agents' tool must be included

0 commit comments

Comments
 (0)