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

Merge SwarmAgent into ConversableAgent #316

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

marklysze
Copy link
Collaborator

@marklysze marklysze commented Dec 30, 2024

Why are these changes needed?

To expand the use of swarms to allow all ConversableAgent-based agents, this merges SwarmAgent into ConversableAgent.

Progress:

  • Move SwarmAgent-specific init parameters to ConversableAgent
  • Move SwarmAgent initialisation functionality into the a/initiate_swarm_chat functions
  • Move swarm-specific functions under SwarmAgent out, like register_hand_off, _update_conditional_functions, generate_swarm_tool_reply
  • Move/Merge nested chat with carryover into ConversableAgent (process_nested_chat_carryover, _summary_from_nested_chats)
  • Update a/initiate_swarm_chat, AFTER_WORK, ON_CONDITION, SwarmResult, to use ConversableAgent instead of SwarmAgent
  • Move SwarmAgent tests to ConversableAgent tests
  • Update documentation /notebooks referring to SwarmAgent to ConversableAgent
  • Update documentation changing agent.register_hand_off to register_hand_off(agent
  • Add notes to YouTube videos that SwarmAgent is now merged into ConversableAgent
  • Finalise interface via discussion

QUESTIONS/NOTES FOR REVIEWER:

  • SwarmAgents could take a list of functions to register (e.g. my_agent = SwarmAgent(functions=[function_a, function_b])). These functions were registered for LLM but not for execution (as a separate agent would execute). How should this work on ConversableAgent? Should it be the same or should there be a way to specify LLM and/or Execution for each function? I have left it as the same for now.
  • In order to show the agent name for a transition function, I have implemented __str__ on ConversableAgent and the associated internal function (_get_display_name()) within it can be overwritten on a ConversableAgent instance, which I've done for any agents associated with a swarm. This means that if you do str(my_conversable_agent) you will get the name of the agent rather than the type as a string.

MIGRATION INSTRUCTIONS:

  • Change SwarmAgent to ConversableAgent
  • Instead of agent.register_hand_off, import and use register_hand_off(agent=abc, ...)
  • UPDATE_SYSTEM_MESSAGE is now UpdateSystemMessage (deprecation warning added)
  • ON_CONDITION is now OnCondition (deprecation warning added)
  • AFTER_WORK is now AfterWork (deprecation warning added)
  • ... TBD

Related issue number

#26

Checks

Signed-off-by: Mark Sze <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants