AfterWork

AfterWork(agent: autogen.agentchat.contrib.swarm_agent.AfterWorkOption | autogen.agentchat.conversable_agent.ConversableAgent | str | Callable, next_agent_selection_msg: str | autogen.agentchat.contrib.swarm_agent.ContextStr | Callable | None = None)

Handles the next step in the conversation when an agent doesn’t suggest a tool call or a handoff

Parameters:
NameDescription
agentThe agent to hand off to or the after work option.

Can be a ConversableAgent, a string name of a ConversableAgent, an AfterWorkOption, or a Callable.

The Callable signature is: def my_after_work_func(last_speaker: ConversableAgent, messages: List[Dict[str, Any]], groupchat: GroupChat) -> Union[AfterWorkOption, ConversableAgent, str]:

Type: autogen.agentchat.contrib.swarm_agent.AfterWorkOption | autogen.agentchat.conversable_agent.ConversableAgent | str | Callable
next_agent_selection_msgOptional[Union[str, Callable]]: Optional message to use for the agent selection (in internal group chat), only valid for when agent is AfterWorkOption.SWARM_MANAGER.

If a string, it will be used as a template and substitute the context variables.

If a Callable, it should have the signature: def my_selection_message(agent: ConversableAgent, messages: List[Dict[str, Any]]) -> str

Type: str | autogen.agentchat.contrib.swarm_agent.ContextStr | Callable | None

Default: None

Class Attributes

agent



next_agent_selection_msg