Description
Current code in _agent_run.py, method run_agent_stream, lines 781~786:
# Create session (with service session support)
if config.use_service_session:
supplied_thread_id = input_data.get("thread_id") or input_data.get("threadId")
session = AgentSession(service_session_id=supplied_thread_id)
else:
session = AgentSession()
This constructs the AgentSession in a rigid way, and developers have no control over the session_id assignment.
When the AG-UI client provides a thread_id, we need to assign this thread_id to AgentSession.session_id to ensure session consistency.
However, the current implementation always generates a new session_id each time, which causes mapping issues between the session_id in the historical message records stored by the Agent's HistoryProvider and the client's thread_id.
Could we consider providing an AgentSessionBuilder with a default implementation?
This would allow developers to flexibly construct the AgentSession based on their requirements, making the framework more flexible and extensible.
Code Sample
Error Messages / Stack Traces
Package Versions
agent-framework:1.0.1
Python Version
Python 3.13
Additional Context
No response
Description
Current code in _agent_run.py, method run_agent_stream, lines 781~786:
This constructs the AgentSession in a rigid way, and developers have no control over the session_id assignment.
When the AG-UI client provides a thread_id, we need to assign this thread_id to AgentSession.session_id to ensure session consistency.
However, the current implementation always generates a new session_id each time, which causes mapping issues between the session_id in the historical message records stored by the Agent's HistoryProvider and the client's thread_id.
Could we consider providing an AgentSessionBuilder with a default implementation?
This would allow developers to flexibly construct the AgentSession based on their requirements, making the framework more flexible and extensible.
Code Sample
Error Messages / Stack Traces
Package Versions
agent-framework:1.0.1
Python Version
Python 3.13
Additional Context
No response