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.0.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.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: intent_bus-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 6370062a1bf1638297bfeed91cacb4be53db4011301b4807c3560bdf84d802f1
MD5 bbd4701f0690d17873b71f3e15f1f0f3
BLAKE2b-256 fa844d05283955dfb1437b1a5c2730756f12f5d1b2591793f42571efb6e0d0e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: intent_bus-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16cd09ead38e4549d616a3f7f50ee4b16a87f945772a4ade16010c831b7c2df8
MD5 c0da5116b86c3830de8e7eb0c83ed161
BLAKE2b-256 e0f07ef3d2a65976df5804b1b9203bc5e118683beba438e4a36d3116e4eb9d0f

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