The boring 90% of every bot, done for you: supervision, heartbeats, alerting, watchdog, dashboard, state.
Project description
bot-chassis
The boring 90% of every bot, done for you.
pip install bot-chassis
Anyone who has run a long-lived automation — a trading bot, an uptime monitor, a scraper, a report generator — ends up rebuilding the same plumbing: a scheduler loop, crash handling, restart logic, a way to know it's hung (not just dead), alerts to your phone, a kill switch, state that survives crashes, and a second process watching the first one. That plumbing is where the failures actually happen, and it has nothing to do with your domain.
chassis is that plumbing as a product. You write the 10% that's yours; it runs it like production infrastructure. Zero dependencies — pure Python stdlib, 3.11+.
A complete bot
from chassis import Bot
bot = Bot("uptime", log_file="uptime.log")
@bot.every(minutes=5)
def check():
if not site_is_up("https://example.com"):
bot.alert("DOWN: example.com")
bot.run()
That function now has, for free:
| You get | Meaning |
|---|---|
| Crash containment | An exception in a job is logged + alerted; the loop survives |
| Scheduling | @bot.every(minutes=5), @bot.daily_at("16:05", tz="America/New_York"), optional when= guards |
| Heartbeat | A file touched every minute so outside processes can detect hangs |
| Kill switch | Drop a STOP file → jobs pause, remove it → they resume |
| Alerts | bot.alert(...) → console, SMS (email-to-SMS gateway), or webhook (Slack/Discord/ntfy) |
| State | bot.state — atomic, crash-safe JSON that survives restarts |
A supervised fleet
Declare bots once in bots.toml:
[chassis]
alerts = ["sms", "console"]
digest_at = "16:35" # daily summary text
[[bot]]
name = "uptime"
command = "python3 uptime_bot.py"
heartbeat_max_minutes = 10
log = "uptime.log"
Then:
chassis run # spawn everything; restart crashes; give up on crash-loops; alert on hangs
chassis watch # independent watchdog — still texts you when the supervisor itself dies
chassis dash # mission control: http://localhost:8899 status page (+ /api/status JSON)
chassis init # starter bots.toml + hello bot
(python -m chassis works everywhere the chassis script does.)
The supervisor restarts bots that die (with rapid-crash backoff so a broken bot doesn't restart forever) and alerts on stale heartbeats. The watchdog runs as a separate process and re-checks everything from outside — processes, heartbeats, kill switch, error spikes in logs — with per-issue alert cooldowns and an optional daily digest and healthchecks.io ping. Domain checks plug in:
wd = Watchdog(load("bots.toml"))
@wd.add_check
def account_equity(): # anything that returns [(key, message)]
...
Troubleshooting
Every HTTPS request fails instantly with CERTIFICATE_VERIFY_FAILED (bot
jobs, the sms/webhook channels): your Python has no CA certificate bundle —
common with python.org installers on macOS. Either run the installer's
Install Certificates.command, or point Python at the system bundle:
export SSL_CERT_FILE=/etc/ssl/cert.pem
Provenance
Extracted from a live multi-bot trading system where every one of these features was added because its absence caused a real incident: a bot that ran dead for a day with no alert (supervision), a hung process that passed the liveness poll (heartbeats), burst SMS silently collapsed by the carrier (delivery slots), a crash mid-write corrupting state (atomic saves), a launcher that couldn't report its own death (external watchdog). That trading fleet runs on bot-chassis today — this package is its production supervisor, not a side project's abstraction of one.
Linux and macOS. Python 3.11+. Zero dependencies, and that's a promise, not a current status.
Layout
chassis/
runner.py Bot — the decorator API and job loop
supervisor.py fleet spawn/restart/heartbeat supervision
watchdog.py independent external health monitor
dashboard.py one-file status page + JSON API (localhost only)
notify.py alert fan-out: console / sms / webhook
state.py crash-safe JSON state
config.py bots.toml loader
examples/
uptime_bot.py a complete non-trading bot in ~40 lines
License
MIT.
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 bot_chassis-0.1.0.tar.gz.
File metadata
- Download URL: bot_chassis-0.1.0.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf785d7b2af905be439fe3cd3aff612a056ed0888038220c0ed48633f11622c3
|
|
| MD5 |
22f62f5f8dce9409b5fc020ac6765b9e
|
|
| BLAKE2b-256 |
c4f899c733a7be74699abc17d0d5463987c970cb87dc6407a0f85c27170b62ff
|
Provenance
The following attestation bundles were made for bot_chassis-0.1.0.tar.gz:
Publisher:
publish.yml on chrismance3-star/bot-chassis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bot_chassis-0.1.0.tar.gz -
Subject digest:
cf785d7b2af905be439fe3cd3aff612a056ed0888038220c0ed48633f11622c3 - Sigstore transparency entry: 2138612961
- Sigstore integration time:
-
Permalink:
chrismance3-star/bot-chassis@3242092ac5cc6efb35904887fa55f00c1cf4ee49 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/chrismance3-star
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3242092ac5cc6efb35904887fa55f00c1cf4ee49 -
Trigger Event:
release
-
Statement type:
File details
Details for the file bot_chassis-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bot_chassis-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5ca2777ac23e072db5fe7e48582aba0af76236cbedcff22c6ee20f01a928869
|
|
| MD5 |
2ae46430b881ffc3b3270762cdd57008
|
|
| BLAKE2b-256 |
d1c14b6bf782f1461c8656113cc956d850190c3187bff22502fb71f258d29146
|
Provenance
The following attestation bundles were made for bot_chassis-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on chrismance3-star/bot-chassis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bot_chassis-0.1.0-py3-none-any.whl -
Subject digest:
d5ca2777ac23e072db5fe7e48582aba0af76236cbedcff22c6ee20f01a928869 - Sigstore transparency entry: 2138612987
- Sigstore integration time:
-
Permalink:
chrismance3-star/bot-chassis@3242092ac5cc6efb35904887fa55f00c1cf4ee49 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/chrismance3-star
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3242092ac5cc6efb35904887fa55f00c1cf4ee49 -
Trigger Event:
release
-
Statement type: