Skip to content

Commit 2e7d50d

Browse files
committed
Enhance input item processing in AgentRunner to support load balancing by removing instance-specific IDs for reasoning types when store setting is disabled.
1 parent 73e7843 commit 2e7d50d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/agents/run.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,16 @@ async def _save_result_to_session(
18601860
input_list = ItemHelpers.input_to_new_input_list(original_input)
18611861

18621862
# Convert new items to input format
1863-
new_items_as_input = [item.to_input_item() for item in new_items]
1863+
new_items_as_input = []
1864+
for item in new_items:
1865+
input_item = item.to_input_item()
1866+
if isinstance(input_item, dict) and input_item.get("type") == "reasoning":
1867+
# Check if store is explicitly set to False (ZDR mode)
1868+
store_setting = item.agent.model_settings.store
1869+
if not store_setting and "id" in input_item:
1870+
# Remove the instance-specific IDs to enable load balancing
1871+
input_item = {k: v for k, v in input_item.items() if k != "id"}
1872+
new_items_as_input.append(input_item)
18641873

18651874
# Save all items from this turn
18661875
items_to_save = input_list + new_items_as_input

0 commit comments

Comments
 (0)