Agent Factory Eclipse Plugin

From Agent Factory

Jump to: navigation, search



This plugin provides support for the development of multi-agent systems using Agent Factory Features include:

  • Syntax Highlighting / Coloring
  • Integrated Compiler
  • Basic AF Project Template
  • Templates for non-Java file types (i.e. AOP language files)
  • Supports AFAPL2, AF-AS (AF-AgentSpeak), AF-RMA

This article will walk you through the process of creating some simple agents. For more information on the various programming frameworks available in Agent Factory, please see the Programming Guides section of the User Guides page.

Download / Installation

The plugin is compatible with Eclipse 3.5 SR1 (Galileo) and later. It can be downloaded and installed via the Eclipse Update system. Simply point Eclipse at and select the latest version of the plugin.

Getting Started

Once you have installed the plugin you are ready to develop Agent Factory based applications. No additional configuration is required you are ready to start developing Agent Factory-based applications!

The next sections will discuss the main steps necessary to use the plugin. In our explanations, we assume that you have a reasonable understanding of how Eclipse works.

Creating a Project

The first step in developing an Agent Factory application is to create an Agent Factory project. To do this select "File->New->Project..." and select "New Agent Factory Project" from the "Agent Factory" category. Click on the next button and enter a name for the project. Click "Finish" and you are done!

This results in the creation of a project that contains a single Java class entitled Main. This class specifies a standard platform configuration for an Agent Factory agent platform. Details on what this class looks like can be found in the Application Deployment Guide.

Writing a Custom Java Agent

Before we discuss how to create complex agents, lets briefly look at how to create bespoke agents in Java. To do this, you simply create a Java class using the Eclipse class wizard (i.e. "File->New->Class"). Set the name of the agent to be "HelloAgent" and the superclass to be "com.agentfactory.platform.impl.AbstractAgent"; select the "Constructors from superclass" and "Inherited abstract methods" options; and click on "Finish".

This creates a stub class containing four methods and one constructor:

  • execute(): this is called whenever the agent is scheduled for execution
  • getType(): returns a type string that is used to match the agent to an inspector / state manager / ...
  • initialise(): this method is used to pass initialisation strings to the agent when it is created
  • update(): standard update method for an Observable object (NOT USED HERE)

The constructor simply passes a given agent name to the parent class (you do not need to modify this).

To create a basic "HelloWorld" agent, simply insert a print statement into the execute() method that prints out some text together with a call to the endOfIteration() method and we are done...

public class HelloAgent extends AbstractAgent {
    public HelloAgent(String name) {

    public void execute() {
        System.out.println("Hello World!");

    public String getType() {
        // TODO Auto-generated method stub
        return null;

    public void initialise(String data) {
        // TODO Auto-generated method stub

    public void update(Observable arg0, Object arg1) {
        // TODO Auto-generated method stub

For more information on how to create custom Java agents, please see the Architecture / Interpreter Development Guide.

Deploying a Custom Java Agent

To deploy the Hello Agent specified above, you need to modify the main method to create the agent. This is typically the last step in the method and looks something like this:

AgentManagementService ams = (AgentManagementService) platform.getPlatformServiceManager().getServiceByName(AgentManagementService.NAME);
try {
    ams.createAgent("vacie", "ExampleVacBot.aspeak");
} catch (Exception ex) {

The first line of code gets a reference to the Agent Management Service (AMS) a mandatory platform service that is installed by default on all agent platforms and which provides support for the creation / termination / suspension / resumption of agents. To create our Hello Agent, simply modify the line beginning ams.createAgent(...) to look like this:

ams.createAgent("hello", HelloAgent.class);

If you then run this class the Agent Factory Debugger should load. You can use this tool to start all the agents by clicking on the start button in the toolbar. This will cause "Hello World!" to be printed repeatedly to the Java console.