Skip to content


All the examples presented here are available and executable in the start-jade project.

Jade offers several types of behaviours to develop your agents. You can add/remove one or several behaviour(s) to your agent to change its capabilities.

  • Classical behaviours : Simple, One-shot/Waker and Cyclic/Ticker
  • Advanced behaviours : Sequential, FSM and Parallel ones
  • Multi-threaded behaviours : Threaded version of the previous ones.

All of them contain an action() method that will be automatically called when the behaviour is given the possibility to execute.

Classical behaviours

Classical behaviours are variations around the simpleBehaviour class.

With the action() method comes a done() method. The implementation of done() is what will create a difference between classical behaviours.

Simple behaviour

done() is automatically called after each execution of the action() method of the behaviour. If done() return true, the behaviour is removed from the list of behaviour the agent possess. While done() returns false, the associated behaviour stays in the list of the triggerable behaviours of the agent.

Simple behaviour

One-shot and Cyclic behaviours

  • A one-shot behaviour is a specialised version of simple-behaviour where done() is not available and always returns true. It is thus executed only once before beeing removed.
  • A cyclic behaviour, on the contrary, is a non-terminable behaviour with done() always returning false.

One-shot and Cyclic behaviours

Waker and Ticker behaviours

Waker and Ticker are the temporised versions of the one-shot and cyclic behaviours.

  • A waker starts only after k ms (a constructor parameter) and executes only once
  • A ticker behaviour will execute itself indefinitely with a minimum periodicity of k ms.

Waker and Ticker behaviours

Advanced behaviour

Any behaviour can be dynamically added to an agent. It it thus possible to ordonate the availability of several behaviours within an agent over time by adding/removing them at the right moment.

The code can neverthess become quite difficult to develop, read and maintain if you do that at a large scale. Advanced behaviours help you to organise your code in this context.

Sequential behaviour

Through the use of subBehaviours, it allows to easily sequence several behaviours

Sequential behaviour

Finite State Machine behaviour

Automata are one of the most efficient way to develop complex behaviours. You just need to define the states, their associated behaviours, and the transitions conditions.

Fsm behaviour

Fsm behaviour

Parallel behaviour

Be careful, the name "Parallel behaviour" is misleading. Jade's parallel behaviour does NOT allow to execute different behaviours in different threads.

There is still only one thread that control the agent's behaviours.

The idea behind what Jade's dev called a parallel behaviour is a behaviour composed of a set of sub-behaviours trigerable at the same time (as when you add several behaviours to your agent) but the main behaviour can be instructed to terminate when :

  • ALL of its sub-behaviours have completed or,
  • ANY sub-behaviour completes

Multi-threaded behaviour

By default, 1 agent = 1 thread.

But you can decide to let your behaviours live in their own threads if they, for example, execute a long and blocking task (gui,computation,..)

When adding your behaviour to your agent, you only need to wrap() it through the use of a ThreadedBehaviourFactory()

See the source-code for the associated example

All these examples are extracted from this Jade's Introduction and are available here.