Skip to content

SwarmResult

autogen.agentchat.contrib.swarm_agent.SwarmResult #

Bases: BaseModel

Encapsulates the possible return values for a swarm agent function.

values class-attribute instance-attribute #

values = ''

agent class-attribute instance-attribute #

agent = None

context_variables class-attribute instance-attribute #

context_variables = {}

Config #

arbitrary_types_allowed class-attribute instance-attribute #

arbitrary_types_allowed = True

serialize_agent #

serialize_agent(agent)
Source code in autogen/agentchat/contrib/swarm_agent.py
@field_serializer("agent", when_used="json")
def serialize_agent(self, agent: Union[ConversableAgent, str]) -> str:
    if isinstance(agent, ConversableAgent):
        return agent.name
    return agent