Git Product home page Git Product logo

spade's Introduction

SPADE

image

image

Total Lines

Languages

Code Size

MIT License

Downloads

Continuous Integration Status

Code Coverage Status

Documentation Status

image

Smart Python Agent Development Environment

A multi-agent systems platform written in Python and based on instant messaging (XMPP).

Develop agents that can chat both with other agents and humans.

Features

  • Multi-agent platform based on XMPP
  • Presence notification allows the system to know the current state of the agents in real-time
  • Python >=3.8
  • Asyncio-based
  • Agent model based on behaviours
  • Supports FIPA metadata using XMPP Data Forms (XEP-0004: Data Forms)
  • Web-based interface
  • Use any XMPP server

Plugins

Credits

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

spade's People

Contributors

bjoernludwigptb avatar cclauss avatar coffee2codemachine avatar djaxel avatar ebegoli avatar gersiete avatar gialmisi avatar gusarba avatar jansawicki avatar javipalanca avatar juagargi avatar kraptor avatar martschink avatar materod avatar miesgre avatar movermeyer avatar siboxd avatar smola avatar swifmaneum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spade's Issues

How to manage the communication between two platform in spade?

Hi.
There is a way to send the message between two agents running on the different spade platforms?
For example: spade platform with IP address1 and another spade platform with IP address2 ?
I use Linux (Ubuntu 16.04 LTS) , to get this thing I have to create two Virtual Machine?
Please tell me all that is inherent to this problem.
Thanks

Non FIPA Messages

Hello,

I've been using SPADE for quite a while now and it has been a great help.
But I'm facing an issue. How can an agent receive normal chat messages?
The ACL templates don't work and even in a defaultBehaviour where I can catch all the messages, there seems to be no way I could break the message into all the different parts.
It has no content, no Sender, no Performative, or Ontology.
It instead has "from", "to", "body", etc...

Is there a way to receive and interpret non FIPA messages?

Thank you

Concurrency issues with 10+ agents

  • SPADE version: 3.0.9
  • Python version: 3.6.5
  • Operating System: Win10 x64

Description

For a simulation containing 100+ agents, I've been testing SPADE and xmpp servers. Currently I'm using the xmpp server "jwchat.org", chose a jid, then created multiple resources with the same jid (i think the theoretical maximum is 256 resources). It simply didn't work.

What I Did

Even when I use dummy agents (without behavior), i can't even create more than 10 or 11 of such agents. Once the number of agents exceed 10, i'll receive an error of "cancellation due to concurrency", as shown below:

LOAD1:	Agent is online!
LOAD2:	Agent is online!
LOAD3:	Agent is online!
LOAD4:	Agent is online!
LOAD5:	Agent is online!
LOAD6:	Agent is online!
LOAD7:	Agent is online!
LOAD8:	Agent is online!
LOAD9:	Agent is online!
LOAD10:	Agent is online!
broker task failed
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\aioxmpp\stream.py", line 1939, in _run
    timeout=timeout)
  File "C:\ProgramData\Anaconda3\lib\asyncio\tasks.py", line 313, in wait
    return (yield from _wait(fs, timeout, return_when, loop))
  File "C:\ProgramData\Anaconda3\lib\asyncio\tasks.py", line 396, in _wait
    yield from waiter
**concurrent.futures._base.CancelledError**

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\aioxmpp\stream.py", line 892, in _done_handler
    task.result()
  File "C:\ProgramData\Anaconda3\lib\site-packages\aioxmpp\stream.py", line 1987, in _run
    raise self._xmlstream_exception
aioxmpp.errors.StreamError: stream error: {urn:ietf:params:xml:ns:xmpp-streams}conflict ('Replaced by new connection')
stream failed: stream error: {urn:ietf:params:xml:ns:xmpp-streams}conflict ('Replaced by new connection')
main failed
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\aioxmpp\stream.py", line 1939, in _run
    timeout=timeout)
  File "C:\ProgramData\Anaconda3\lib\asyncio\tasks.py", line 313, in wait
    return (yield from _wait(fs, timeout, return_when, loop))
  File "C:\ProgramData\Anaconda3\lib\asyncio\tasks.py", line 396, in _wait
    yield from waiter
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\aioxmpp\node.py", line 824, in _on_main_done
    task.result()
  File "C:\ProgramData\Anaconda3\lib\site-packages\aioxmpp\node.py", line 989, in _main
    yield from self._main_impl()
  File "C:\ProgramData\Anaconda3\lib\site-packages\aioxmpp\node.py", line 965, in _main_impl
    raise exc
  File "C:\ProgramData\Anaconda3\lib\site-packages\aioxmpp\stream.py", line 892, in _done_handler
    task.result()
  File "C:\ProgramData\Anaconda3\lib\site-packages\aioxmpp\stream.py", line 1987, in _run
    raise self._xmlstream_exception
aioxmpp.errors.StreamError: stream error: {urn:ietf:params:xml:ns:xmpp-streams}conflict ('Replaced by new connection')
LOAD11:	Agent is online!
broker task failed
Traceback (most recent call last):
(...and so on...)

Regarding this I have several questions:

[A Survey] Which xmpp server do you use personally?
What're the good features and how did you find them out?

  1. Has anyone tested SPADE with large numbers of (100+) agents? Which xmpp server would you recommend for such an application? Is it possible to create even more than 256 agents on SPADE? How if yes, or why don't you recommend doing it?

  2. @javipalanca once mentioned that it's possible to create one's own xmpp-server (I hope this would resolve the concurrency issues). Is there a handy tutorial (step-by-step) on how to do it? Thanks!

  3. async/await issues
    In SPADE, is there a practical way to avoid "concurrent.futures._base.CancelledError"? Personally i'm not familiar with multi-threading, but I would be very grateful if you could give me (us all) some tricks to avoid it (e.g., by adding await asyncio.sleep()).
    For example, i'd like to initialize one agent that further creates a list of other agents. However, I can't add an async-sleep between the creation of two agents.

  4. When printing, how to avoid concurrent prints from different agents like this (where each agent should print on separate lines):

    LOAD55: Agent is online!
    LOAD55: Agent starts the trade behaviour.
    LMO: Starts the clearLocalMarket behaviour: in 3 steps
    LMO: Step 1: LMO sends call-for-bids to prosumers.
    ch03218_Avg_kW: Received a call-for-bid from LMO.
    ch03231_Avg_kW: Received a call-for-bid from LMO.LOAD55: Received a call-for-bid from LMO.
    ch03205_Avg_kW: Received a call-for-bid from LMO.

    ch03244_Avg_kW: Received a call-for-bid from LMO.LOAD40: Received a call-for-bid from LMO.
    LOAD1: Received a call-for-bid from LMO.
    LOAD20: Received a call-for-bid from LMO.

  5. In SPADE, are there any functions for an agent to search for other agents of a certain class, name, or feature? Some agent platforms like JADE provide such convenient functions, and I've been looking for a replacement of that in SPADE.

Finally, thank you all so much for making SPADE as fancy as it is!

Cheers,
Piao

Logging into the web interface

Hi,
I am new to using SPADE. I have issues logging into the web interface of SPADE. Could you please tell me what password I should be using to login to the web interface?

Thank you.

Block receive not behaving as expected

I am going through the tutorials and got to the "Agent Communication: Sending and Receiving Messages" step.
In the ReceiveBehav class the line self.msg = self._receive(True, 10) is expected to block the behavior for 10 seconds and then resume. However, when I run it, nothing happens. I would expect, that given no message, the agent would print "I waited but got no message" every 10 seconds.
I checked and the behaviour enters the _process method only once. It is like there is no difference between self._receive(True, 10) and self._receive(True).

Any idea on what the problem might be? Thanks.

The done( ) in OneShotBehaviour

  • SPADE version: SPADE 3.0.9
  • Python version: Python 3.6.7
  • Operating System: Lubuntu 18.04

Description

Hi,
I trying use the done() command to receive a return when a OneShotBehaviour( ) has finished, but I don't have success. Here an example that I did:

<--- Import behaviour from another module --->
from protocols.generic.Subscribe import SubscribeXMPP

<--- In another behaviour inside of the Agent class... --->
class SetupBehaviour(OneShotBehaviour):
        async def run(self):
        	setup = open("setup.txt","r")
            	lines = setup.readlines()
            	
                for line in lines:
                    self.agent.name = line
                    b1 = SubscribeXMPP()
                    self.agent.add_behaviour(b1)

                    print(b1.done()) 

                    while(b1.done() is False):
                        time.sleep(1)

                    print(b1.done())   

I expected that the b1.done( ) return at first False as a value, and when the behaviour are finished, his value is True. This happen, but the behaviour only execute (or print in the screen) after the alternance of this values and work only with the last line in lines.

Example

Supposing in setup.txt this lines:

agenta
agentb
agentc

and the SubscribeXMPP(OneShotBehaviour) execute a bash command to add each one of this lines as a agent connected in Prosody and after this, create a new agent in SPADE, the result is:

False
True
False
True
False 
True

Hello World! I'm agent agentc@localhost

I suspect that I don't understand the done() command exactly how he work.

Thanks in advance!

BDI is not working

Hello there,

I'm doing my master's thesis in the area of optimizing the self-consumption of solar-powered smart micro-grids and I'm using multi-agent system to simulate energy exchange between energy consumers and producers represented by agents.
I tried to apply the BDI concept, but it seems that the BDI example and testcase are not working with me (*attached are the error messages that appear while running the Server1BDI.py, ClientBDI.py and BDItestcase.py files).. https://www.dropbox.com/s/ua7lzl4sq39obo7/BDI.zip?dl=0
Please advice!

Thanks,
Ahmed

SPADE 3.0.1 "Fatal error on tls handshake" with DummyAgent

  • SPADE version: 3.0.1
  • Python version: 3.6.5
  • Operating System: Win 10 x64 & Mac OS X 10.13

Description

Firstly, thanks for releasing SPADE 3.0.1! Congratulations!
I have been playing with the develop version (3.0.0) and was very excited to test the stable version.
I did encounter a problem with the basic example DummyAgent.py as follows:

import spade.agent

class DummyAgent(spade.agent.Agent):
    def setup(self):
        print("Hello World! I'm agent {}".format(str(self.jid)))

dummy = DummyAgent("[email protected]", "password")

dummy.start()
dummy.stop()

What I Did

I ran this simple code on Win10/PowerShell, and on Mac/Terminal, but I got almost the same error on different platforms. It was not this case with SPADE 3.0.0.

Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS My_location\SPADE_behavior> python dummyAgent.py
Fatal error on tls handshake
protocol: <aioxmpp.protocol.XMLStream object at 0x05171230>
transport: <aioopenssl.STARTTLSTransport object at 0x05171570>
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\aioopenssl-0.4.0-py3.6.egg\aioopenssl\__init__.py", line 33
1, in _tls_do_handshake
    self._tls_conn.do_handshake()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyopenssl-18.0.0-py3.6.egg\OpenSSL\SSL.py", line 1907, in d
o_handshake
    self._raise_ssl_error(self._ssl, result)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyopenssl-18.0.0-py3.6.egg\OpenSSL\SSL.py", line 1639, in _
raise_ssl_error
    _raise_current_error()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyopenssl-18.0.0-py3.6.egg\OpenSSL\_util.py", line 54, in e
xception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'ssl3_get_record', 'wrong version number')]
Exception in callback None()
handle: <Handle cancelled>
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\aioopenssl-0.4.0-py3.6.egg\aioopenssl\__init__.py", line 33
1, in _tls_do_handshake
    self._tls_conn.do_handshake()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyopenssl-18.0.0-py3.6.egg\OpenSSL\SSL.py", line 1907, in d
o_handshake
    self._raise_ssl_error(self._ssl, result)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyopenssl-18.0.0-py3.6.egg\OpenSSL\SSL.py", line 1639, in _
raise_ssl_error
    _raise_current_error()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyopenssl-18.0.0-py3.6.egg\OpenSSL\_util.py", line 54, in e
xception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'ssl3_get_record', 'wrong version number')]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\asyncio\events.py", line 145, in _run
    self._callback(*self._args)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\aioopenssl-0.4.0-py3.6.egg\aioopenssl\__init__.py", line 34
6, in _tls_do_handshake
    self._waiter.set_exception(exc)
asyncio.base_futures.InvalidStateError: invalid state
connection failed: _force_close() called
Hello World! I'm agent [email protected]
Future exception was never retrieved
future: <Future finished exception=ConnectionError('stream shut down',)>
ConnectionError: stream shut down

And strange is that if I run the same code again, the error simply disappears:

PS My_location\SPADE_behavior> python dummyAgent.py
Hello World! I'm agent [email protected]

Has anyone experienced a similar issue? Thanks for any hints!

Best regards,
Piao

Error importing spade

  • SPADE version: 3.1.0
  • Python version: 3.6.8
  • Operating System: Windows 10

Description

I installed succesfully SPADE (tried from sources and pip) but when I try to import the package, it gives me one error.

What I Did

from spade import agent
Traceback (most recent call last):
File "", line 1, in
File "........\spade.py", line 3, in
from spade.agent import Agent
ModuleNotFoundError: No module named 'spade.agent'; 'spade' is not a package

If I type "pip list" I can see the spade package installed.

DummyAgent freezes the script execution

  • SPADE version: 3.1.2
  • Python version: 3.7.3
  • Operating System: Windows 10 Home

Description

Running the DummyAgent code from the Quick Start section of SPADE documentation causes the script to be unable to finish properly.

Code:

from spade import agent
class DummyAgent(agent.Agent):
    async def setup(self):
        print("Hello World! I'm agent{}".format(str(self.jid)))

dummy = DummyAgent("your_jid@your_xmpp_server", "your_password")

dummy.start()

dummy.stop()

Output:

Hello World! I'm agent your_jid@your_xmpp_server
<command line prompt missing>

SPADE 3 DummyAgent Example: RuntimeError regarding Asyncio

Dear all,

I've been playing with the SPADE 3 "develop branch" and faced an Asyncio-related issue with Jupyter Notebook.

I simply ran the quick start example in SPADE 3 documentation Ch5.1:

import spade.agent

class DummyAgent(spade.agent.Agent):
def setup(self):
print("Hello World! I'm agent {}".format(str(self.jid)))

dummy = DummyAgent("blabla", "blabla")

dummy.start()
dummy.stop()

By "dummy.start()" Jupyter Notebook bounces back an error as follows. However, it doesn't happen if I run the .py-file using command prompt.


RuntimeError Traceback (most recent call last)
in ()
----> 1 dummy.start()

C:\ProgramData\Anaconda3\lib\site-packages\spade-3.0.0-py3.6.egg\spade\agent.py in start(self, auto_register)
48 self.register()
49
---> 50 self.aiothread.connect()
51 self.aiothread.start()
52 self._alive.set()

C:\ProgramData\Anaconda3\lib\site-packages\spade-3.0.0-py3.6.egg\spade\agent.py in connect(self)
239 self.conn_coro = self.client.connected()
240 aenter = type(self.conn_coro).aenter(self.conn_coro)
--> 241 self.stream = self.loop.run_until_complete(aenter)
242 logger.info(f"Agent {str(self.jid)} connected and authenticated.")
243

C:\ProgramData\Anaconda3\lib\asyncio\base_events.py in run_until_complete(self, future)
453 future.add_done_callback(_run_until_complete_cb)
454 try:
--> 455 self.run_forever()
456 except:
457 if new_task and future.done() and not future.cancelled():

C:\ProgramData\Anaconda3\lib\asyncio\base_events.py in run_forever(self)
410 if events._get_running_loop() is not None:
411 raise RuntimeError(
--> 412 'Cannot run the event loop while another loop is running')
413 self._set_coroutine_wrapper(self._debug)
414 self._thread_id = threading.get_ident()

RuntimeError: Cannot run the event loop while another loop is running

Local setup:
OS: Windows 10 x64,
Python 3.65
Anaconda 1.8.7
Jupyter Notebook 5.5.0

Thanks for any hints!

How to add custom method calls to event loop?

  • SPADE version: 3.1.3
  • Python version: 3.7.4
  • Operating System: macOS 10.14.6

Description

I want to use a speech synthesis package called pyttsx3 which offers its own event loop for the execution of the synthesis.
When using their event loop the voice output blocks everything else until I stop their event loop, which comes with a 1200ms delay.

Pyttsx3 als offers to use a custom event loop as described here.

Where would I call engine.iterate()?

Can I add Tasks or method calls to Spade's event loop?

Thank you for helping me! <3

TCPsocket has no attribute '_old_owner_methods'

Hi,

I installed SPADE with my server name as "localhost". Then I followed your guide and tried to run the example told on "My First SPADE agent" page (http://spade.gti-ia.dsic.upv.es/manuals/html-chunk/spade.basicagents.first.html). But when I typed "python file_name.py", the console didn't bring anything for a long time and then I got an error message saying
"AttributeError: TCPsocket instance has no attribute 'old_owners_methods'"

The whole error message is as follows:

Traceback (most recent call last):
File "agent.py", line 24, in
a = MyAgent('agent@localhost', 'secret')
File "/usr/local/lib/python2.7/dist-packages/SPADE-2.1.1-py2.7.egg/spade/Agent.py", line 1843, in init
if not self._register(password):
File "/usr/local/lib/python2.7/dist-packages/SPADE-2.1.1-py2.7.egg/spade/Agent.py", line 1884, in _register
while not self.jabber.connect(use_srv=None) and tries > 0:
File "/usr/local/lib/python2.7/dist-packages/xmpp/client.py", line 200, in connect
if not CommonClient.connect(self,server,proxy,secure,use_srv) or secure<>None and not secure: return self.connected
File "/usr/local/lib/python2.7/dist-packages/xmpp/client.py", line 171, in connect
socket.PlugOut()
File "/usr/local/lib/python2.7/dist-packages/xmpp/client.py", line 83, in PlugOut
for method in self._old_owners_methods: self._owner.dict[method.name]=method
AttributeError: TCPsocket instance has no attribute '_old_owners_methods'

I'm new to MAS, so I'll be very happy if you help me solve this problem.

Performing an auction

Hello,
I am new to SPADE and I am running the runTest.py for the auction. I can see that each bidder has some money and the auctioneer has been initialised as well. The comments in the code say the entire interaction is done via the web. Could you please tell me how I perform this auction from the web?

Thank you.

Running an agent more than once

I am attempting to run an agent more than once
given a simple agent that exits on its third count how can I run the agent after it exits from another script
Suppose an agent is below:
import spade
import time
import sys
d=[]
class MyAgent(spade.Agent.Agent):
class MyBehav(spade.Behaviour.Behaviour):
def onStart(self):
print "Starting behaviour . . ."
self.counter = 0

    def _process(self):
        print "Counter:", self.counter
        self.counter = self.counter + 1
        i=self.counter
        if i==3:
            sys.exit(0)
        d.append(self.counter)
        print d
        print d[i-1]
        time.sleep(1)

def _setup(self):
    print "MyAgent starting . . ."
    b = self.MyBehav()
    self.addBehaviour(b, None)

if name == "main":
a = MyAgent("[email protected]", "secret")
a.start()

How to measure agent's performance?

  • SPADE version: 3.1.3
  • Python version: 3.7
  • Operating System: Win10
  • XMPP server: ejabber version: 19.05

Description

I would like to ask about receiving performance measurements in spade during exchanging messages. For example, latency, bandwidth etc. Is there any chance to measure them?

Thank you for such a good job during developing and maintaining this framework!

aioxmpp error connecting to Prosody IM

  • SPADE version: 3.0.9
  • Python version: 3.6
  • Operating System: Lubuntu 18.10

Description

I have installed a Prosody IM server. This works with SPADE in localhost when I configure in prosody.cfg.lua the virtualhost as 'localhost" and using a DNSmasq I can find it in a LAN using another virtualhost like 'spade.loc'.

I saw the documentation in Prosody server and found issues about SRV records, then I configure my Prosody config file inserting this information and it works.

But now, the aioxmmp show me the follow error:

aioxmpp.errors.MultiOSError: failed to connect to XMPP domain 'spade.loc': multiple errors: stream error: {urn:ietf:params:xml:ns:xmpp-streams}undefined-condition ('No stream features to proceed with')
I already have the 'smacks' mod to handler with streams, but it not works.

What I Did

Follows, my Prosody config file:


-- Prosody Example Configuration File
	--
	-- Information on configuring Prosody can be found on our
	-- website at https://prosody.im/doc/configure
	--
	-- Tip: You can check that the syntax of this file is correct
	-- when you have finished by running this command:
	--     prosodyctl check config
	-- If there are any errors, it will let you know what and where
	-- they are, otherwise it will keep quiet.
	--
	-- The only thing left to do is rename this file to remove the .dist ending, and fill in the
	-- blanks. Good luck, and happy Jabbering!


	---------- Server-wide settings ----------
	-- Settings in this section apply to the whole server and are the default settings
	-- for any virtual hosts

	-- This is a (by default, empty) list of accounts that are admins
	-- for the server. Note that you must create the accounts separately
	-- (see https://prosody.im/doc/creating_accounts for info)
	-- Example: admins = { "[email protected]", "[email protected]" }
	admins = { }

	-- Enable use of libevent for better performance under high load
	-- For more information see: https://prosody.im/doc/libevent
	--use_libevent = true

	-- Prosody will always look in its source directory for modules, but
	-- this option allows you to specify additional locations where Prosody
	-- will look for modules first. For community modules, see https://modules.prosody.im/
	--plugin_paths = {}

	-- This is the list of modules Prosody will load on startup.
	-- It looks for mod_modulename.lua in the plugins folder, so make sure that exists too.
	-- Documentation for bundled modules can be found at: https://prosody.im/doc/modules
	modules_enabled = {

		-- Generally required
			"roster"; -- Allow users to have a roster. Recommended ;)
			"saslauth"; -- Authentication for clients and servers. Recommended if you want to log in.
			--"tls"; -- Add support for secure TLS on c2s/s2s connections
			"dialback"; -- s2s dialback support
			"disco"; -- Service discovery

		-- Not essential, but recommended
			"carbons"; -- Keep multiple clients in sync
			"pep"; -- Enables users to publish their mood, activity, playing music and more
			"private"; -- Private XML storage (for room bookmarks, etc.)
			"blocklist"; -- Allow users to block communications with other users
			"vcard"; -- Allow users to set vCards

		-- Nice to have
			"version"; -- Replies to server version requests
			"uptime"; -- Report how long server has been running
			"time"; -- Let others know the time here on this server
			"ping"; -- Replies to XMPP pings with pongs
			"register"; -- Allow users to register on this server using a client and change passwords
			"mam"; -- Store messages in an archive and allow users to access it
			"smacks"; -- Stream manager
		-- Admin interfaces
			"admin_adhoc"; -- Allows administration via an XMPP client that supports ad-hoc commands
			"admin_telnet"; -- Opens telnet console interface on localhost port 5582

		-- HTTP modules
			"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP"
			"websocket"; -- XMPP over WebSockets
			"http_files"; -- Serve static files from a directory over HTTP

		-- Other specific functionality
			"limits"; -- Enable bandwidth limiting for XMPP connections
			"groups"; -- Shared roster support
			"server_contact_info"; -- Publish contact information for this service
			"announce"; -- Send announcement to all online users
			"welcome"; -- Welcome users who register accounts
			"watchregistrations"; -- Alert admins of registrations
			"motd"; -- Send a message to users when they log in
			"legacyauth"; -- Legacy authentication. Only used by some old clients and bots.
			"proxy65"; -- Enables a file transfer proxy service which clients behind NAT can use
	}

	-- These modules are auto-loaded, but should you want
	-- to disable them then uncomment them here:
	modules_disabled = {
		-- "offline"; -- Store offline messages
		-- "c2s"; -- Handle client connections
		-- "s2s"; -- Handle server-to-server connections
		-- "posix"; -- POSIX functionality, sends server to background, enables syslog, etc.
	}

	-- Disable account creation by default, for security
	-- For more information see https://prosody.im/doc/creating_accounts
	allow_registration = true

	-- Force clients to use encrypted connections? This option will
	-- prevent clients from authenticating unless they are using encryption.

	c2s_require_encryption = true

	-- Force servers to use encrypted connections? This option will
	-- prevent servers from authenticating unless they are using encryption.
	-- Note that this is different from authentication

	s2s_require_encryption = true


	-- Force certificate authentication for server-to-server connections?
	-- This provides ideal security, but requires servers you communicate
	-- with to support encryption AND present valid, trusted certificates.
	-- NOTE: Your version of LuaSec must support certificate verification!
	-- For more information see https://prosody.im/doc/s2s#security

	s2s_secure_auth = false

	-- Some servers have invalid or self-signed certificates. You can list
	-- remote domains here that will not be required to authenticate using
	-- certificates. They will be authenticated using DNS instead, even
	-- when s2s_secure_auth is enabled.

	--s2s_insecure_domains = { "insecure.example" }

	-- Even if you leave s2s_secure_auth disabled, you can still require valid
	-- certificates for some domains by specifying a list here.

	--s2s_secure_domains = { "jabber.org" }

	-- Select the authentication backend to use. The 'internal' providers
	-- use Prosody's configured data storage to store the authentication data.
	-- To allow Prosody to offer secure authentication mechanisms to clients, the
	-- default provider stores passwords in plaintext. If you do not trust your
	-- server please see https://prosody.im/doc/modules/mod_auth_internal_hashed
	-- for information about using the hashed backend.

	authentication = "internal_hashed"

	-- Select the storage backend to use. By default Prosody uses flat files
	-- in its configured data directory, but it also supports more backends
	-- through modules. An "sql" backend is included by default, but requires
	-- additional dependencies. See https://prosody.im/doc/storage for more info.

	--storage = "sql" -- Default is "internal"

	-- For the "sql" backend, you can uncomment *one* of the below to configure:
	--sql = { driver = "SQLite3", database = "prosody.sqlite" } -- Default. 'database' is the filename.
	--sql = { driver = "MySQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }
	--sql = { driver = "PostgreSQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }


	-- Archiving configuration
	-- If mod_mam is enabled, Prosody will store a copy of every message. This
	-- is used to synchronize conversations between multiple clients, even if
	-- they are offline. This setting controls how long Prosody will keep
	-- messages in the archive before removing them.

	archive_expires_after = "1w" -- Remove archived messages after 1 week

	-- You can also configure messages to be stored in-memory only. For more
	-- archiving options, see https://prosody.im/doc/modules/mod_mam

	-- Logging configuration
	-- For advanced logging see https://prosody.im/doc/logging
	log = {
		info = "prosody.log"; -- Change 'info' to 'debug' for verbose logging
		error = "prosody.err";
		-- "*syslog"; -- Uncomment this for logging to syslog
		-- "*console"; -- Log to the console, useful for debugging with daemonize=false
	}

	-- Uncomment to enable statistics
	-- For more info see https://prosody.im/doc/statistics
	-- statistics = "internal"

	-- Certificates
	-- Every virtual host and component needs a certificate so that clients and
	-- servers can securely verify its identity. Prosody will automatically load
	-- certificates/keys from the directory specified here.
	-- For more information, including how to use 'prosodyctl' to auto-import certificates
	-- (from e.g. Let's Encrypt) see https://prosody.im/doc/certificates

	-- Location of directory to find certificates in (relative to main config file):
	certificates = "certs"

	----------- Virtual hosts -----------
	-- You need to add a VirtualHost entry for each domain you wish Prosody to serve.
	-- Settings under each VirtualHost entry apply *only* to that host.

	pidfile = "prosody.pid" -- stores prosody.pid in the current directory

	VirtualHost "spade.loc"

	--VirtualHost "example.com"
	--	certificate = "/path/to/example.crt"

	------ Components ------
	-- You can specify components to add hosts that provide special services,
	-- like multi-user conferences, and transports.
	-- For more information on components, see https://prosody.im/doc/components

	---Set up a MUC (multi-user chat) room server on conference.example.com:
	--Component "conference.example.com" "muc"

	---Set up an external component (default component port is 5347)
	--
	-- External components allow adding various services, such as gateways/
	-- transports to other networks like ICQ, MSN and Yahoo. For more info
	-- see: https://prosody.im/doc/components#adding_an_external_component
	--
	--Component "gateway.example.com"
	component_secret = "pedaneel"

	-- This one works great if you run Prosody direct from where you checked it out
	-- (ie. you use "./prosodyctl start")



Thanks in advance!

Compare agent jid in trace.py

  • SPADE version: 3.0.9
  • Python version: 3.6.6
  • Operating System: Debian 9

Description

When i use web user interface i can`t see opponent agent message in chat box

What I Did

My issue change private function in spade/trace.py:
1 Old code:
def _agent_in_msg(agent, msg):
return msg.to == agent or msg.sender == agent

2 New code:
def _agent_in_msg(agent, msg):
return str(msg.to).startswith(str(agent)) or str(msg.sender).startswith(str(agent))

All problem is a resource in JID

Installing SPADE on windows 10 64 bits

Dear All,

I'm beginner with SPADE. I have used SPADE on IOS, it working well.

Now, I try to install the last version (https://github.com/javipalanca/spade/) into a Windows 10 environment.
I use python2.7 but when I execute the command "pip install SPADE" i obtain the following error:

Please could you indicate me if the last version is compatible with windows 10 ?

Thanks in advance


D:\spade23>pip install SPADE
Collecting SPADE
Using cached SPADE-2.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\JORGEL1\AppData\Local\Temp\pip-build-5hz7ye5z\SPADE\setup.py", line 6, in
from runspade import version
File "C:\Users\JORGEL
1\AppData\Local\Temp\pip-build-5hz7ye5z\SPADE\runspade.py", line 16
except ImportError, e:
^
SyntaxError: invalid syntax

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in C:\Users\JORGEL~1\AppData\Local\Temp\pip-build-5hz7ye5z\SPADE\

SPADE 3.0 Roadmap

I think it's time to plan a new major revision of SPADE. I know there are lots of ideas to improve the platform but I think there are major refactorings that are needed before continuing the development of the platform.
The most important is the most difficult, to change the XMPP library since xmpppy has been discontinued. This affects both the agent library and the xmpp server. In fact, we need to be able to connect to ANY xmpp server (which is not possible nowadays with xmpppy).
I would like to take this moment to also go to Python 3, where we could benefit from asyncio (among others).
I wrote SPADE when I was a python newbie (more than 10 years ago) Both python and me have increased our skills since then, and that should be reflected in the code, with better performance techniques, use of design patterns, clean code, git-flow, etc.

Looking at different python XMPP libraries I think that the most affordable and interesting is SleekXMPP (https://github.com/fritzy/SleekXMPP/) which is compatible with Python 3 and seems to be up-to-date.
Since spade 3 should be compatible with any xmpp server I still like to provide a "toy" python xmpp server that works with the spade installation. Not sure if this is a good idea or we can just include any python server like Wokkel (https://wokkel.ik.nu/) in the requirements.

There will be lots of ideas to discuss (do we want the behaviors agent model again? or any other?, do we need to follow FIPA? etc...) So please start to provide your wishlist for a next-gen Agent Platform. In the meantime, a new collaborator (MiguelBellver) is going to test SleekXMPP.

Ideas, comments, volunteers...

How to run spade in Flask web application ? Because flask web application is runs in port 8080. How to run spade dashboard with flask web application

  • SPADE version: Latest One

  • Python version:
    multidict==4.4.0
    aioxmpp>=0.10
    aiohttp>=3.4.4
    aiohttp_jinja2>=0.14.0
    jinja2>=2.9.6
    jinja2-time==0.2.0
    timeago==1.0.8

  • Operating System: Windows 8.1

Description

I'm trying to integrate the spade code in flask application.
While I add some code - DummyAgent with a web interface, in the flask application app.py, the flask application running on port 8080 and the spade is not working.

But I tried with DummyAgent without a web interface. It's working correctly

from flask import Flask, render_template
from flask import redirect
from urllib.parse import urljoin
from flask_cdn import CDN
from spade import agent

app = Flask(name)

@app.route('/')
def hello_world():
return render_template("main.html")

class DummyAgent(agent.Agent):
def setup(self):
print("Hello World! I'm agent {}".format(str(self.jid)))

dummy = DummyAgent("agent1@GAYAN-SAMUDITHA", "agent1")
dummy.start()

dummy.stop()

if name == 'main':
app.run()

WITH WEB INTERFCE

from flask import Flask, render_template
from flask import redirect
from urllib.parse import urljoin
from flask_cdn import CDN
from spade import agent

app = Flask(name)

@app.route('/')
def hello_world():
return render_template("main.html")

from spade import agent

class WebAgent(agent.Agent):
def setup(self):
print("Hello World! I'm agent {}".format(str(self.jid)))

dummy = WebAgent("admin@GAYAN-SAMUDITHA", "admin")

async def hello_controller(request):
return {"number": 42}

a = WebAgent("agent1@GAYAN-SAMUDITHA", "agent1")

a.web.add_get("/hello", hello_controller, "hello.html")

a.start(auto_register=True)
a.web.start(port=10000)

if name == 'main':
app.run()

==> Not working

Agent C++

Hello,

Have you an example to agent C++ programming ?

A+

Send objects with messages

Hi,
Is it possible to send objects with messages.
In the documentation, I found that meta-data should be of string type, and I need to send other types.

Thanks.

Run spade daemon at startup

Hi,
In order to run a script for SPADE initialization at linux startup the following code was included to rc.local:

  #!/bin/sh -e
  #
  # rc.local
  #
  # This script is executed at the end of each multiuser runlevel.
  # Make sure that the script will "exit 0" on success or any other
  # value on error.
  #
  # In order to enable or disable this script just change the execution
  # bits.
  #
  # By default this script does nothing.


 exec 2> /tmp/rc.local.log  # send stderr from rc.local to a log file
 exec 1>&2                      # send stdout to the same log file
 set -x

 #script to initialize the SPADE daemon
 bash start_script.sh -m running &
 ---

However, warning messages occur:
[email protected]:[spade] There is no SPADE platform at 127.0.0.1 . Agent dying... , error
[email protected]:[spade] Could not register agent [email protected] , error
[email protected]:[spade] Did not send 'unavailable' presence: 'aggregator' object has no
attribute 'roster' , warn
[email protected]:[spade] Stopping agent [email protected] , ok
---
Executing 'sudo bash /etc/rc.local' after system boot runs perfectly.

Is there any feature in rc.local which prevents running SPADE this way?
Suggestions please.

Best Regards
Jorge

Error while running runspade.py!

Hallo,
First thanks for the windows-based spade.
I installed it and it seemed okay with me then I ran the configure.py and runspade.py according to the installation guide and I've got these messages (see attached). There is an error while establishing the connection with the platform.
Please Advice!
Thanks,
Ahmed
runspade

future plans

  • SPADE version: 3.0.8
  • Python version: 3.7
  • Operating System: Ubuntu 18

Description

Are you intent to develop some plugins like BDI behaviour or ontology utilisation?
Can you share the schedule of SPADE development?

What I Did

Blocking behaviours

  • SPADE version: 3.1.2
  • Python version: 3.6
  • Operating System: Linux

Description

I have three agents: master, slave1 and slave2.
Master sends a message to slave1 and slave2 with an operation to do.
Slave1 and slave2 should run the given operation at the same time.
What I got is that slave2 start doing is task when slave1 has finished his task.
I used the basic example to exchange messages.
Am I missing something?

MASTER CODE (not complete)

    class DistribuisciBehav(OneshotBehaviour):
        async def run(self):
                for slave in slaves:
                       await self.send(slaveagent.prepare_message(slave, task_to_do))
                     

SLAVE CODE (not complete)

     class DoTask(CyclicBehaviour):
        async def run(self):
            msg = await self.receive(timeout=10)
            if msg:
               call function to run my task (function is not async)
               ...send message to master that i have completed my task
                     

Thanks

In-band register

Allow agents to self-register using the XEP-0077 (In-band registering).
This issue is blocked until the aioxmpp library supports this XEP.

SPADE memory usage

Hi,

Using a raspberry B+, for a matter of limited resources and too high memory usage I've been trying to reduce memory occupation from a program which runs SPADE.
SPADE processes in htop show the following traits:

runspade      cpu/20%      mem/8.5%    -  (1 main shell process and 47 subshells)
script        cpu/70%      mem/9.8%     -   (1 main shell process and 4 subshells)

Looking to the above data my script is using too much memory.
In this step it was not possible to determine if my script was the source of the problem.
This script runs an OneShotBehaviour, an EventBehaviour and a PeriodicBehaviour.
Isolating the OneShotBehaviour and the EventBehaviour they do not occupy memory
as expected, and each one forks the main shell process into one subshell.
The memory occupancy from the script mantains in 3% of cpu usage.
Then running the PeriodicBehaviour it occupies 70% of cpu memory.
Because the problem could be the added code itself, the code inside the Periodic behaviour was commented and the 70% of memory usage had remained.

So at this point I am blaming the Periodic Behaviour. Repeating the period 2 in 2 seconds or 5 in 5 seconds does not influence the usage.

Finnally, there are 2 questions that arise:

  1. Why does runspade.py forks the shell into 47 subprocesses?threads?
  2. Is it possible the Periodic Behaviour by itself occupy so much memory?
    (the while loop followed by sleep !?)

Best regards
Jorge Eduardo

can't install spade

  • SPADE version:3.0.9
  • Python version:3.7
  • Operating System: windows 8.1 4bits

I'm trying to install spade using pip and I got these messages:

failed building wheel for lxml
could not fing function xmlCheckVersion in library libxml2. Is libxml2 installed?
Rolling back uninstall of xml.

When I try to install lxml, I have this message: requirements alredy satisfied.
When I try to install libxml2 I have this message: Could not find a version that satisfies the requirement.

I need help please!

Some questions about performance

  • SPADE version: 3.0.3
  • Python version: 3.6
  • Operating System: linux mint 18

Hi guys, first let me congratulate you for this library, it is really impressive.

In short, I have a question about performance, but it is probably more an issue with the server than with SPADE itself. I am wondering if you could give me some advice nevertheless.

We are considering using SPADE for a new agent-based model that we are currently planning for air transportation. We are very interested in using SPADE, but after some initial tests, it seems that sending and receiving messages would have a high impact on the computational performance of the model.

To give you some context, we are trying to use SPADE with around 100k agents. A very quick estimation tells us that more than 3 millions messages will be sent during a single simulation. During our tests, using a local prosody server, we estimated that the time to send and receive a message was around 0.02 second, which puts around the total CPU time to 60k seconds, more than 16 hours, just for the messages. This is too much for us, unfortunately.

So my questions are the following I guess:

  • Does the 0.02 second seem normal to you for the transfer time?
  • Is there any way to decrease this transfer time?
  • Is it mainly due to the server?
  • Shall we try others?
  • Do you have any advice for the server configuration?

Thanks for taking the time to read this, and keep up the good work!

how to communicate with a REST API?

To communicate with a SPADE agent from a REST API
where and how to send information to the agent?

In the opposite stream, from the agent to the API it is not in question. I mean to send a message from the REST API that the agent receives.
What is the address to which I must send messages?
(would be interesting to understand how to use the WUI from SPADE)

Regards.

Agent fails to register itself on an XMPP server with an invalid certificate

  • SPADE version: 3.0.9
  • Python version: 3.6.7
  • Operating System: Debian 9.6
    Note: I'm running Debian on Windows 10 (via WSL), but I've verified the behaviour on another machine with LMDE2 (Debian 8).
    Both machines use pyenv/pipenv to ensure exact version match for both Python and SPADE.
    Both machines use locally running Openfire (in newest version, 4.2.3) with user registration allowed.

Description

Agents should be able to self-register on the XMPP server (as per #31), but both register() and start(auto_register=True) fails with aiosasl.AuthenticationFailure and spade.agent.AuthenticationFailure.

Important note: I'm yet to test it with an XMPP server hosted under a proper domain name and with a valid certificate - this might be the underlying issue here.
For testing purposes I've tried registering a new user using Pidgin and it went through without problems, though it did require confirming reception of server's self-signed certificate.

What I Did

My almost-minimal not working example:

#!/usr/bin/env python3

from spade.agent import Agent

class TestAgent(Agent):
	def setup(self):
		print("test agent setup")

def main():
	print("Creating agent...")
	serverAgent = TestAgent("[email protected]", "pass1234")
	print("Agent created, starting...")
	serverAgent.start()
	print("Agent started, stopping...")
	serverAgent.stop()
	print("Agent stopped, closing!")

if __name__ == "__main__":
	main()

run as $ pipenv run ./testRegister.py outputs:

Creating agent...
Agent created, starting...
main failed
Traceback (most recent call last):
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/node.py", line 824, in _on_main_done
    task.result()
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/node.py", line 989, in _main
    yield from self._main_impl()
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/node.py", line 951, in _main_impl
    logger=self.logger)
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/node.py", line 400, in connect_xmlstream
    jid, metadata, negotiation_timeout, loop, logger,
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/node.py", line 279, in _try_options
    features=features,
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 1201, in negotiate_sasl
    raise last_auth_error
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 1185, in negotiate_sasl
    jid, features, xmlstream, transport)
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 983, in execute
    intf, mechanism, token)
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 848, in _execute
    yield from mechanism.authenticate(sm, token)
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aiosasl/__init__.py", line 712, in authenticate
    username, password = yield from self._credential_provider()
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 960, in credential_provider
    text="authentication aborted by user")
aiosasl.AuthenticationFailure: user intervention: authentication failed: authentication aborted by user
Traceback (most recent call last):
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/spade/agent.py", line 378, in connect
    self.stream = self.loop.run_until_complete(aenter)
  File "/home/mjbogusz/.pyenv/versions/3.6.7/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete
    return future.result()
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/node.py", line 1630, in __aenter__
    yield from conn_future
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/node.py", line 824, in _on_main_done
    task.result()
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/node.py", line 989, in _main
    yield from self._main_impl()
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/node.py", line 951, in _main_impl
    logger=self.logger)
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/node.py", line 400, in connect_xmlstream
    jid, metadata, negotiation_timeout, loop, logger,
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/node.py", line 279, in _try_options
    features=features,
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 1201, in negotiate_sasl
    raise last_auth_error
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 1185, in negotiate_sasl
    jid, features, xmlstream, transport)
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 983, in execute
    intf, mechanism, token)
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 848, in _execute
    yield from mechanism.authenticate(sm, token)
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aiosasl/__init__.py", line 712, in authenticate
    username, password = yield from self._credential_provider()
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/aioxmpp/security_layer.py", line 960, in credential_provider
    text="authentication aborted by user")
aiosasl.AuthenticationFailure: user intervention: authentication failed: authentication aborted by user

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./testRegister.py", line 19, in <module>
    main()
  File "./testRegister.py", line 13, in main
    serverAgent.start()
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/spade/agent.py", line 98, in start
    self.aiothread.connect()
  File "/home/mjbogusz/.local/share/virtualenvs/testspade-MdaXyzjQ/lib/python3.6/site-packages/spade/agent.py", line 382, in connect
    "Could not authenticate the agent. Check user and password or use auto_register=True")
spade.agent.AuthenticationFailure: Could not authenticate the agent. Check user and password or use auto_register=True

Bug: FSM Behaviour

Hello,

In your example/fsm.py : i think that a little problem with the four state ( class StateFour(spade.Behaviour.OneShotBehaviour))

The test is [ if self.myAgent.counter > 11: ] but the trace log see :
AdvancedAgent starting . . .
This is State One...
This is State One...
This is State One...
This is State Two...
This is State Two...
This is State Two...
This is State Three...
This is State Three...
This is State Three...
This is State Four... [FC : counter =10]
DEBUG:[spade] Behavior [email protected] RosterBehaviour finished. , info
DEBUG:[spade] Stoping Behavior [email protected] FSMBehaviour , info

Just one State Four !

The problem is with def done(): and def _process(): function

Voili Voilu Voila

The ports not getting free after running a program once

Hello,
I am suddenly facing this issue where I can run code using SPADE just once. When I run the same code for the second time, I get the error "Could not open port xxxx". When I restart my computer, and rerun the same code, it works perfect, only once though. Is there something I am doing wrong? I am running the runTest.py code from the auction folder in the examples.
I have tried re running the code in an Anaconda environment as well as the normal python environment. Please find attached a screenshot of the error I am getting.
screenshot

Would be really helpful if you could help fix this issue.

Thank you

Interperability with other FIPA platform (JADE) ?

Hi,

I would like to know if SPADE is interoperable with other FIPA agent platforms, for instance JADE ?

If someone already did it, it would be great to have an example... And if someone think its not possible, it would be great to know before investing time in it. Otherwise, I'm planning to give it a try.

Rémi

Error when creating my first agent: AgentNotRegisteredError

Hello,

I successfully installed spade on windows 7 (https://github.com/javipalanca/spade).

I would like to create my first agent. To do that, i launch configure.py and runspade.py as follow:

(python27) C:\Anaconda3\envs\python27\Scripts\spade>python configure.py localhost
Translating localhost DNS to IP (127.0.0.1).

(python27) C:\Anaconda3\envs\python27\Scripts\spade>python runspade.py
SPADE  ←[33;1m2.2←[0m  <[email protected]> - http://spade2.googlecode.com
Starting SPADE......←[32m [done]←[0m

 ←[33;1m [info] ←[0mWebUserInterface serving at port 8008

I created "myFirstAgent.py":

import spade

class MyAgent(spade.Agent.Agent):
        def _setup(self):
                print ("MyAgent starting . . .")
                
if __name__ == "__main__":
	a = MyAgent("[email protected]", "secret")
	a.start()

but when i execute the above code, i got the following error:

[email protected]:[spade] There is no SPADE platform at myhost.myprovider.com . Agent dying... , error
[email protected]:[spade] Could not register agent [email protected] , error
[email protected]:[spade] Did not send 'unavailable' presence: 'MyAgent' object has no attribute 'roster' , warn
AgentNotRegisteredError

How can i register my agent ? how can i resolve this error ?

Thank you for your help

Could not register agent [email protected]

I have this error:

DEBUG:[spade] Could not register agent [email protected] , error
DEBUG:[spade] Could not kill behavior <class 'spade.peer2peer.DiscoBehaviour'> , warn
DEBUG:[spade] Could not kill behavior <class 'spade.peer2peer.StreamInitiationBehaviour'> , warn
DEBUG:[spade] Could not kill behavior <class 'spade.RPC.RPCServerBehaviour'> , warn
DEBUG:[spade] Stopping agent [email protected] , ok
Traceback (most recent call last):
File "./nodo.py", line 14, in
main()
File "./nodo.py", line 10, in main
agent=AgentNode("node"+machine+"@127.0.0.1","node"+machine+"secret")
File "/Library/Python/2.7/site-packages/SPADE-2.1.1-py2.7.egg/spade/Agent.py", line 1847, in init
raise AgentNotRegisteredError
spade.Agent.AgentNotRegisteredError

But my code it's simple:

!/usr/bin/env python

import threading,spade,os,sys,subprocess

class AgentNode(spade.Agent.Agent):
def _setup(self):
sys.stdout.write("Agent Node Starting...\n")

def main():
machine=subprocess.check_output("uname -n | tr -d '.'",shell=True).strip().upper()
agent=AgentNode("node"+machine+"@127.0.0.1","node"+machine+"secret")
agent.start()

if name == "main":
main()

And the server log:
Wed Apr 3 10:48:58 2013: (info) Presence handler called (None::unavailable)

Wed Apr 3 10:48:58 2013: (ok) Dispatching presence stanza with type->unavailable props->[] id->None

Wed Apr 3 10:48:58 2013: (ok) Got jabber:client/presence stanza

Wed Apr 3 10:48:58 2013: () UNregistered 22 (<xmppd.xmppd.Session instance at 0x108c9f368>)

Wed Apr 3 10:48:58 2013: (info) Presence handler called (None::unavailable)

Wed Apr 3 10:48:58 2013: (ok) Dispatching presence stanza with type->unavailable props->[] id->None

Wed Apr 3 10:48:58 2013: (ok) Got jabber:client/presence stanza

Wed Apr 3 10:48:58 2013: (error) Socket error while receiving data!

Wed Apr 3 10:48:58 2013: (info) Presence handler called (None::unavailable)

Wed Apr 3 10:48:58 2013: (ok) Dispatching presence stanza with type->unavailable props->[] id->None

Wed Apr 3 10:48:58 2013: (ok) Got jabber:client/presence stanza

Wed Apr 3 10:48:58 2013: () UNregistered 23 (<xmppd.xmppd.Session instance at 0x10986dd40>)

Wed Apr 3 10:48:58 2013: (info) Presence handler called (None::unavailable)

Wed Apr 3 10:48:58 2013: (ok) Dispatching presence stanza with type->unavailable props->[] id->None

Wed Apr 3 10:48:58 2013: (ok) Got jabber:client/presence stanza

Wed Apr 3 10:48:58 2013: (error) Socket error while receiving data!

Wed Apr 3 10:48:58 2013: (error) Peer [email protected] failed to authenticate

Wed Apr 3 10:48:58 2013: (sent) 23

Wed Apr 3 10:48:58 2013: (ok) Got challenge: '[email protected]\x00nodeMACJUANDALOCAL\x00secret'

Wed Apr 3 10:48:58 2013: (ok) Dispatching unknown stanza with type-> props->[] id->None

Wed Apr 3 10:48:58 2013: (warn) Unknown stanza: auth

Wed Apr 3 10:48:58 2013: (dispatch) bm9kZU1BQ0pVQU5EQUxPQ0FMQDEyNy4wLjAuMQBub2RlTUFDSlVBTkRBTE9DQUwAc2VjcmV0

Wed Apr 3 10:48:58 2013: (got) 23 bm9kZU1BQ0pVQU5EQUxPQ0FMQDEyNy4wLjAuMQBub2RlTUFDSlVBTkRBTE9DQUwAc2VjcmV0

Wed Apr 3 10:48:58 2013: (sent) 23 stream:featuresPLAIN/stream:features

Wed Apr 3 10:48:58 2013: (sent) 23 <stream:stream id="923431166240887" from="127.0.0.1" xmlns:db="jabber:server:dialback" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">

Wed Apr 3 10:48:58 2013: (got) 23 <stream:stream xmlns="jabber:client" to="127.0.0.1" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" >

Wed Apr 3 10:48:57 2013: (sent) 22

Wed Apr 3 10:48:57 2013: (info) save_database: User database saved!

Wed Apr 3 10:48:57 2013: (info) Registered user nodemacjuandalocal in domain 127.0.0.1

Wed Apr 3 10:48:57 2013: (info) with stanza nodeMACJUANDALOCALsecretnodeMACJUANDALOCAL

Wed Apr 3 10:48:57 2013: (info) Router handler called

Wed Apr 3 10:48:57 2013: (ok) Dispatching iq stanza with type->set props->[u'jabber:iq:register'] id->2

Wed Apr 3 10:48:57 2013: (ok) Got jabber:client/iq stanza

Wed Apr 3 10:48:57 2013: (dispatch) nodeMACJUANDALOCALsecretnodeMACJUANDALOCAL

Wed Apr 3 10:48:57 2013: (got) 22 nodeMACJUANDALOCALsecretnodeMACJUANDALOCAL

Wed Apr 3 10:48:57 2013: (sent) 22 Please specify name and password to register with

Wed Apr 3 10:48:57 2013: (info) with stanza

Wed Apr 3 10:48:57 2013: (info) Router handler called

Wed Apr 3 10:48:57 2013: (ok) Dispatching iq stanza with type->get props->[u'jabber:iq:register'] id->1

Wed Apr 3 10:48:57 2013: (ok) Got jabber:client/iq stanza

Wed Apr 3 10:48:57 2013: (dispatch)

Wed Apr 3 10:48:57 2013: (got) 22

Wed Apr 3 10:48:57 2013: (error) Peer [email protected] failed to authenticate

Wed Apr 3 10:48:57 2013: (sent) 22

Wed Apr 3 10:48:57 2013: (ok) Got challenge: '[email protected]\x00nodeMACJUANDALOCAL\x00secret'

Wed Apr 3 10:48:57 2013: (ok) Dispatching unknown stanza with type-> props->[] id->None

Wed Apr 3 10:48:57 2013: (warn) Unknown stanza: auth

Wed Apr 3 10:48:57 2013: (dispatch) bm9kZU1BQ0pVQU5EQUxPQ0FMQDEyNy4wLjAuMQBub2RlTUFDSlVBTkRBTE9DQUwAc2VjcmV0

Wed Apr 3 10:48:57 2013: (got) 22 bm9kZU1BQ0pVQU5EQUxPQ0FMQDEyNy4wLjAuMQBub2RlTUFDSlVBTkRBTE9DQUwAc2VjcmV0

Wed Apr 3 10:48:57 2013: (sent) 22 stream:featuresPLAIN/stream:features

Wed Apr 3 10:48:57 2013: (sent) 22 <stream:stream id="3436120583343476" from="127.0.0.1" xmlns:db="jabber:server:dialback" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">

Wed Apr 3 10:48:57 2013: (got) 22 <stream:stream xmlns="jabber:client" to="127.0.0.1" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" >

It seems that they could not auth. Whats going on? Thank!

My agent doesn't start

I just wrote my first agent program from the example that you give in the instructions, but when I run it, it just appears "Starting agent. . . " and it doesn't show the rest "Agent: [email protected] registered correctly (inform)".
I suposse it's something about the start method.
I'm using myhost as 127.0.0.1.
Could you please help me?
Thanks!

Cloning Agent behaviour

  • SPADE version:3.0
  • Python version:3.6
  • Operating System:Linux

Description

I have written a pyton class to demonstrate the agent. Can I send ejabbered ID and the password as parameters to this class and clone the behavior? I mean can I create more than one agent using the same python class?

xmpp.protocol.HostUnknown: (u'host-unknown', '')

Hi,

I followed the instructions on the page "My first SPADE agent" (http://spade.gti-ia.dsic.upv.es/manuals/html-chunk/spade.basicagents.first.html). But when I run my script file, it gives me this error on the console:

Traceback (most recent call last):
File "agent.py", line 24, in
a = MyAgent('agent@yalcin-comp', 'secret')
File "/usr/local/lib/python2.7/dist-packages/SPADE-2.1.1-py2.7.egg/spade/Agent.py", line 1843, in init
if not self._register(password):
File "/usr/local/lib/python2.7/dist-packages/SPADE-2.1.1-py2.7.egg/spade/Agent.py", line 1884, in _register
while not self.jabber.connect(use_srv=None) and tries > 0:
File "/usr/local/lib/python2.7/dist-packages/xmpp/client.py", line 200, in connect
if not CommonClient.connect(self,server,proxy,secure,use_srv) or secure<>None and not secure: return self.connected
File "/usr/local/lib/python2.7/dist-packages/xmpp/client.py", line 183, in connect
if not self.Process(1): return
File "/usr/local/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 305, in dispatch
handler'func'
File "/usr/local/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 218, in streamErrorHandler
raise exc((name,text))
xmpp.protocol.HostUnknown: (u'host-unknown', '')

I configured the package with different hostnames like "localhost" or "myhost.myprovider.com". But I always get this error.

What am I missing? Please help.

Error When executing runspade.py

I'm getting following error on both Ubuntu 12.04 and Mac.

SPADE 2.2 [email protected] - http://spade2.googlecode.com
Starting SPADE....
Traceback (most recent call last):
File "runspade.py", line 141, in main
platform.start()
File "/home/erandac/Development/spade/spade/spade_backend.py", line 47, in start
self.acc = self.runAgent(self.config, "acc", Platform.SpadePlatform)
File "/home/erandac/Development/spade/spade/spade_backend.py", line 28, in runAgent
agent = agentClass(jid, passwd, server, port, config=config)
File "/home/erandac/Development/spade/spade/Platform.py", line 99, in init
PlatformAgent.init(self, node, password, server, port, config=config, debug=[])
File "/home/erandac/Development/spade/spade/Agent.py", line 1567, in init
self._shutdown()
File "/home/erandac/Development/spade/spade/Agent.py", line 1630, in _shutdown
self.takeDown()
File "/home/erandac/Development/spade/spade/Platform.py", line 123, in takeDown
for k, _mtp in self.mtps.items():
AttributeError: 'SpadePlatform' object has no attribute 'mtps'
'SpadePlatform' object has no attribute 'mtps'
[failed]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.