Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/durable-agent-tool-stop-detection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@workflow/ai': patch
---

Continue DurableAgent tool loops whenever a model step contains tool calls, regardless of the reported finish reason.
2 changes: 1 addition & 1 deletion packages/ai/src/agent/stream-text-iterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export async function* streamTextIterator({
// Normalize finishReason - AI SDK v6 returns { unified, raw }, v5 returns a string
const finishReason = normalizeFinishReason(raw.rawFinishReason);

if (finishReason === 'tool-calls') {
if (finishReason === 'tool-calls' || toolCalls.length > 0) {
lastStepWasToolCalls = true;

// Build reasoning content parts from the step result.
Expand Down
Loading