Skip to content

Commit 5a2778f

Browse files
committed
Update handleSteps to be called again after llm generation finished
1 parent 01f4f74 commit 5a2778f

File tree

9 files changed

+544
-57
lines changed

9 files changed

+544
-57
lines changed

.agents/factory/base.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ export const base = (model: ModelName): Omit<SecretAgentDefinition, 'id'> => ({
7070
},
7171
} as any
7272

73-
yield 'STEP'
73+
const { stepsComplete } = yield 'STEP'
74+
if (stepsComplete) break
7475
}
7576
},
7677
})

.agents/factory/thinking-base.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ export const thinkingBase = (
7070
],
7171
},
7272
} satisfies ToolCall
73-
yield 'STEP'
73+
74+
const { stepsComplete } = yield 'STEP'
75+
if (stepsComplete) break
7476
}
7577
},
7678
})

.agents/types/agent-definition.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,14 @@ export interface AgentDefinition {
166166
* }
167167
* }
168168
*/
169-
handleSteps?: (
170-
context: AgentStepContext,
171-
) => Generator<
169+
handleSteps?: (context: AgentStepContext) => Generator<
172170
ToolCall | 'STEP' | 'STEP_ALL',
173171
void,
174-
{ agentState: AgentState; toolResult: string | undefined }
172+
{
173+
agentState: AgentState
174+
toolResult: string | undefined
175+
stepsComplete: boolean
176+
}
175177
>
176178
}
177179

0 commit comments

Comments
 (0)