Skip to content

Commit 631d4f0

Browse files
committed
add handleSteps to .agents
1 parent a2cb695 commit 631d4f0

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

.agents/file-explorer.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,27 @@ const config: AgentConfig = {
3535
'You are a file explorer agent that spawns multiple file picker agents in parallel to comprehensively explore the codebase.',
3636
instructionsPrompt: '',
3737
stepPrompt: '',
38+
handleSteps: function* ({ prompt, params }) {
39+
const filePickerPrompts = params.prompts.map(
40+
(focusPrompt) =>
41+
`Based on the overall goal "${prompt}", find files related to this specific area: ${focusPrompt}`,
42+
),
43+
{ toolResult: spawnResult } = yield {
44+
toolName: 'spawn_agents',
45+
args: {
46+
agents: filePickerPrompts.map((promptText) => ({
47+
agent_type: 'file_picker',
48+
prompt: promptText,
49+
})),
50+
},
51+
}
52+
yield {
53+
toolName: 'set_output',
54+
args: {
55+
results: spawnResult?.result,
56+
},
57+
}
58+
},
3859
}
3960

4061
export default config

.agents/file-picker.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ const config: AgentConfig = {
2121
'Provide a short analysis of the locations in the codebase that could be helpful. Focus on the files that are most relevant to the user prompt.\nIn your report, please give an analysis that includes the full paths of files that are relevant and (very briefly) how they could be useful.',
2222
stepPrompt:
2323
'Do not use the find_files tool or any tools again. Just give your response.',
24+
handleSteps: function* ({ agentState, prompt, params }) {
25+
yield {
26+
toolName: 'find_files',
27+
args: { prompt },
28+
}
29+
yield 'STEP_ALL'
30+
},
2431
}
2532

2633
export default config

.agents/researcher.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ const config: AgentConfig = {
2222
instructionsPrompt: '',
2323
stepPrompt:
2424
"Don't forget to end your response with the end_turn tool: <end_turn></end_turn>",
25+
handleSteps: function* ({ agentState, prompt, params }) {
26+
yield {
27+
toolName: 'web_search',
28+
args: { prompt },
29+
}
30+
yield 'STEP_ALL'
31+
},
2532
}
2633

2734
export default config

0 commit comments

Comments
 (0)