Setting up an agent project using Git and Maven

A GIT repository containing an example TAC/AA agent project is provided here.

The project uses Maven for a management tool. Maven will automatically track the TAC/AA dependencies from the TAC/AA repository. This HOWTO describes

  • Getting started
  • Configuring the POM
  • Editing your agent
  • Configuring your agent
  • Running your agent in an IDE
  • Assembling and running your agent

Getting started

Clone the Example Agent repository with the following command:

  git clone http://www.eecs.umich.edu/~prjordan/git/tac-aa/agents/example_agent.git

If all went well, a local directory example_agent is created. The example_agent should contain one file (pom.xml) and one directory (src).

Configuring the POM

Edit the groupId, artifactId, and name elements. Optionally, edit the version and url elements.

    ...
    <groupId>YOUR.GROUP.ID</groupId>
    <artifactId>YOUR-AGENT-NAME</artifactId>
    ...
    <version>YOUR.VERSION</version>
    <name>YOUR AGENT NAME</name>
    <url>http://www.team.url/path/to/agent/description</url>
    ...

The TAC/AA dependencies (tasim, aa-common, and aa-agent) should already be included in the dependencies section as well as JUnit. In order to pull the dependencies from the
TAC/AA repository you need to add the TAC/AA repository to the you pom:

    ...
    <repositories>
      <repository>
        <id>tac-aa-repository</id>
        <url>http://www.eecs.umich.edu/~prjordan/tac-aa/repository</url>
      </repository>
    </repositories>
    ...

Editing your agent

Included in the project is an ExampleAgent class. It is located under the src/main/java directory, with path

edu/umich/eecs/tac/aa/agents/example/ExampleAgent.java

You can use this agent as a base for developing your own agent. See the tutorial A Basic Agent for further information on the basics of writing an agent.

Configuring your agent

Included in the project, under the src/main/assembly/resources/config/ directory, is an file named aw.conf. This is the agent configuration file and is used to specify, amongst other things, the class implementation for your agent. The most important parameters of the file are the agentName, agentPassword, agentImpl, and serverHost parameters. The name and password should be with respect to the server you point your agent at for running simulations. The agentImpl parameter should specify the implementation class of your agent.

Running your agent in an IDE

To configure your project for IDEA use

mvn idea:idea

To configure your project for Eclipse use

mvn eclipse:eclipse

To run your agent within the IDE, specify the working directory as

src/main/assembly/resources

And the main class as

edu.umich.eecs.tac.aa.agentware.Main

With parameters

-config/aw.conf

Make sure the agentImpl parameter in the aw.conf file is set correctly for your agent.

Assembling and running your agent

When you are ready to create a deployable version of your agent, issue

mvn assembly:assembly

This will create an archive of your agent in the target directory:

target/${artifactId}-${version}-bin.tar.gz

where ${artifactId} and ${version} the values you specified in the POM configuration. The extracted archive contains two files and two directories. Of the two files, README.txt and run-agent, the run-agent file is a shell script with which you can run your agent from the command line using

sh ./run-agent

The lib and config directories contain the requisite JAR files and the configuration files, respectively.