semantic-kernel
semantic-kernel copied to clipboard
.Net: Agent - Review history ordering behavior
In agent-space, there's an open question as to what is the expected order of the converstation history...and where.
Logically, when a (say a long) conversation is accessed, its the most recent messages are the desired starting point. When we are accessing remote history, this is critical as we don't want to serialize all of the old history to get the recent.
From the perspective of the implementation of a list (ChatHistory
), appending the newest to the end makes sense. This is how ChatHistory
has been designed to be used. Inserting to the head of a reversed list would trigger a copy internally.
The desire for agent is to return the history in the same order regardless of modality.
Note: This consideration only applies to the AgentChat.GetHistoryAsync
operation which is not part of the core converation loop. This ability to access history has been included based on our experience/feedback with regards to visibility/diagnostics with the experimental assistant agents.