Skip to content

Commit 3556d7b

Browse files
authored
Fix session history duplication after PR #1550 (#1700)
1 parent 2395b68 commit 3556d7b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/agents/run.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,8 @@ async def run(
411411
if run_config is None:
412412
run_config = RunConfig()
413413

414-
# Prepare input with session if enabled
414+
# Keep original user input separate from session-prepared input
415+
original_user_input = input
415416
prepared_input = await self._prepare_input_with_session(input, session)
416417

417418
tool_use_tracker = AgentToolUseTracker()
@@ -438,8 +439,8 @@ async def run(
438439
current_agent = starting_agent
439440
should_run_agent_start_hooks = True
440441

441-
# save the original input to the session if enabled
442-
await self._save_result_to_session(session, original_input, [])
442+
# save only the new user input to the session, not the combined history
443+
await self._save_result_to_session(session, original_user_input, [])
443444

444445
try:
445446
while True:

0 commit comments

Comments
 (0)