def to_envelope(self) -> agent_pb2.Envelope:
        agent_msg = agent_pb2.Agent.Message()
        agent_msg.dialogue_id = self.dialogue_id
        agent_msg.destination = self.destination
        agent_msg.content = self.msg

        envelope = agent_pb2.Envelope()
        envelope.msg_id = self.msg_id
        envelope.send_message.CopyFrom(agent_msg)
        return envelope
    def to_envelope(self):
        fipa_msg = fipa_pb2.Fipa.Message()
        fipa_msg.target = self.target
        decline = fipa_pb2.Fipa.Decline()
        fipa_msg.decline.CopyFrom(decline)
        agent_msg = agent_pb2.Agent.Message()
        agent_msg.dialogue_id = self.dialogue_id
        agent_msg.destination = self.destination
        agent_msg.fipa.CopyFrom(fipa_msg)

        envelope = agent_pb2.Envelope()
        envelope.msg_id = self.msg_id
        envelope.send_message.CopyFrom(agent_msg)
        return envelope
    def to_envelope(self) -> agent_pb2.Agent.Message:
        fipa_msg = fipa_pb2.Fipa.Message()
        fipa_msg.target = self.target
        accept = fipa_pb2.Fipa.Accept()
        fipa_msg.accept.CopyFrom(accept)
        agent_msg = agent_pb2.Agent.Message()
        agent_msg.dialogue_id = self.dialogue_id
        agent_msg.destination = self.destination
        agent_msg.fipa.CopyFrom(fipa_msg)

        envelope = agent_pb2.Envelope()
        envelope.msg_id = self.msg_id
        envelope.send_message.CopyFrom(agent_msg)
        return envelope
    def to_envelope(self) -> agent_pb2.Agent.Message:
        fipa_msg = fipa_pb2.Fipa.Message()
        fipa_msg.target = self.target
        propose = fipa_pb2.Fipa.Propose()
        if isinstance(self.proposals, bytes):
            propose.content = self.proposals
        else:
            proposals_pb = fipa_pb2.Fipa.Propose.Proposals()
            proposals_pb.objects.extend(
                [propose.to_pb() for propose in self.proposals])
            propose.proposals.CopyFrom(proposals_pb)
        fipa_msg.propose.CopyFrom(propose)
        agent_msg = agent_pb2.Agent.Message()
        agent_msg.dialogue_id = self.dialogue_id
        agent_msg.destination = self.destination
        agent_msg.fipa.CopyFrom(fipa_msg)

        envelope = agent_pb2.Envelope()
        envelope.msg_id = self.msg_id
        envelope.send_message.CopyFrom(agent_msg)
        return envelope
    def to_envelope(self) -> agent_pb2.Agent.Message:
        fipa_msg = fipa_pb2.Fipa.Message()
        fipa_msg.target = self.target
        cfp = fipa_pb2.Fipa.Cfp()

        if self.query is None:
            cfp.nothing.CopyFrom(fipa_pb2.Fipa.Cfp.Nothing())
        elif isinstance(self.query, Query):
            cfp.query.CopyFrom(self.query.to_pb())
        elif isinstance(self.query, bytes):
            cfp.content = self.query
        fipa_msg.cfp.CopyFrom(cfp)
        agent_msg = agent_pb2.Agent.Message()
        agent_msg.dialogue_id = self.dialogue_id
        agent_msg.destination = self.destination
        agent_msg.fipa.CopyFrom(fipa_msg)

        envelope = agent_pb2.Envelope()
        envelope.msg_id = self.msg_id
        envelope.send_message.CopyFrom(agent_msg)
        return envelope
 def to_envelope(self) -> agent_pb2.Envelope:
     envelope = agent_pb2.Envelope()
     envelope.msg_id = self.msg_id
     envelope.register_description.CopyFrom(
         self.agent_description.to_agent_description_pb())
     return envelope
 def to_envelope(self) -> agent_pb2.Envelope:
     envelope = agent_pb2.Envelope()
     envelope.msg_id = self.msg_id
     envelope.search_services.query.CopyFrom(self.query.to_pb())
     return envelope
 def to_envelope(self) -> agent_pb2.Envelope:
     envelope = agent_pb2.Envelope()
     envelope.msg_id = self.msg_id
     envelope.unregister_description.CopyFrom(agent_pb2.Envelope.Nothing())
     return envelope