Skip to main content

All the examples

The JaKtA repository ships runnable examples in the examples folder. Clone it and run them with Gradle:

git clone https://github.com/jakta-bdi/jakta.git
cd jakta
./gradlew :examples:hello-world:run

Replace hello-world with the name of any example below. The examples with a user interface use Compose Multiplatform and also run in the browser with ./gradlew :examples:<name>:jsBrowserDevelopmentRun.

ExampleDescription
hello-worldA single agent with one goal and one plan that prints a message and stops the node. See Basic: Hello world.
ping-pongTwo agents on two nodes exchanging messages turned into beliefs. See Intermediate: Ping-pong agents and Create a JaKtA Multi-Agent System.
thermostat (with UI)A thermostat keeping a changing room at its target temperature through perceptions, a skill and guarded plans. See Advanced: Thermostat and Connect agents to an external environment.
blocksworld (with UI)An agent building towers of blocks with Prolog inference rules, recursive sub-goals and custom skills. See Blocks World, Skills and Beliefs.
tictactoe (with UI)A tic-tac-toe player whose Prolog rules and plans are generated in Kotlin for any board size. See Tic-tac-toe and Turn perceptions into Prolog facts.
vacuum-world (with UI)One to four embodied robots that keep a map clean forever. See Vacuum World, Give agents a body and Turn perceptions into Prolog facts.
contract-net (with UI)A waiter giving each order to the chef that can cook it the soonest, with a contract net of KQML messages among agents on their own nodes. See Contract Net and KQML Messaging.
runtime-agentsAdding and removing agents while the MAS runs. See Add and remove agents at runtime.
sub-goalsA barista achieving sub-goals, getting their results, starting a concurrent intention and recovering from a failed sub-goal. See Achieve sub-goals and recover from failures.
wait-for-eventsWaiting for an event, with a timeout, while another intention makes it happen. See Wait for events and use time.
alchemist-ping-pongAlice and Bob playing ping-pong from two devices of an Alchemist simulation, in simulated time, shown in Alchemist's viewer. See Simulate a MAS with Alchemist.
custom-incarnationPlain numbers as beliefs and goals: an agent following the Collatz sequence until it loops, and a prime sieve. See Write your own incarnation.

Dig deeper in the unit tests​

If you want to have a look, there are less polished, minimal examples in the unit tests of jakta-core, jakta-prolog-incarnation and alchemist-jakta-incarnation.