Aiming at the security problems such as the existing multi-agent system is vulnerable to malicious attacks, it is difficult to verify the identity of the agent and to establish a trust mechanism between agents, this paper focuses on the multi-agent layered system architecture, and proposes a multi-agent encryption based on asymmetric encryption algorithm and digital signature. The communication method can effectively ensure the system security of the communication and prevent the agent identity from being used fraudulently. Based on the dynamic game ideas in multiple agent system assessment, using the greedy algorithm and genetic algorithm to optimize the multi-agent system security selection strategy, we effectively increase the probability of winning and shorten the rounds of gaming, ensure the security of the communication, and prevent the agent information from being eavesdropped.