Skip to content

AfterWork

autogen.AfterWork dataclass #

AfterWork(agent, next_agent_selection_msg=None)

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

PARAMETER DESCRIPTION
agent

The 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: Union[AfterWorkOption, ConversableAgent, str, Callable[..., Any]]

next_agent_selection_msg

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: Optional[Union[str, Callable[..., Any]]] DEFAULT: None

agent instance-attribute #

agent

next_agent_selection_msg class-attribute instance-attribute #

next_agent_selection_msg = None