feat(agent): add post-turn stop callback

This commit is contained in:
Mario Zechner
2026-05-02 00:49:22 +02:00
parent a44622670f
commit 73b7b2c564
5 changed files with 152 additions and 1 deletions

View File

@@ -215,6 +215,18 @@ async function runLoop(
await emit({ type: "turn_end", message, toolResults });
if (
await config.shouldStopAfterTurn?.({
message,
toolResults,
context: currentContext,
newMessages,
})
) {
await emit({ type: "agent_end", messages: newMessages });
return;
}
pendingMessages = (await config.getSteeringMessages?.()) || [];
}