a_initiate_swarm_chat
autogen.a_initiate_swarm_chat async
#
a_initiate_swarm_chat(initial_agent, messages, agents, user_agent=None, swarm_manager_args=None, max_rounds=20, context_variables=None, after_work=TERMINATE, exclude_transit_message=True)
Initialize and run a swarm chat asynchronously
PARAMETER | DESCRIPTION |
---|---|
initial_agent | The first receiving agent of the conversation. TYPE: |
messages | Initial message(s). |
agents | List of swarm agents. TYPE: |
user_agent | Optional user proxy agent for falling back to. TYPE: |
swarm_manager_args | Optional group chat manager arguments used to establish the swarm's groupchat manager, required when AfterWorkOption.SWARM_MANAGER is used. |
max_rounds | Maximum number of conversation rounds. TYPE: |
context_variables | Starting context variables. |
after_work | Method to handle conversation continuation when an agent doesn't select the next agent. If no agent is selected and no tool calls are output, we will use this method to determine the next agent. Must be a AfterWork instance (which is a dataclass accepting a ConversableAgent, AfterWorkOption, A str (of the AfterWorkOption)) or a callable. AfterWorkOption: - TERMINATE (Default): Terminate the conversation. - REVERT_TO_USER : Revert to the user agent if a user agent is provided. If not provided, terminate the conversation. - STAY : Stay with the last speaker. Callable: A custom function that takes the current agent, messages, and groupchat as arguments and returns an AfterWorkOption or a ConversableAgent (by reference or string name). TYPE: |
exclude_transit_message | all registered handoff function call and responses messages will be removed from message list before calling an LLM. Note: only with transition functions added with TYPE: |
Returns: ChatResult: Conversations chat history. dict[str, Any]: Updated Context variables. ConversableAgent: Last speaker.
Source code in autogen/agentchat/contrib/swarm_agent.py
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 |
|