Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor agent chat to prepare for handoff/swarm #3949

Merged
merged 6 commits into from
Oct 25, 2024
Merged

Conversation

ekzhu
Copy link
Collaborator

@ekzhu ekzhu commented Oct 24, 2024

  1. Add handoff message type to chat message types
  2. Add Swarm group chat that uses handoff message to select next speaker
from autogen_agentchat.teams import Swarm

# agent1, agent2, agent3 must be able to generate `HandoffMessage`. 

swarm = Swarm([agent1, agent2, agent3])
result = await swarm.run("task")
  1. Remove tool call and tool call result message types from chat message types
  2. Remove BaseToolUseChatAgent, move tool call handling from group chat's chat agent container upward to the ToolUseAssistantAgent implementation, which subclasses BaseChatAgent directly.
  3. Renaming for better clarity

TODO as next PRs:

  1. Implement mechanism inside a chat agent to generate handoff message
  2. Consider merging CodingAssistantAgent and ToolUseAssistantAgent into a single agent class AssistantAgent, which also has the ability to generate handoff messages.
  3. Rename registered_tools to tools.
  4. Should we consider chat agent returning a sequence of chat messages rather than a single one -- what is the usage case?

Partially resolves - #3946 and #3864

@ekzhu ekzhu requested a review from victordibia October 24, 2024 18:47
@ekzhu ekzhu marked this pull request as draft October 24, 2024 23:42
@ekzhu ekzhu marked this pull request as ready for review October 25, 2024 04:15
@ekzhu ekzhu requested review from afourney and jackgerrits October 25, 2024 04:18
@ekzhu ekzhu added this to the 0.4.0 milestone Oct 25, 2024
@ekzhu ekzhu requested a review from husseinmozannar October 25, 2024 04:28
@gagb gagb self-requested a review October 25, 2024 05:26
@afourney
Copy link
Member

Oooh, I do like that top-level interface:

swarm = Swarm([agent1, agent2, agent3])
result = await swarm.run("task")

@victordibia
Copy link
Collaborator

+1 on the high level swarm interface. At some point, it might be good to have a naming convention for everything inside autogen_agentchat.teams. Right now we have things like teams.GroupChat, teams.Swarm ... perhaps something like teams.GroupChatTeam and teams.SwarmTeam to anchor users that both are types of teams.

+1 again on unifying CodingAssistantAgent and ToolUseAssistantAgent

@ekzhu ekzhu merged commit f31ff66 into main Oct 25, 2024
37 checks passed
@ekzhu ekzhu deleted the refactor-agentchat branch October 25, 2024 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants