Skip to main content

spade_mqtt

The goal of this project is to implement a way to enable spade agents to interact (connect, subscribe, publish, ...) on MQTT.

Installation

pip install spade_mqtt

Getting started

Agent should use it by adding the MqttMixin in the class declaration. This mixin add the mqtt attribute in the agent class. This object wraps mqtt calls and manage asyncio.

class MyAgent(MqttMixin, spade.agent.Agent):

    async def setup(self):
        try:
            await self.mqtt.connect("localhost", 30)
        except TimeoutError:
            print("Warning: could not connect to MQTT brocker localhost")
        #...

Such agent can then have behaviour that can subscribe on topics, and await messages on them.

class MQTTSubBehaviour(spade.behaviour.CyclicBehaviour):
    """Behaviour that subscribes to a topic and store the messages received."""

    def __init__(self, topic):
        spade.behaviour.CyclicBehaviour.__init__(self)
        self.topic = topic

    async def run(self):
        print(f"awaiting message on topic {self.topic}")
        msg = await self.agent.mqtt.receive(self.topic)
        if msg:
            print(f"got message with payload {msg.payload}")
            # process the message...

    async def on_start(self):
        await self.agent.mqtt.subscribe(self.topic)

    async def on_end(self):
        await self.agent.mqtt.unsubscribe(self.topic)

MQTT publish is done likewise.

class MQTTPubBehaviour(spade.behaviour.OneShotBehaviour):
    """Publish hello world to example/topic"""

    async def run(self):
        await self.agent.mqtt.publish(
            "example/topic", "hello world", retain=True
        )

Metadata

Release files for spade-mqtt 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spade-mqtt 0.6.0
File Size Uploaded Provenance Actions
spade_mqtt-0.6.0.tar.gz 24.8 kB With provenance Details for spade_mqtt-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spade-mqtt 0.6.0
File Interpreter ABI Platform Actions
spade_mqtt-0.6.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for spade_mqtt-0.6.0-py2.py3-none-any.whl

Total release size: 42.8 kB

Release files / spade_mqtt-0.6.0.tar.gz

Download URL spade_mqtt-0.6.0.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e40e1bed4a8f9dc03e7cdf861b51bb01106badce5281fc71699860f9eb4b7c09
BLAKE2b-256 checksum
How to use checksums
86a25ea83d12e87a9edbf4d9adbd16365cc8c0b0d7eb67864e8e83fa2e988c2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.

Transparency log

Release files / spade_mqtt-0.6.0-py2.py3-none-any.whl

Download URL spade_mqtt-0.6.0-py2.py3-none-any.whl
Size 18.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f9de3e3de9b0880026fcfe3315ee04206a56182f980cb10a9c4d04d8b28f0391
BLAKE2b-256 checksum
How to use checksums
0da19b028b0f5c1397070cebe10d49b97f5f94d07eb229bd3e4fd7e034856495
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.

Transparency log

Security for spade-mqtt 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for spade_mqtt-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files Full provenance

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