Chapter 2. Starting an Agent

2.1. Exercise A1 - Jadex Platform

Setting up the Jadex environment properly is pretty easy and can be done in a few simple steps. Generally, Jadex is realized as reasoning engine meaning that it can be used on top of different (agent) middlewares. In this tutorial we will use the Standalone version of Jadex. The Jadex distribution should be extracted to some local directory, called JADEX_HOME here.

Set the Java CLASSPATH variable properly by adding the following jars: 

The actual filenames of the jar files may differ slightly due to versioning conventions.

Necessary libraries for the Jadex kernel: 

  • JADEX_HOME/lib/jadex_rt.jar

  • JADEX_HOME/lib/jibx-run.jar

  • JADEX_HOME/lib/xpp3.jar

Necessary libraries for the Jadex Standalone platform: 

  • JADEX_HOME/lib/jadex_standalone.jar

Necessary libraries for the Jadex tools: 

  • JADEX_HOME/lib/jadex_tools.jar

  • JADEX_HOME/lib/GraphLayout.jar

  • JADEX_HOME/lib/jhall.jar

The command for launching the Jadex Standalone platform is:

java [conf=<platform.properties>] jadex.adapter.standalone.Platform

If the configuration file is not specified, the default configuration (jadex.properties) will be read from the root directory of the jadex_standalone.jar.

Create a simple Jadex agent.  Open a source code editor or an IDE of your choice and create a new agent definition file (ADF) called TranslationA1.agent.xml (cf. Figure 2.1, “A1 XML ADF”). We recommend using eclipse with web-tools plug-in for editing ADFs or the commercial application Altova XMSpy. In this file all important agent startup properties are defined in a way that complies to the Jadex schema specification. First property of the agent is its type name which must be the same as the file name (similar to Java class files), in this case it is set to TranslationA1. Additionally you can specify a package attribute, which has a similar meaning as in Java programs and serves for grouping purposes only (you will need to alter the package name with respect to your actually used directory structure). All plans and other Java classes from the agent's package are automatically known and need not to be imported via an import tag.

  1 <!--
  2     TranslationAgent
  3 -->
  4 <agent xmlns="http://jadex.sourceforge.net/jadex"
  5     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  6     xsi:schemaLocation="http://jadex.sourceforge.net/jadex
  7                         http://jadex.sourceforge.net/jadex-0.94.xsd"
  8     name="TranslationA1"
  9     package="jadex.tutorial">
 10 </agent>        	

Figure 2.1. A1 XML ADF

Start your first Jadex agent.  Start the Jadex platform with the command explained above. After some short time the Jadex ControlCenter should show up with its user intferace. Within the "Start Agents" panel browse the directories and select your TranslationA1.agent.xml. The effect of choosing the input file is, that the agent model is loaded. When it contains no errors, the description of the model, taken from the XML comment above the agent tag, is shown in the description view. In case there are errors in the model, correct the errors shown in the description view and press “reload”. Below the file name, the agent name and its default configuration are shown. It is possible to add additional comma separated arguments in the arguments input field, if this is desired. After pressing the start button the new agent should appear in the agent tree. Curiously, you can start a second JCC by choosing it from: ../extensions/tools/runtimetools/src/jadex/tools/jcc/JCC.agent.xml and giving it a name like JCC2.