Modules are Java classes that can be used to extend the basic functionality of ASTRA in the form of libraries / APIs. ASTRA comes with a number of standard libraries that provide commonly used sets of functionality, details of which can be found in Javadoc format here.

ASTRA is designed to make the link to Java code easy to understand. This has been achieved by viewing a library as a set of annotated methods. The context in which ASTRA can invoke the method depends upon the annontation(s) associated with that method. Currently, ASTRA supports 5 basic annotations:

  • @ACTION methods represent internal actions that can be performed, returning a boolean value indicating if the action was successfully performed.
  • @TERM methods represent basic calculations that can return a value and can be used in place of term literals.
  • @FORMULA methods create and return logical formulae in ASTRA (these can be simple boolean values or more complex formulae). The boolean formulae can be used to return the result of a comparison.
  • @SENSOR methods generate beliefs that are added to the agent’s state. Unlike the other methods, these methods cannot be directly invoked for within ASTRA code,
    instead they are invoked by the agent interpreter during the perceive stage of the interpreter cycle.
  • @EVENT methods define custom event types that can be used in the triggering event of a rule.

Throughout this section, we will build a sample ”’Calculator”’ module that makes use of all of the annotation types.