Python SDK for Intent Bus — a dead-simple distributed job bus
Project description
Intent Bus SDK
The official Python SDK for Intent Bus, a lightweight distributed job bus implementing the Intent Protocol v7.5.
Looking for the server?
This repository contains the Python SDK and Worker Runtime.
Protocol server implementation: https://github.com/dsecurity49/Intent-Bus
Quickstart (30 seconds)
1. Install
pip install intent-bus
2. Publish an intent
from intent_bus import IntentClient
bus = IntentClient()
bus.publish(
goal="notify",
payload={"message": "Hello World"},
namespace="default"
)
3. Run a worker
from intent_bus import IntentClient
bus = IntentClient()
def handler(payload):
print("Received:", payload)
return {"status": "done"}
bus.listen(
goal="notify",
handler=handler,
namespace="default"
)
Done. You now have a working distributed job pipeline.
Versioning Model
- SDK Version:
v1.3.0 - Protocol Version:
Intent Protocol v7.5
The SDK evolves independently while maintaining compatibility with the stable protocol specification.
New in SDK v1.3.0 (Protocol v7.5 Support)
- First-Class CLI – Run workers and publish intents directly from the terminal
- Namespace Routing – Isolated execution domains for intents
- Structured Fulfillment – Workers can return structured metadata
- Reliable Claim Model – Safe at-least-once execution with retry awareness
- Server-driven Backoff – Respects Retry-After headers for idle scaling
Installation
pip install intent-bus
Command Line Interface (CLI)
The SDK includes a production-ready CLI for both workers and publishers.
Start a worker node
intent-bus listen notify --namespace prod --worker-id worker-01
With capabilities
intent-bus listen notify \
--namespace prod \
--worker-id worker-01 \
--capabilities python,notify
Publish an intent
intent-bus publish notify '{"message": "Hello World"}' --namespace prod
Publish publicly
intent-bus publish notify '{"message": "Hello World"}' --namespace prod --public
WARNING: Always wrap JSON payloads in single quotes in shells (Termux/Linux especially).
Automatic Credential Resolution
- Constructor:
IntentClient(api_key="...")
- Environment:
export INTENT_API_KEY="..."
- Local file:
~/.apikey (chmod 600 required)
SDK Usage
Worker (Consumer)
from intent_bus import IntentClient
bus = IntentClient()
def handle_task(payload):
print(f"Processing: {payload}")
return {
"status": "success",
"processed_by": "worker-01"
}
bus.listen(
goal="video_render",
handler=handle_task,
namespace="heavy-tasks",
capabilities="gpu,ffmpeg"
)
Handler Semantics
| Return Value | Meaning |
|---|---|
| dict | Structured fulfill payload |
| True / None | Default fulfillment |
| False | Mark job as failed |
Publisher (Producer)
bus.publish(
goal="video_render",
payload={"id": 101, "format": "mp4"},
namespace="heavy-tasks",
visibility="private"
)
CLI Worker Behavior
- Workers poll continuously for jobs
- Server controls idle backoff via Retry-After
- At-least-once delivery model
- Workers must be idempotent
Core Concepts
Namespaces
- default -> general queue
- prod -> production workloads
- heavy-tasks -> compute-heavy workloads
Namespaces are enforced server-side as routing isolation domains.
Workers
Workers:
- claim jobs
- execute handlers
- report success/failure
Identified by:
- worker_id
- capabilities
Capabilities
Example:
python,notify,gpu,ffmpeg
Used to filter eligible workers.
Error Handling
The SDK raises structured exceptions for predictable failure handling.
Exception Types
| Exception | When it occurs |
|---|---|
IntentBusAuthError |
Invalid API key, authentication failure |
IntentBusRateLimitError |
Server rate limit exceeded (HTTP 429) |
IntentBusError |
General SDK or server-side error |
Example: Safe Error Handling
from intent_bus import IntentClient
from intent_bus.exceptions import (
IntentBusError,
IntentBusAuthError,
IntentBusRateLimitError
)
bus = IntentClient()
try:
result = bus.publish(
goal="notify",
payload={"message": "hello"}
)
except IntentBusAuthError:
print("Invalid API key")
except IntentBusRateLimitError:
print("Rate limited, retry later")
except IntentBusError as e:
print(f"General SDK error: {e}")
Reliability Model
| Property | Behavior |
|---|---|
| Delivery | At-least-once |
| Retry | SDK + server retry support |
| Claim | Atomic fetch |
| Fulfill | Final state transition |
| Idle | Retry-After backoff |
Workers must be idempotent.
Security Model
- Payloads are untrusted input
- Never expose secrets in intents
- Public intents are broadcast to fleet
- API key required for all mutations
Safety Guarantees
| Operation | Behavior |
|---|---|
| publish | Idempotent |
| set | Idempotent KV store |
| claim | Atomic |
| fulfill | Final |
| fail | Terminal |
Failure Handling
- Network failures retry where safe
- claim is not retried automatically
- server may return 204 + Retry-After
- failed jobs may enter dead-letter state
License
MIT License © 2026 dsecurity49
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file intent_bus-1.3.1.tar.gz.
File metadata
- Download URL: intent_bus-1.3.1.tar.gz
- Upload date:
- Size: 12.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.33.1 requests-toolbelt/1.0.0 urllib3/2.6.3 tqdm/4.67.3 importlib-metadata/8.5.0 keyring/25.7.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef6861a3861a2d292cca0553b0bc5c80c54f0ec80427f2e65127be4e24f37906
|
|
| MD5 |
c40913f4593d51dc0aac5dba98096d1f
|
|
| BLAKE2b-256 |
7e809f481954e348424c214da7c1237d2143bfb9580ee1d86beeee3fabcaa062
|
File details
Details for the file intent_bus-1.3.1-py3-none-any.whl.
File metadata
- Download URL: intent_bus-1.3.1-py3-none-any.whl
- Upload date:
- Size: 10.3 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.33.1 requests-toolbelt/1.0.0 urllib3/2.6.3 tqdm/4.67.3 importlib-metadata/8.5.0 keyring/25.7.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8920087055fdde1adb8c206b50bcb22d12c6575507a39e9c4986f77756125c67
|
|
| MD5 |
6c5e862453113d72a40e7896f2c7210c
|
|
| BLAKE2b-256 |
8bfd867497a938ae8bba9985803e7b3d2fec482fd93a28f00742a3e8839879f5
|