lockbot
Cluster resource management and queuing for Infoflow and Feishu.
Lock and unlock GPU devices, cluster nodes, and queue slots via chat commands. Runs as a multi-bot platform with FastAPI and a Vue.js frontend.
Features
- Device Lock Bot — Lock/unlock individual GPUs or devices on a cluster
- Node Lock Bot — Lock/unlock entire cluster nodes
- Queue Bot — Manage a queue for resource allocation with booking and preemption
- Device Queue Bot — Book and queue for individual cards with
QUEUE_DEVICE - Agent integration — Personal authorization, resource discovery and versioned Skills
- Utilization — Optional browser/Agent access to independent Prometheus data sources
- Platform Mode — Web UI (Vue 3 + Element Plus) for managing multiple bots, user authentication (JWT), role-based access control, and real-time logs
- State Persistence — Bot state survives restarts (JSON file)
- Bilingual — English and Chinese UI and bot responses
Quick Start — Docker
The published image includes the web UI and Feishu dependencies. Prepare a private environment file with JWT_SECRET and ENCRYPTION_KEY following the deployment guide. For upgrades, keep the original keys and data volume.
docker pull ghcr.io/dynamicheart/lockbot:v3.0.0
docker run -d --name lockbot -p 8000:8000 \
--env-file /private/path/lockbot.env \
-v lockbot-data:/data \
ghcr.io/dynamicheart/lockbot:v3.0.0
# New installation only: create the initial super administrator interactively.
docker exec -it lockbot python tools/create_super_admin.py --username admin --email admin@example.com
Open http://localhost:8000. Data persists under /data; select the intended host port without replacing an upgrade's existing mount. Run a single process/instance per data directory.
- Agent-assisted deployment and upgrades, including environment validation and a Compose template
- Infoflow and Feishu setup and illustrated Feishu guide
- Agent API and Skill
- Independent telemetry deployment and browser utilization
In Feishu, one enterprise application can serve multiple resource groups, with a separate resource bot per group. Direct messages are unsupported. Platform credentials and users remain separate from Infoflow; copying configuration does not share live locks or authorizations.
Bot Configuration
| Key | Description | Default |
|---|---|---|
BOT_TYPE |
NODE, DEVICE, QUEUE, or QUEUE_DEVICE |
(required) |
BOT_NAME |
Bot instance name | demo_bot |
CLUSTER_CONFIGS |
Cluster layout (dict or list) | {} |
TOKEN |
Infoflow signature verification token | "" |
AESKEY |
Infoflow message decryption AES key | "" |
WEBHOOK_URL |
Infoflow message webhook URL | "" |
DEFAULT_DURATION |
Default lock duration (seconds) | 7200 (2h) |
MAX_LOCK_DURATION |
Max lock duration (seconds) | -1 (unlimited) |
EARLY_NOTIFY |
Notify before lock expiry | false |
FORBID_RELOCK |
Reject renewal and longer booking claims when explicitly enabled per bot | false |
MAX_RESOURCES_PER_USER |
Held + booked resources per user/bot; nodes for NODE/QUEUE, cards for DEVICE/QUEUE_DEVICE | -1 (unlimited) |
See python/lockbot/core/config.py for the full configuration reference.
Commands
| Command | Description |
|---|---|
lock <node> [duration] |
Exclusive lock (e.g., lock gpu0 3d, lock node1 30m) |
slock <node> [duration] |
Shared lock (multiple users) |
unlock <node> / free <node> |
Release a specific node |
unlock / free |
Release all your nodes |
kickout <node> |
Force release (admin) |
book <node> [duration] |
Queue: book a node for later |
take <node> |
Queue: take the current lock |
<node> |
Query current usage |
help |
Show usage |
Development
Dev Server
# Install dependencies
pip install -e ".[dev,feishu]"
cd frontend && npm install && cd ..
# Start backend (port 8002, hot-reload)
bash scripts/dev/backend.sh
# Start frontend (port 8001, proxies /api/* -> localhost:8002)
bash scripts/dev/frontend.sh
Open the frontend at http://localhost:8001; it proxies API requests to port 8002. These hot-reload scripts are for development, not production. New development targets main.
Testing
# Run tests with file-isolated parallel workers
pytest -n auto --maxprocesses=4 --dist=loadfile
# Lint + format check
ruff check python/ tests/
ruff format --check python/ tests/
Migrating an older standalone deployment
The deprecated Flask entry (lockbot.core.entry.create_app / run_bot) and process-global
Config.get/set/load_from_file/load_from_env API have been removed. Bot construction no
longer starts a private scheduler. The supported deployment is the FastAPI platform above,
including when managing only one bot. Existing platform Docker deployments keep the same
startup command, ports and persistent data layout; no database reset is required.
For an old standalone deployment:
- Keep a backup of its configuration and JSON state before stopping its old webhook server.
- Start the platform, create the matching bot type, and copy its cluster, messaging credentials and runtime rules into the bot editor. Do not publish credentials in logs.
- Restore the saved cluster state through the platform's existing cluster-state import while the bot is stopped. Verify resource names, holders, expiry and queues before start. Do not copy old state over an unrelated bot's directory or remove the old data volume.
- Point the messaging platform callback at
/api/bots/webhook/{bot_id}and start the bot. Keep the previous image and backup until the new callback and expiry checks work.
The core bot classes remain independently constructible for tests, with per-instance
Config objects. Platform scheduling, persisted state formats and legacy state migrations
remain supported. Independent utilization collection and Prometheus setup are documented
in Resource exporter.
License
MIT
Metadata
Release files for lockbot 3.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lockbot-3.3.1.tar.gz | 348.8 kB | With provenance | Details for lockbot-3.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lockbot-3.3.1-py3-none-any.whl | Python 3 | none | any | Details for lockbot-3.3.1-py3-none-any.whl |
Total release size: 749.6 kB
Release files / lockbot-3.3.1.tar.gz
| Download URL | lockbot-3.3.1.tar.gz |
|---|---|
| Size | 348.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b112a12f6b20ae38baa3666bbd6cd2a3dbfed09368be9c938f0499962017289e
|
|
BLAKE2b-256 checksum How to use checksums |
4ded227768c73f43a94a072ce303be9fbeee4e436e544edd336afa863341e614
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / lockbot-3.3.1-py3-none-any.whl
| Download URL | lockbot-3.3.1-py3-none-any.whl |
|---|---|
| Size | 400.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17a5780adf6e3ed0d93f0db26a8af677764bec319dff5c78225955d2d0bd615f
|
|
BLAKE2b-256 checksum How to use checksums |
874f890e257c2d8bcb4e03b2a96ccaa9025601a2dc58d0f3b3d47c09639918d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for lockbot 3.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for lockbot-3.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.