create_swarm_transition

create_swarm_transition(
    initial_agent: autogen.agentchat.conversable_agent.ConversableAgent,
    tool_execution: autogen.agentchat.conversable_agent.ConversableAgent,
    swarm_agent_names: list[str],
    user_agent: autogen.agentchat.user_proxy_agent.UserProxyAgent | None,
    swarm_after_work: autogen.agentchat.contrib.swarm_agent.AfterWorkOption | Callable | None
) -> Callable[[autogen.agentchat.conversable_agent.ConversableAgent, autogen.agentchat.groupchat.GroupChat], autogen.agentchat.agent.Agent | None]

Creates a transition function for swarm chat with enclosed state for the use_initial_agent.

Parameters:
NameDescription
initial_agentThe first agent to speak

Type: autogen.agentchat.conversable_agent.ConversableAgent
tool_executionThe tool execution agent

Type: autogen.agentchat.conversable_agent.ConversableAgent
swarm_agent_namesList of all agent names

Type: list[str]
user_agentOptional user proxy agent

Type: autogen.agentchat.user_proxy_agent.UserProxyAgent | None
swarm_after_workSwarm-level after work

Type: autogen.agentchat.contrib.swarm_agent.AfterWorkOption | Callable | None
Returns:
TypeDescription
Callable[[autogen.agentchat.conversable_agent.ConversableAgent, autogen.agentchat.groupchat.GroupChat], autogen.agentchat.agent.Agent | None]Callable transition function (for sync and async swarm chats)