You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Add subagent tools message when using parent's tools for prompt caching
196
197
if(useParentTools){
197
-
if(agentTemplate.toolNames.length>0){
198
-
addendum+=`\n\nYou are a subagent that only has access to the following tools: ${agentTemplate.toolNames.join(', ')}. Do not attempt to use any other tools.`
199
-
}else{
200
-
addendum+=`\n\nYou are a subagent and do not have access to any tools specified earlier in the conversation.`
201
-
}
198
+
addendum+=`\n\nYou are a subagent that only has access to the following tools: ${toolNames.length>0 ? toolNames.join(', ') : 'none'}. Previously referenced tools in the conversation may have only been available to the parent agent. Do not attempt to use any other tools besides these listed here. You will only get tool errors if you do.`
202
199
203
200
// For subagents with inheritSystemPrompt, include full spawnable agents spec
204
201
// since the parent's system prompt may not have these agents listed
205
-
if(agentTemplate.spawnableAgents.length>0){
202
+
if(spawnableAgents.length>0){
206
203
addendum+=
207
204
'\n\n'+
208
205
(awaitbuildFullSpawnableAgentsSpec({
209
206
...params,
210
-
spawnableAgents: agentTemplate.spawnableAgents,
207
+
spawnableAgents,
211
208
agentTemplates,
212
209
}))
213
210
}
214
-
}elseif(agentTemplate.spawnableAgents.length>0){
211
+
}elseif(spawnableAgents.length>0){
215
212
// For non-inherited tools, agents are already defined as tools with full schemas,
216
213
// so we just list the available agent IDs here
217
-
addendum+=`\n\nYou can spawn the following agents: ${agentTemplate.spawnableAgents.join(', ')}.`
214
+
addendum+=`\n\nYou can spawn the following agents: ${spawnableAgents.join(', ')}.`
218
215
}
219
216
220
217
// Add output schema information if defined
221
-
if(agentTemplate.outputSchema){
218
+
if(outputSchema){
222
219
addendum+='\n\n## Output Schema\n\n'
223
220
addendum+=
224
221
'When using the set_output tool, your output must conform to this schema:\n\n'
0 commit comments