EIS

From Agent Factory

Jump to: navigation, search

Contents

Introduction

The Environment Interface Standard (EIS) is a recently proposed standard for implementing environments. The key benefit of EIS is the standardisation of how agent platforms and architectures can be connected to environments. This allows for different agent platforms to be integrated with the same set of environments which facilitates comparisons between different agent programming models.

Agent Factory Standard Edition (AFSE) has been integrated with EIS through the creation of 3 components:

  1. A Platform Service that wraps the EIS APIs and enables and AFSE agent to interact with the environment.
  2. A set of modules that implement APIs for Common Language Framework-based agent programming languages such as AFAPL, AF-AgentSpeak, and AF-TeleoReactive.
  3. A specially designed management agent that monitors and controls both the environment and the multi-agent system that is connected to that environment.

The next sections explore each of these components in more detail.

The EIS Platform Service

The EIS Platform Service is the core component of the EIS-support for AFSE. The service implements an interface to the EIS-APIs which makes EIS functionality available to agents. Through this service, EIS support is provided for any agent programming language or architecture build using AFSE.

The key functions of this service are outlined below:

Setup functions:

  • setup(String jarFile): Configures the service and links it to the environment implemented within the specified JAR file (this is a path to the jar file).
  • registerAgent(String name): Registers the agent with the environment, and internally configures the service with necessary support for the agent.
  • unregisterAgent(String name): Deregisters the agent from the environment and removes any additional support provided by the EIS service.

Environment Management Functions:

  • hasEnvironmentEvent(): Returns true if the environment event queue is not empty.
  • getNextEnvironmentEvent(): Returns the next environment event (if one exists).

Entity Management Functions:

  • getFreeEntities(): Returns a list of free entities residing in the environment.
  • associateEntity(String name, String entity): Links the agent to an entity in the environment.
  • queryEntityType(String entity): Links the agent to an entity in the environment.

Agent Level Functions:

  • performAction(IAgent agent, Action action): Send the specified action to the entity associated with the agent.
  • getPercepts(IAgent agent): Return the current perceptions of the entity associated with the agent.
  • getAgentEvents(IAgent agent): Return any agent events that have occurred since the last time this method was called.

The EIS APIs

Libraries / APIs have been developed to support programming agents that use EIS Environments. For Common Language Framework based languages, support is provided via the following libraries:

The EIS Manager Agent

The default use of the EIS Management API is as part of the EIS Management Agent. This agent is responsible for configuring and monitoring the attached EIS environment. Typically, it is expected that any EIS user will not need to modify this agent, but instead, they will simply use it as part of their deployment. In this section, we give the code for this agent. We do so for two reasons: so that the operation of this agent is well understood, and so as to illustrate how the EIS Manager API is used in practice.

#agent EnvironmentManager

module ams -> com.agentfactory.clf.library.AMSLibrary;
module eis -> com.agentfactory.eis.EISManagerModule;

+initialized : environment(?pid, ?jarfile) <-
    ams.setup,
    ?params = [],
    if (parameter(?x)) ?params = list[ ?x | parameter(?x) ]
    eis.setup(?pid, ?jarfile, ?params),
    eis.getFreeEntities;
	
+eisState(paused) : ~eis(paused) & eisSupports(start) <-
    eis.start;

+newEntity(?entity) : ~design(?entity, ?design) <-
    eis.getEntityType(?entity),
    foreach(entityType(?entity, ?entityType) & design(?entityType, ?design)) {
        ams.create(?entity, ?design),
        ams.resume(?entity)
    };
	
+newEntity(?entity) : design(?entity, ?design) <-
    ams.create(?entity, ?design),
    ams.resume(?entity);

+freeEntity(?entity) : ~design(?entity, ?design) <-
    eis.getEntityType(?entity),
    foreach(entityType(?entity, ?entityType) & design(?entityType, ?design)) {
        ams.create(?entity, ?design),
        ams.resume(?entity)
    };

+freeEntity(?entity) : design(?entity, ?design) <-
    ams.create(?entity, ?design),
    ams.resume(?entity);

The main responsibilities of this agent are:

  • To configure the EIS Service for the relevant environment.
  • To create the agents that will control the entities present in the environment.

The former of these responsibilities is handled via the initial rule, which simply sets up the EIS Manager API and the AMS API, and then queries the environment for any free entities.

The second responsibility involves creating agents to control any of the free entities identified by the free entities query, and also creating agents for any entities that are created as the environment evolves. In reality, these options represent two possible design strategies for developers of EIS environments, and so, must both be supported to ensure compliance.

The creation of agents to control free entities is further complicated by the typing system employed by EIS. This feature of EIS associates a string type with every entity. The manager agent is able to use the EIS Manager API to query the environment as to the entities type. Again, some environments specify types for entities, while others do not (EIS best practice seems to be that you should, but this is not enforced). As a result, the EIS Management Agent must be able to create entities either by name or by type.

The result of this is that there are 4 rules devoted to creating agents to control entities: 2 rules for dealing with free entities, and 2 rules for dealing with new entities. For both cases, one rule deals with creating agents based on the entity name, and one rule deals with creating agents based on the entity design. The rules dealing with the entity by name are written before those dealing with entity type as this gives precedence to name based mappings over type based mappings.

Debugging and Deploying EIS-based Applications

To use the above agent, you must modify your run configuration to add the agent and give the agent initial beliefs relating to the entities you want to create:

import com.agentfactory.agentspeak.interpreter.AgentSpeakArchitectureFactory;
import com.agentfactory.agentspeak.debugger.AgentSpeakStateManagerFactory;
import com.agentfactory.agentspeak.debugger.inspector.AgentSpeakInspectorFactory;
import com.agentfactory.visualiser.DebuggerRunConfiguration;

public class Main {
    public static class MyConfig extends DebuggerRunConfiguration {
        public String getName() {
            return "helloworld";
        }

        public String getDomain() {
            return "ucd.ie";
        }

        public void configure() {
            addLanguageSupport(new AgentSpeakInspectorFactory(), new AgentSpeakStateManagerFactory());
            super.configure();
            addArchitectureFactory(new AgentSpeakArchitectureFactory());

            addPlatformService(EISService.class, "eis");
 
            addAgent("manager", "com/agentfactory/eis/EnvironmentManager.aspeak");
            initAgent("manager", "environment(eis, \"vacworld.jar\")");
            initAgent("manager", "design(vacbot, \"VacBot.aspeak\")");
        }
    }

    public static void main(String[] args) {
        new MyConfig().configure();
    }
}

In the above example, we create a manager that will be linked to the VacWorld environment and associate any entity of type "vacbot" with the "VacBot.aspeak" agent program. It is also possible to define entity names here, in which case a specific entity will be associated with a specific agent program.

UCD Developed EIS Environments