Skip to main content

Plugin for SPADE 3 MAS platform to implement BDI Agents.

Project description

Spade-BDI

https://img.shields.io/pypi/v/spade_bdi.svg https://img.shields.io/pypi/pyversions/spade_bdi.svg MIT License Downloads Documentation Status https://img.shields.io/pypi/format/spade_bdi.svg

Create hybrid agents with a BDI layer for the SPADE MAS Platform.

Features

  • Create agents that parse and execute an ASL file written in AgentSpeak.

  • Supports Agentspeak-like BDI behaviours.

  • Add custom actions and functions.

  • Send TELL, UNTELL and ACHIEVE KQML performatives.

Examples

basic.py:

import getpass
from spade_bdi.bdi import BDIAgent

server = input("Please enter the XMPP server address: ")
password = getpass.getpass("Please enter the password: ")

a = BDIAgent("BasicAgent@" + server, password, "basic.asl")
a.start()

a.bdi.set_belief("car", "blue", "big")
a.bdi.print_beliefs()

print(a.bdi.get_belief("car"))
a.bdi.print_beliefs()

a.bdi.remove_belief("car", 'blue', "big")
a.bdi.print_beliefs()

print(a.bdi.get_beliefs())
a.bdi.set_belief("car", 'yellow')

basic.asl:

!start.

+!start <-
    +car(red);
    .a_function(3,W);
    .print("w =", W);
    literal_function(red,Y);
    .print("Y =", Y);
    .custom_action(8);
    +truck(blue).

+car(Color)
 <- .print("The car is ",Color).

Examples

basic.py:

import getpass
from spade_bdi.bdi import BDIAgent

server = input("Please enter the XMPP server address: ")
password = getpass.getpass("Please enter the password: ")

a = BDIAgent("BasicAgent@" + server, password, "basic.asl")
a.start()

a.bdi.set_belief("car", "blue", "big")
a.bdi.print_beliefs()

print(a.bdi.get_belief("car"))
a.bdi.print_beliefs()

a.bdi.remove_belief("car", 'blue', "big")
a.bdi.print_beliefs()

print(a.bdi.get_beliefs())
a.bdi.set_belief("car", 'yellow')

basic.asl:

!start.

+!start <-
    +car(red);
    .a_function(3,W);
    .print("w =", W);
    literal_function(red,Y);
    .print("Y =", Y);
    .custom_action(8);
    +truck(blue).

+car(Color)
 <- .print("The car is ",Color).

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.3.2 (2025-03-01)

  • Updated to SPADE 4.0.1

  • Updated dependencies

  • License changed to MIT

0.3.1 (2024-01-06)

  • Added new examples

  • Added documentation

  • Updated to SPADE 3.3.2

0.3.0 (2023-06-13)

  • Updated to SPADE 3.3.0.

0.2.2 (2022-06-03)

  • Added exception when belief is not initialized.

  • Improved examples.

  • Improved documentation.

0.2.1 (2020-04-13)

  • Fixed a bug when updating beliefs.

  • Upgraded spade version to 3.1.4.

0.2.0 (2020-02-24)

  • Created add_custom_actions method.

  • Added example for actions.

  • Improved documentation.

  • Added some helpers like pause_bdi, resume_bdi.

  • Now the asl file in the constructor is mandatory.

0.1.4 (2019-07-10)

  • Allow to send messages to JIDs stored as beliefs.

0.1.3 (2019-07-08)

  • Allow .send to a list of receivers.

  • Allow to receive messages with lists of lists.

  • Fixed readme.

0.1.1 (2019-06-18)

  • Moved from pyson to python-agentspeak

  • Added some helpers like pause_bdi, resume_bdi.

  • Now the asl file in the constructor is mandatory.

  • Allow to send tell messages with no args.

  • Allow sending messages with variables.

  • Extended the examples.

0.1.0 (2019-03-09)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spade_bdi-0.3.2.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

spade_bdi-0.3.2-py2.py3-none-any.whl (7.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file spade_bdi-0.3.2.tar.gz.

File metadata

  • Download URL: spade_bdi-0.3.2.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.7

File hashes

Hashes for spade_bdi-0.3.2.tar.gz
Algorithm Hash digest
SHA256 5d03661425f78771e39f3592f8a602ff8240465682b79d333926d3e562657d81
MD5 7571d288740f0f1c3d5262f5455e6ab6
BLAKE2b-256 16b4d52d9d06ad17d4b3a90ca11b64a14194f3f944f561f4da1395ce3fe3994d

See more details on using hashes here.

File details

Details for the file spade_bdi-0.3.2-py2.py3-none-any.whl.

File metadata

  • Download URL: spade_bdi-0.3.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.7

File hashes

Hashes for spade_bdi-0.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2039271f586b108660a0a6a951d9ec815197caf14915317c6eec19ff496c2cff
MD5 bc556c28bcdfe6dde544cc9a7124a224
BLAKE2b-256 90c2986de9abaad805d92a33912ab06b08bb81bd404bcef9ad0f2fd7a09f274b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page