PHPackages                             kkphoenix/panteao - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kkphoenix/panteao

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kkphoenix/panteao
=================

PHP client SDK for Panteao BDI Coprocessor

v1.1.17(yesterday)05↑2900%JavaPHP &gt;=7.4CI passing

Since Jul 1Pushed yesterdayCompare

[ Source](https://github.com/kkphoenixgx/aop-globalization)[ Packagist](https://packagist.org/packages/kkphoenix/panteao)[ RSS](/packages/kkphoenix-panteao/feed)WikiDiscussions main Synced today

READMEChangelog (10)DependenciesVersions (2)Used By (0)

Panteão BDI - MAS Globalization
===============================

[](#panteão-bdi---mas-globalization)

Panteão is a framework that envelops the Jason interpreter, that decouples BDI cognitive logic. The big difference of this framework is the always native support to JaCaMo, we are not recreating the wheel, we are just exposing this World to everyone. This framework just envelops, solve envelop problems and create enviromet solutions. The BDI cognitive cycle runs in a dedicated engine process while applications communicate with the agents using the Panteao SDK for their language.

Running the Engine
------------------

[](#running-the-engine)

The engine can be executed either programmatically using the package library of your language or as a standalone process from the terminal.

### Standalone Executable

[](#standalone-executable)

The core BDI interpreter can be started from the command line using the compiled executable binary:

```
bin/panteao-engine  --port
```

Parameters:

- Path to the JaCaMo project file (.jcm).
- Port number to listen for incoming application connections.

### Programmatic Integration

[](#programmatic-integration)

For applications that embed the BDI interpreter directly inside their codebase, the library wrappers spawn and manage the background engine process lifecycle automatically when the engine instance is initialized. This enables programmatic control of the engine startup, shutdown, and event mapping.

Writing Agent Code
------------------

[](#writing-agent-code)

The BDI architecture is configured through JaCaMo files and AgentSpeak plans.

### JaCaMo Project File

[](#jacamo-project-file)

With this framework, I separated Cartago from Jason and Moise, the environment is your system!

Define the Multi-Agent System configuration (ex: `project.jcm`):

```
mas operacao_diluvio {
    agent orquestrador : orquestrador.asl

    // Moise organization configuration
    org rescue_org : organization.xml
}

```

### AgentSpeak File

[](#agentspeak-file)

Define beliefs, plans, and actions for your agents (ex: `orquestrador.asl`):

```
{ include("$moise/asl/org-rules.asl") }

+temperature(Local, T) : T > 30  void) => void``Panteao` / `Panteão`Main client class alias (also exported as `BdiClient`)#### Connection Client

[](#connection-client-1)

```
import { Panteao } from 'panteao-ts';

// Spawns the native binary automatically
const engine = new Panteao({ project: './project.jcm' });
await engine.connect();

engine.registerAction('turn_on_ac', (args: string[], respond: (success: boolean) => void) => {
    console.log("Action received! Turning on AC.");
    engine.sendMsg('tell', 'sensor', 'bob', 'ac_status(on)');
    respond(true); // Action successful
});

engine.sendMsg('tell', 'sensor', 'bob', 'temperature(room_1, 35)');
```

### Rust

[](#rust)

Add the dependency to Cargo.toml:

```
[dependencies]
panteao = "1.0"
```

Boilerplate code:

```
use panteao::Panteao;

fn main() {
    let mut engine = Panteao::new("127.0.0.1:0");
    engine.connect().unwrap();

    engine.registerAction("turn_on_ac", |sender, receiver, content| {
        print("Action received! Turning on AC.");
        engine.send_msg("tell", "sensor", sender, "ac_status(on)").unwrap();
    });

    engine.send_msg("tell", "sensor", "bob", "temperature(room_1, 35)").unwrap();
    engine.wait();
}
```

### Java

[](#java)

Add the dependency:

```

    br.com.kkphoenix.jason.ipc
    panteao-sdk
    1.0

```

Boilerplate code:

```
import br.com.kkphoenix.jason.ipc.sdk.Panteao;

public class Main {
    public static void main(String[] args) throws Exception {
        Panteao engine = new Panteao("127.0.0.1", 0);
        engine.connect();

        engine.registerAction("turn_on_ac", (sender, receiver, content) -> {
            System.out.print("Action received! Turning on AC.");
            engine.sendMsg("tell", "sensor", sender, "ac_status(on)");
        });

        engine.sendMsg("tell", "sensor", "bob", "temperature(room_1, 35)");
    }
}
```

### Kotlin

[](#kotlin)

Add the dependency:

```
implementation("br.com.kkphoenix.jason.ipc:panteao-sdk:1.0")
```

Boilerplate code:

```
import br.com.kkphoenix.jason.ipc.sdk.Panteao

fun main() {
    val engine = Panteao("127.0.0.1", 0)
    engine.connect()

    engine.registerAction("turn_on_ac") { sender, receiver, content ->
        print("Action received! Turning on AC.");
        engine.sendMsg("tell", "sensor", sender, "ac_status(on)")
    }

    engine.sendMsg("tell", "sensor", "bob", "temperature(room_1, 35)")
}
```

### Scala

[](#scala)

Add the dependency:

```
libraryDependencies += "br.com.kkphoenix.jason.ipc" % "panteao-sdk" % "1.0"
```

Boilerplate code:

```
import br.com.kkphoenix.jason.ipc.sdk.Panteao

object Main extends App {
  val engine = new Panteao("127.0.0.1", 0)
  engine.connect()

  engine.registerAction("turn_on_ac", (sender, receiver, content) => {
    print("Action received! Turning on AC.");
    engine.sendMsg("tell", "sensor", sender, "ac_status(on)")
  })

  engine.sendMsg("tell", "sensor", "bob", "temperature(room_1, 35)")
}
```

### C

[](#c)

Link the library:

```
gcc main.c -lpanteao -o main
```

Boilerplate code:

```
#include
#include

void turn_on_ac(const char* sender, const char* receiver, const char* content) {
    print("Action received! Turning on AC.");
    panteao_send_msg(engine, "tell", "sensor", sender, "ac_status(on)");
}

int main() {
    panteao_t* engine = panteao_create("127.0.0.1", 0);
    panteao_connect(engine);

    panteao_registerAction(engine, "turn_on_ac", turn_on_ac);
    panteao_send_msg(engine, "tell", "sensor", "bob", "temperature(room_1, 35)");
    panteao_wait(engine);
    return 0;
}
```

### C++

[](#c-1)

Download the SDK tarball from GitHub Releases or include the repository in your project.

Link the library in your `CMakeLists.txt`:

```
add_subdirectory(panteao-sdk)
target_link_libraries(your_app panteao_client_cpp)
```

Boilerplate code:

```
#include "panteao_client.h"
#include
#include
#include

int main() {
    panteao::Panteao engine;

    // Spawns the native binary automatically
    engine.connect("127.0.0.1", 0, "./project.jcm");

    engine.registerAction("turn_on_ac", [&engine](const std::vector& args, std::function respond) {
        std::cout  {
            Console.WriteLine("Action received! Turning on AC.");
            engine.SendMsg("tell", "sensor", "bob", "ac_status(on)");
            respond(true); // Action successful
        });

        engine.SendMsg("tell", "sensor", "bob", "temperature(room_1, 35)");

        // Block until the process is interrupted
        engine.Wait();
    }
}
```

### Dart

[](#dart)

Add the package:

```
dart pub add panteao
```

Boilerplate code:

```
import 'package:panteao/panteao.dart';

void main() async {
  final engine = Panteao(host: '127.0.0.1', port: 0, project: './project.jcm');
  await engine.connect();

  engine.registerAction('turn_on_ac', (args, respond) {
    print("Action received! Turning on AC.");
    engine.sendMsg('tell', 'sensor', 'bob', 'ac_status(on)');
    respond(true);
  });

  await engine.wait();
}
```

### PHP

[](#php)

Install the package:

```
composer require kkphoenix/panteao
```

Boilerplate code:

```
