AI Agents In Java

vishalmysore - Sep 15 - - Dev Community

There is lots of excitement around building Multi Agent AI systems. As we explore this area, it’s important to look at some key standards that define how agents should behave and collaborate:

IEEE P7001: Addresses transparency in autonomous systems, ensuring AI agents act in ways that can be explained and understood by humans.
IEEE P2801: Provides quality management for datasets used in medical AI, which can be critical for AI agents in healthcare.
IEEE P2874:Aims to standardize communication protocols for AI agents to ensure they can interact effectively.
FIPA: Foundation for Intelligent Physical Agents
These standards guide the behavior, communication, and coordination of agents, ensuring they can work in harmony.

Code for this article is here

But why are standards so important? Imagine a world where everyone is building agents, but they lack a common language or protocol to communicate with each other. This lack of interoperability would render even the most advanced systems ineffective.

Image description

To give a simple example did you know same as IEEE even USB connection standards are published by a non profit called USB-IF , several companies originally collaborated to create the USB standard in the mid-1990s to simplify connections between computers and peripherals like keyboards, mice, printers, and storage devices.

Producers (Manufacturers): Companies that make smartphones, laptops, or other electronic devices follow the USB standard (e.g., USB Type-A, USB Type-C) when designing charging ports in their devices.
Consumers (Users): Consumers buy USB charging cables that adhere to the same USB standard to charge their devices.
Both parties follow the published USB standard, ensuring that any USB cable will work with any device that supports the corresponding USB port, making it simple and convenient for users to charge or connect devices.

In the same way, these AI standards help create a world where agents can understand, communicate, and collaborate efficiently, unlocking the full potential of multi-agent systems.

Image description

In my first FIPA article I covered some of the basic agents using Jade and Toosl4AI.

FIPA provides ACL which is basically Agent Communication Language , consists of following commands.

INFORM: Used when an agent informs another agent of something. The sender believes the content to be true.
REQUEST: Used when an agent requests another agent to perform some action.
QUERY_IF and QUERY_REF: Used when an agent asks another agent whether something is true (QUERY_IF) or to provide an object that is referred to in the content (QUERY_REF).
CONFIRM: Used when an agent tells another agent that something is true, and the sender previously thought that the receiver didn’t know it.
DISCONFIRM: The opposite of CONFIRM, used when an agent tells another agent that something is false, and the sender previously thought that the receiver didn’t know it.
PROPOSE: Used when an agent proposes to another agent that a certain action is performed.
AGREE: Used when an agent communicates that it agrees to perform some action.
REFUSE: Used when an agent communicates that it won’t perform a certain action.
FAILURE: Used when an agent communicates that a certain action has failed.
INFORM_IF: Used when an agent informs another agent whether something is true.
INFORM_REF: Used when an agent informs another agent of an object referred to in the content.

FIPA has developed several specifications and standards in various areas of multi-agent systems. Apart from ACL (Agent Communication Language) and Behaviour which we saw in previous article, other areas of FIPA include:

Agent Management: This includes the Agent Management System (AMS), which is responsible for the management of agents’ life cycles, and the Directory Facilitator (DF), which is a yellow-pages service for agents to advertise and discover services.
Interaction Protocols: These are standard patterns of interaction that agents can use to communicate. Examples include Contract Net, which is used for task distribution, and the FIPA Request and Query interaction potocols.
Ontologies: FIPA has standards for representing ontologies, which are explicit specifications of a conceptualization. Ontologies provide a shared vocabulary for agents to communicate about specific domains.
Content Languages: These are languages used to represent the content of messages. FIPA has standards for several content languages, including FIPA SL (Semantic Language) and FIPA RDF (Resource Description Framework).
Transport Protocols: FIPA has standards for several transport protocols that can be used for agent communication, including HTTP, IIOP, and JMS.
Agent Software Integration: FIPA has developed standards for integrating agent software with other types of software, including standards for agent wrappers and for agent communication with software components.
Agent Security: FIPA has also developed standards related to agent security, including a model for secure message transport and a model for agent authentication.

In this article, I will explore the development of a multi-agent AI system based on the Foundation for Intelligent Physical Agents (FIPA) standards. The system comprises multiple AI agents that interact with each other, specifically, a Gemini agent that communicates with two other AI agents.

The Gemini agent sends questions to the other agents, receives their responses, and then scores the answers to determine the best one. The system is built using the Java Agent DEvelopment Framework (JADE), which provides a middleware for the development and runtime execution of software agents. JADE is fully compliant with the FIPA specifications for inter-agent communication, making it an ideal choice for this project.

The Gemini agent uses the GeminiV2ActionProcessor to generate questions. These questions are sent to the other two AI agents, OpenAiAgent and OpenAiAgent2, as ACLMessage.INFORM messages.

Both agents are designed to receive the question, process it using their respective OpenAiActionProcessor, and send back their responses. The Gemini agent receives the responses from both AI agents and uses the GeminiV2ActionProcessor to judge the answers. The processor is queried with the original question and the responses from both agents. The processor then determines which response is the best and returns the name of the agent that provided it.

This system demonstrates the power of multi-agent systems and the use of FIPA standards for inter-agent communication. It showcases how different AI systems can interact with each other to solve problems and make decisions. The scoring mechanism adds a competitive element, encouraging the development of AI agents that can provide better and more accurate responses.

The system is designed to be flexible and scalable. Additional AI agents can be added to the system, and the Gemini agent can be modified to send questions to these new agents. This makes the system adaptable to a wide range of scenarios and applications. In conclusion, this project illustrates the potential of multi-agent systems in AI development. By leveraging FIPA standards and the JADE framework, we can create complex systems where multiple AI agents interact and collaborate to solve problems.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .