Skip to main content

Spade-BDI

https://img.shields.io/pypi/v/spade_bdi.svg https://img.shields.io/travis/sfp932705/spade_bdi.svg Documentation Status

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.

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

Examples

basic.py:

import argparse
from spade_bdi.bdi import BDIAgent

parser = argparse.ArgumentParser(description='spade bdi master-server example')
parser.add_argument('--server', type=str, default="localhost", help='XMPP server address.')
parser.add_argument('--password', type=str, default="bdipassword", help='XMPP password for the agents.')
args = parser.parse_args()

a = BDIAgent("BasicAgent@" + args.server, args.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 argparse
from spade_bdi.bdi import BDIAgent

parser = argparse.ArgumentParser(description='spade bdi master-server example')
parser.add_argument('--server', type=str, default="localhost", help='XMPP server address.')
parser.add_argument('--password', type=str, default="bdipassword", help='XMPP password for the agents.')
args = parser.parse_args()

a = BDIAgent("BasicAgent@" + args.server, args.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.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.

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.2.1.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spade_bdi-0.2.1-py2.py3-none-any.whl (6.6 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: spade_bdi-0.2.1.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for spade_bdi-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b82233fdc200edf169c40ddd82a7737a19a246605535b759b673e09084934622
MD5 ce82a4530658635b2ce0b17ae86fd15f
BLAKE2b-256 10e85dc803f1900e144c2e9a38ceeaa2b69a1e43d51a3c0e9a9dbfdf27b44618

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spade_bdi-0.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for spade_bdi-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 aa407e0e82b54f79c34926a37c72f3331cf906382bc74d250b050a71f482af7b
MD5 85ce3f3b219542786a039233d68a5a31
BLAKE2b-256 4ef80202dd8891819290a28ab7dd6f08d1f0a3180a067be5ad4c262190029e0d

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.2

2 files

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.4

2 files

0.1.3

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page