Skip to content

Commit 29f11c8

Browse files
Main merge into the branch + error string update
2 parents bffe9f5 + daa9695 commit 29f11c8

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,7 @@ jobs:
8484
enable-cache: true
8585
- name: Install dependencies
8686
run: make sync
87+
- name: Install Python 3.9 dependencies
88+
run: UV_PROJECT_ENVIRONMENT=.venv_39 uv sync --all-extras --all-packages --group dev
8789
- name: Run tests
8890
run: make old_version_tests

src/agents/memory/openai_conversations_session.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ async def start_openai_conversations_session(openai_client: AsyncOpenAI | None =
1919
return response.id
2020

2121

22-
_EMPTY_SESSION_ID = ""
23-
24-
2522
class OpenAIConversationsSession(SessionABC):
2623
def __init__(
2724
self,

src/agents/run.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,8 @@ async def run(
418418
if run_config is None:
419419
run_config = RunConfig()
420420

421-
# Prepare input with session if enabled
421+
# Keep original user input separate from session-prepared input
422+
original_user_input = input
422423
prepared_input = await self._prepare_input_with_session(
423424
input, session, run_config.session_input_callback
424425
)
@@ -447,8 +448,8 @@ async def run(
447448
current_agent = starting_agent
448449
should_run_agent_start_hooks = True
449450

450-
# save the original input to the session if enabled
451-
await self._save_result_to_session(session, original_input, [])
451+
# save only the new user input to the session, not the combined history
452+
await self._save_result_to_session(session, original_user_input, [])
452453

453454
try:
454455
while True:
@@ -1490,13 +1491,14 @@ async def _prepare_input_with_session(
14901491
if session is None:
14911492
return input
14921493

1493-
# If the user doesn't explicitly specify a mode, raise an error
1494+
# If the user doesn't specify an input callback and pass a list as input
14941495
if isinstance(input, list) and not session_input_callback:
14951496
raise UserError(
1496-
"You must specify the `session_input_callback` in the `RunConfig`. "
1497-
"Otherwise, when using session memory, provide only a string input to append to "
1498-
"the conversation, or use session=None and provide a list to manually manage "
1499-
"conversation history."
1497+
"When using session memory, list inputs require a "
1498+
"`RunConfig.session_input_callback` to define how they should be merged "
1499+
"with the conversation history. If you don't want to use a callback, "
1500+
"provide your input as a string instead, or disable session memory "
1501+
"(session=None) and pass a list to manage the history manually."
15001502
)
15011503

15021504
# Get previous conversation history

0 commit comments

Comments
 (0)