Getting Started
- Java 17+
- Kotlin 2.4+: the DSL relies on context parameters
- Gradle
Set up a project
Create a Kotlin application with Gradle:
mkdir jakta-project
cd jakta-project
gradle init --type kotlin-application --dsl kotlin --use-defaults
Gradle creates the application in the app folder, with its code in app/src/main/kotlin/org/example/App.kt.
Check that the Kotlin version in gradle/libs.versions.toml is 2.4 or later: older versions cannot compile the DSL.
JaKtA is published on Maven Central under the group it.unibo.jakta.
Add its three core modules to app/build.gradle.kts, together with Kotlin coroutines,
on which agents run, and Kermit, which controls the engine's logs:
- Kotlin/JVM
- Kotlin Multiplatform
repositories {
mavenCentral()
}
dependencies {
implementation("it.unibo.jakta:jakta-api:<VERSION>")
implementation("it.unibo.jakta:jakta-dsl:<VERSION>")
implementation("it.unibo.jakta:jakta-core:<VERSION>")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0")
implementation("co.touchlab:kermit:2.2.0")
}
repositories {
mavenCentral()
}
kotlin {
sourceSets {
commonMain.dependencies {
implementation("it.unibo.jakta:jakta-api:<VERSION>")
implementation("it.unibo.jakta:jakta-dsl:<VERSION>")
implementation("it.unibo.jakta:jakta-core:<VERSION>")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0")
implementation("co.touchlab:kermit:2.2.0")
}
}
}
These modules support the JVM, JavaScript and native targets (Linux, Windows, macOS, iOS).
They are also published on npm under the @jakta organization.
Replace <VERSION> with the latest version, from Maven Central
or the release notes.
What the three modules contain
jakta-api holds the contracts (agents, events, plans, nodes), jakta-dsl the DSL, and jakta-core the engine
and the DSL entry points (mas, node, agent). See Modules for the details.
You are ready to write your first agent.
Incarnations
With jakta-core alone, beliefs and goals can be any Kotlin type, and plans match them with Kotlin code:
the tutorials use plain strings and data classes.
An incarnation fixes those types and extends the DSL with syntax for them.
The Prolog incarnation makes beliefs and goals Prolog terms,
matches plans by unification and adds KQML messaging, as in Jason.
It brings jakta-api and jakta-dsl with it, so it only needs jakta-core next to it:
dependencies {
implementation("it.unibo.jakta:jakta-core:<VERSION>")
implementation("it.unibo.jakta:jakta-prolog-incarnation:<VERSION>")
}
It runs on the JVM and JavaScript.
The Prolog incarnation template is a project already set up with it.
The string incarnation is the smallest one, and you can also write your own.
Next steps
The three tutorials build on each other, with plain Kotlin types and no incarnation:
- Basic: Hello world, a single agent with one goal and one plan;
- Intermediate: Ping-pong agents, two agents on two nodes exchanging messages;
- Advanced: Thermostat, an agent perceiving and acting on an external environment that keeps changing.
To see complete systems instead, try the showcase in your browser, or run all the examples from the JaKtA repository.