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.2.tar.gz (5.7 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.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: intent_bus-1.0.2.tar.gz
  • Upload date:
  • Size: 5.7 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.2.tar.gz
Algorithm Hash digest
SHA256 58f9698c8e796711491364dabb3823c85549f873448a27ed11b9a6a7e4efb949
MD5 7b9e7c7c975bca5d6ee0cf3929e8bb5c
BLAKE2b-256 efe95c89f4ad89217bd9f24d796e9cfce58286c7735c42d0b150eed37851ae0a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: intent_bus-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 336ff8449d732ab89686e7460030b29db1c5df72e4f5ea18895ce457835f03c8
MD5 7ecb0684d6f1a249f0963db20bc19fb9
BLAKE2b-256 4d591ba86255be92e4ee5871a291c52bfacb86c7dc89ab02e9e3a440265a0c02

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