microsoft / microsoft/agent-framework

Python: AgentExecutor keeps service_session_id when replaying full conversation

Open
#4,292 4 comments 0 reactions 1 assignee View on GitHub

@moonbox3 is already working on this.

Since Feb 26, 2026.

python reproduced workflows
Dominant language
Python
Stars
13.6k
Forks
2.3k
Avg merge
2d 45m
Merged PRs (30d)
358

Description

### 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:
```bash
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
```python
# 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
```text
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`.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.