Skip to content

Python: AgentExecutor keeps service_session_id when replaying full conversation #4292

@moonbox3

Description

@moonbox3

Description

AgentExecutor keeps session.service_session_id when a downstream executor is invoked with a replayed full conversation (including prior function-call/tool-result items).

This can cause provider calls to include both:

  • a server-side continuation pointer (previous_response_id via service_session_id), and
  • the same historical items explicitly in input.

Expected behavior: when full conversation is explicitly replayed to an agent executor, service_session_id should be cleared/reset before agent.run(...).

Steps To Reproduce

  1. Run:
    pytest packages/core/tests/workflow/test_full_conversation.py::test_run_request_with_full_history_clears_service_session_id --runxfail -q
  2. Observe assertion failure that the downstream spy agent still sees resp_PREVIOUS_RUN.

Code Sample

# Existing repro in repo:
# packages/core/tests/workflow/test_full_conversation.py
# test_run_request_with_full_history_clears_service_session_id

Error Messages / Stack Traces

E       AssertionError: assert 'resp_PREVIOUS_RUN' is None
E        +  where 'resp_PREVIOUS_RUN' = <...>._captured_service_session_id

Package Versions

  • agent-framework-core: 1.0.0rc2
  • agent-framework-orchestrations: 1.0.0b260225
  • Source commit tested: 02ba27493 (main)

Python Version

Python 3.13.5

Additional Context

Likely area:

  • packages/core/agent_framework/_workflows/_agent_executor.py (from_response, _run_agent*)

Related xfail note in test references issue #4047.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpythonworkflowsRelated to Workflows in agent-framework

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions