CArtAgO by Examples – Jason version

This is the CArtAgO by example – Jason version. Here Jason is used as reference agent programming language, to program agents.

All the examples can be found in the examples/bridges/jason/basic folder.

The pdf version of this document can be also found from the standard CArtAgO distribution in doc/cartago_by_example.pdf or downloaded from here.

Before going with the examples, it follows a sum up of some main key point about CArtAgO (more can be found in the annotated reference):

  • Workspaces: A CArtAgO environment is given by one or multiple workspaces,
    possibly spread on multiple network nodes. Multiple workspaces can be running on the same node.
    By default each node has a default workspace. In order to work inside a
    workspace an agent must join it. By default, when booted, an agent is automatically joined to the
    default workspace. Then, the same agent can join and work simultaneously in multiple workspaces.
  • Agents’ action repertoire: By working inside a CArtAgO environment, the repertoire of an agent’s actions is determined by the set of artifacts available/usable in the workspace, in particular by the operations provided by such artifacts. There is one-to-one mapping between actions and operations: if there is an artifact providing an operation myOp, then each agent of the workspace – modulo security constraints – can perform an external action called myOp. Accordingly, by performing an external action, the action completes with success or failure if the corresponding operation completes with success or fails. Since the set of artifacts can be changed dynamically by agents (creating new artifacts, disposing existing ones), the repertoire of actions is dynamic too.
  • Default artifacts: By default, each workspace contains a basic set of predefined artifacts that provide core functionalities to the agents. In particular:
    • workspace artifact (cartago.WorkspaceArtifact): – provides functionalities to create, dispose, lookup, link, focus artifacts of the workspace. Also it provides operations to set roles and policies related to the RBAC security model.
    • node artifact (cartago.NodeArtifact) – provides functionalities to create new workspaces, to join local and remote workspaces.
    • blackboard artifact (type – provides a tuple space that agents can exploit
      to communicate and coordinate.
    • console artifact ( – provides functionalities to print messages on
      standard output.

Specific points related to the Jason$+$CArtAgO integration (whose semantics, however, should be preserved also in the other integrations, when possible):

  • Mapping observable properties and events into beliefs: by focussing an artifact, observable properties are mapped into agent’s belief base. So each time an observable property is updated, the corresponding belief is updated too. Percepts related to observable events adopt the same syntax of belief-update events (so +event(Params)), however they are not automatically mapped into the belief base.
  • Java data-binding: Java object model is used in CArtAgO as data model to represent and manipulate data structures. That means that operations’ parameters, observable properties’ and signals’ arguments are either Java’s primitive data types or objects. To work with CArtAgO, Jason’s data type has been extended to work also with objects – referenced by atoms with a specific functor — and a translation between primitive data types is applied. In the following will be described the current translation rules.
    • From CArtAgO to Jason:
      • boolean are mapped into boolean
      • int, long, float, double are mapped into doubles (NumberTerm)
      • String are mapped into String
      • null value is mapped into an unbound variable
      • arrays are mapped into lists
      • objects in general are mapped by atoms cobj_XXX that work as object reference
    • From Jason to CArtAgO:
      • boolean are mapped into boolean
      • a numeric term is mapped into the smallest type of number which is sufficient to contain the data
      • String are mapped into String objects
      • structures are mapped into String objects
      • unbound variables are mapped into output parameters (represented by the class OpFeedbackParam)
      • lists are mapped into arrays
      • atoms cobj_XXX referring to objects are mapped into the referenced objects

Jason agents do not share objects: each agent has its own object pool.

List of examples:

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>