Description
What happened
For hosted agents, first turn succeeds, but follow-up turns through Agent Framework do not reliably reuse the same hosted agent session.
In Foundry, conversation_id changes per request, while agent_session_id is the durable session handle.
Agent Framework continuation plumbing appears to rely on conversation_id-style state instead of persisting hosted agent_session_id as first-class continuation state.
Result: second request can incur cold startup because a new hosted agent session/container path is used.
What we expected
On first hosted turn, when service returns agent_session_id or session.id, framework should persist that value.
On later turns, framework should send that persisted value back as extra_body.agent_session_id.
This should keep follow-up turns in the same hosted runtime session and avoid second-turn cold startup.
Steps to repro
Minimal code sample path A (direct SDK, expected behavior)
- Create OpenAI client from AIProjectClient with agent_name.
- First turn without agent_session_id.
- Extract agent_session_id from first response payload.
- Second turn with extra_body containing that same agent_session_id.
- Observe same hosted session reused and no second-turn cold startup.
Minimal code sample path B (Agent Framework, current behavior)
- Configure Foundry hosted agent through Agent Framework.
- Send two turns on same logical chat thread.
- Observe continuation does not reliably reuse hosted agent_session_id.
- Observe new hosted session startup behavior on follow-up turn.
Code Sample
Error Messages / Stack Traces
Package Versions
agent-framework-core 1.13.0 agent-framework-foundry 1.10.4 agent-framework-openai 1.12.0 agent-framework-ag-ui 1.0.1 azure-ai-projects 2.3.0 openai 2.51.0
Python Version
Python 3.12
Additional Context
No response
Description
What happened
For hosted agents, first turn succeeds, but follow-up turns through Agent Framework do not reliably reuse the same hosted agent session.
In Foundry, conversation_id changes per request, while agent_session_id is the durable session handle.
Agent Framework continuation plumbing appears to rely on conversation_id-style state instead of persisting hosted agent_session_id as first-class continuation state.
Result: second request can incur cold startup because a new hosted agent session/container path is used.
What we expected
On first hosted turn, when service returns agent_session_id or session.id, framework should persist that value.
On later turns, framework should send that persisted value back as extra_body.agent_session_id.
This should keep follow-up turns in the same hosted runtime session and avoid second-turn cold startup.
Steps to repro
Minimal code sample path A (direct SDK, expected behavior)
Minimal code sample path B (Agent Framework, current behavior)
Code Sample
Error Messages / Stack Traces
Package Versions
agent-framework-core 1.13.0 agent-framework-foundry 1.10.4 agent-framework-openai 1.12.0 agent-framework-ag-ui 1.0.1 azure-ai-projects 2.3.0 openai 2.51.0
Python Version
Python 3.12
Additional Context
No response