Skip to main content

Python SDK for Intent Bus — a dead-simple distributed job bus

Project description

Intent Bus SDK 🚌

PyPI version License: MIT

The official Python client for the Intent-Bus Protocol.

Looking for the server code? > This repository is strictly the Python client SDK. If you want to host your own decentralized job bus, head over to the main Intent-Bus Core Repository.

Intent-Bus is a decentralized, BYOC (Bring Your Own Compute) automation protocol. This SDK allows you to easily publish tasks to your bus and spin up background workers on any machine with just a few lines of code.

Installation

pip install intent-bus

Zero-Config Authentication

The client automatically connects to the global public bus (dsecurity.pythonanywhere.com) and looks for your API key in the following order:

  1. Explicitly passed api_key argument.
  2. The INTENT_API_KEY environment variable.
  3. A local ~/.apikey file.

If you have your key saved in ~/.apikey, you can run the bus with zero configuration.

Quickstart

from intent_bus import IntentClient

# Automatically uses dsecurity.pythonanywhere.com and your local ~/.apikey
bus = IntentClient()

1. Publishing an Intent (The Producer)

Send data to the bus from any script, webhook, or server.

result = bus.publish(
    goal="notify",
    payload={"message": "System backup complete."}
)
print(f"Dispatched Intent ID: {result['id']}")

2. Listening for Intents (The Consumer)

Turn any machine into a background worker. The listen method automatically handles polling, network retries, claim locks, and fulfillment.

def trigger_alert(payload):
    print(f"Alert received: {payload['message']}")

bus.listen(goal="notify", handler=trigger_alert)

3. Ephemeral Store

The SDK also supports interacting with the Intent-Bus fast key-value store.

# Set a value with a 10-minute TTL
bus.set("last_sync_time", "1682800000", ttl=600)

# Retrieve the value
timestamp = bus.get("last_sync_time")

Custom Hosts (Self-Hosting)

If you are running your own private Intent-Bus server, simply pass your URL during initialization:

bus = IntentClient(host="[https://your-private-bus.com](https://your-private-bus.com)", api_key="your_key")

Error Handling

The SDK raises explicit exceptions for easy debugging:

  • IntentBusAuthError: Invalid or missing API key.
  • IntentBusRateLimitError: Too many requests within the 60-second window.
  • IntentBusError: Base class for other HTTP or routing failures.

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

intent_bus-1.0.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

intent_bus-1.0.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file intent_bus-1.0.1.tar.gz.

File metadata

  • Download URL: intent_bus-1.0.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/34.0 requests/2.32.5 requests-toolbelt/1.0.0 urllib3/2.6.3 tqdm/4.67.3 importlib-metadata/9.0.0 keyring/25.7.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.13.13

File hashes

Hashes for intent_bus-1.0.1.tar.gz
Algorithm Hash digest
SHA256 956222f5bd1af4980efda5359a18a1bfba89713da9c4b99701ba1ca8ecff1929
MD5 49180fe178d18fb1423bd5fa32750914
BLAKE2b-256 da637f93dd85502e4cbfdcddbc224942fc711b58f65dd35f2c6621381a2d7311

See more details on using hashes here.

File details

Details for the file intent_bus-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: intent_bus-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.12.1.2 readme-renderer/34.0 requests/2.32.5 requests-toolbelt/1.0.0 urllib3/2.6.3 tqdm/4.67.3 importlib-metadata/9.0.0 keyring/25.7.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.13.13

File hashes

Hashes for intent_bus-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1fa9ac494b69d91c1d893fd5e8dca17b37fe2f3eaa711302c85951e0f3bb1e66
MD5 7492f4a1597035c80a36c1c2c4daa1d0
BLAKE2b-256 05dadd7bcd850f38fb9bf62fdb616a9e6fec88515ab16642ab44f2ee84aa29f6

See more details on using hashes here.

Supported by

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