Skip to content

Commit 07a4af1

Browse files
committed
refactor: improve comments for clarity in tool_choice reset logic
1 parent 0c747af commit 07a4af1

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/agents/_run_impl.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -216,22 +216,19 @@ async def execute_tools_and_side_effects(
216216
run_config.model_settings and
217217
cls._should_reset_tool_choice(run_config.model_settings, tools)
218218
):
219-
# Also update the run_config model settings with a copy
219+
# update the run_config model settings with a copy
220220
new_run_config_settings = dataclasses.replace(
221221
run_config.model_settings,
222222
tool_choice="auto"
223223
)
224-
# Create a new run_config with the new settings
225224
run_config = dataclasses.replace(run_config, model_settings=new_run_config_settings)
226225

227-
# Only reset in the problematic scenarios where loops are likely unintentional
228226
if cls._should_reset_tool_choice(agent.model_settings, tools):
229227
# Create a modified copy instead of modifying the original agent
230228
new_model_settings = dataclasses.replace(
231229
agent.model_settings,
232230
tool_choice="auto"
233231
)
234-
# Create a new internal agent with updated settings
235232
agent = dataclasses.replace(agent, model_settings=new_model_settings)
236233

237234
# Second, check if there are any handoffs

0 commit comments

Comments
 (0)