Skip to content

Commit 24c83ed

Browse files
committed
All write_todos force a next step of the agent, like a normal tool
1 parent a750a9b commit 24c83ed

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

packages/agent-runtime/src/run-agent-step.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -406,19 +406,6 @@ export const runAgentStep = async (
406406
(result) => !TOOLS_WHICH_WONT_FORCE_NEXT_STEP.includes(result.toolName),
407407
).length === 0
408408

409-
// Exception: if the only tool call is write_todos and all todos are completed, then end turn.
410-
let hasOnlyFinishedTodos = false
411-
if (
412-
toolCalls.every((call) => call.toolName === 'write_todos') &&
413-
toolCalls.some((call) =>
414-
(call.input.todos as { task: string; completed: boolean }[]).every(
415-
(todo) => todo.completed,
416-
),
417-
)
418-
) {
419-
hasOnlyFinishedTodos = true
420-
}
421-
422409
const hasTaskCompleted = toolCalls.some(
423410
(call) =>
424411
call.toolName === 'task_completed' || call.toolName === 'end_turn',
@@ -435,8 +422,8 @@ export const runAgentStep = async (
435422
// - end_turn is called (backward compatibility)
436423
shouldEndTurn = hasTaskCompleted
437424
} else {
438-
// For other models, also end turn when there are no tool calls or only a call to finished todos
439-
shouldEndTurn = hasTaskCompleted || hasNoToolResults || hasOnlyFinishedTodos
425+
// For other models, also end turn when there are no tool calls
426+
shouldEndTurn = hasTaskCompleted || hasNoToolResults
440427
}
441428

442429
agentState = {

0 commit comments

Comments
 (0)