From 15ec8a30b34a47ed0ed08e3c4e8babcad566a244 Mon Sep 17 00:00:00 2001 From: habema Date: Tue, 9 Sep 2025 23:48:51 +0300 Subject: [PATCH] fix: separate original_user_input from prepared_input to prevent duplication --- src/agents/run.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/agents/run.py b/src/agents/run.py index e92e1c2ef..a77900dff 100644 --- a/src/agents/run.py +++ b/src/agents/run.py @@ -411,7 +411,8 @@ async def run( if run_config is None: run_config = RunConfig() - # Prepare input with session if enabled + # Keep original user input separate from session-prepared input + original_user_input = input prepared_input = await self._prepare_input_with_session(input, session) tool_use_tracker = AgentToolUseTracker() @@ -438,8 +439,8 @@ async def run( current_agent = starting_agent should_run_agent_start_hooks = True - # save the original input to the session if enabled - await self._save_result_to_session(session, original_input, []) + # save only the new user input to the session, not the combined history + await self._save_result_to_session(session, original_user_input, []) try: while True: