Skip to content

Conversation

@dsgrieve
Copy link
Contributor

@dsgrieve dsgrieve commented Aug 6, 2024

Motivation and Context

With Agents API, ChatHistory might be modified by multiple agents running in their own threads.

Description

Used java.util.concurrent.ConcurrentLinkedQueue in place of ArrayList. One consequence of this is that messages from one agent could be interspresed with messages from other agents in the chat history. I don't think this should be a problem. Note that one of the APIs in the agents space is an async receive (AgentChannel#receiveAsync) that will update the ChatHistory. Depending on the implementation of the Agent that uses this AgentChannel API, the messages could be received in bulk or streamed, so it seems the concurrent approach fits the use-case. The alternative is to use a Collections.synchronizeList().

Contribution Checklist

@dsgrieve dsgrieve requested review from johnoliver and milderhc August 6, 2024 21:09
@dsgrieve dsgrieve requested a review from johnoliver August 7, 2024 16:15
@johnoliver johnoliver merged commit 88e7fe7 into microsoft:main Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants