The first open-source, self-funding, self-healing AI daemon โ for agents on Orbio.
Orbio ่ฎฉไฝ ็จๆๅธๅฐฑ่ฝ่ต LLM ้ขๅบฆ,ไฝ่ฟๆฏ่ฆๆไบบ claim keyใwatch ไฝ้ขใrotate ๆง keyใ BagBot ๆฏ็ฌฌไธไธชๆ่ฟไบ่ๆดป็ดฏๆดปๅฎๅ จ่ชๅจๅใๅนถๆฏๆไธญๆ้็ฅ็ daemonใ ไฝ ็ Agent ไธๅ้่ฆไฝ ๅ ้ฑ, ๅฎไผ่ชๅทฑ็ฎก่ชๅทฑใ
Orbio lets you earn LLM credits just by holding tokens โ but somebody still has to claim keys, watch balances, and rotate old ones. BagBot is the first daemon that fully automates all that messy work, with Chinese-language notifications built in. Your agent no longer needs you to top it up โ it manages itself.
BagBot is a 7ร24 unattended Python daemon built on the live Orbio gateway API (5 tools, schema verified against production 2026-09-08):
- Monitors your spendable balance via
orbio_get_balance(every 5 min) โ in the gateway model the balance IS the quota - Creates the key the moment your account has none (
orbio_create_key) โ a key is free; it just spends the balance - Watches key health via
orbio_get_key_status(per-account, no key id needed) - Rotates on age hygiene โ
orbio_create_keyagain retires the old key atomically - Revokes on leak detection โ if the burn rate spikes (
orbio_revoke_key), then recreates on the next tick - Cleans up legacy pre-gateway Orbio keys with a refund (
orbio_delete_key) - Alerts when the spendable balance runs low โ "hold more $ORBIO"
- Reports everything to WeChat / Feishu / Email / Webhook in Chinese + a local dashboard
- Runs as a service via
launchd(macOS) /systemd(Linux)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ BagBot โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Daemon โโโโโถโ Orbio MCP Client โ โ
โ โ (asyncio) โ โ (5 tools wrapper) โ โ
โ โโโโโโโฌโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโถ State Store (SQLite) โ
โ โโโโโโถ Notifiers (ไธญๆไผๅ
) โ
โ โ โโโ WeChat Work / ๅ
ฌไผๅท โ
โ โ โโโ Feishu / Lark webhook โ
โ โ โโโ Email (SMTP) โ
โ โ โโโ Generic Webhook โ
โ โโโโโโถ FastAPI Dashboard (Chinese) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# 1. Install
git clone https://github.com/keyneszeng/bagbot.git
cd bagbot
make install # creates .venv, installs deps, copies .env.example โ .env
# 2. See it work โ zero-config, no token needed
python scripts/demo_e2e.py # 5-tick end-to-end demo (mock MCP, prints everything)
# 3. Configure (only needed to connect to real Orbio)
vim .env # fill in ORBIO_MCP_TOKEN + ORBIO_WALLET (+ a notifier)
# 4. Verify
make test # 97 unit + integration tests, ~45s
make probe # exercises all 6 Orbio MCP tools (real network)
# 5. Start daemon (foreground)
make run
# or, as a 7ร24 service:
bash scripts/install_launchd.sh # macOS
bash scripts/install_systemd.sh # LinuxFirst time? Run
python scripts/demo_e2e.pybefore touching.envโ it shows the full create โ healthy โ rotate โ revoke โ alert loop with zero setup.
ๅฎๆดไธญๆๅฎๆๆๅ: docs/guide.zh-CN.md
| File | What it does |
|---|---|
src/bagbot/orbio_mcp.py |
Async client wrapping all 6 Orbio MCP tools (with retry) |
src/bagbot/daemon.py |
Core 7ร24 event loop (monitor โ decide โ act โ report) |
src/bagbot/policy.py |
Pure-function decision engine (CLAIM/TOPUP/ROTATE/DELETE/ALERT) |
src/bagbot/state.py |
SQLite state store (keys, balances, events) |
src/bagbot/notifier.py |
4 notifier adapters (Feishu, WeChat, Webhook, SMTP), Chinese templates |
src/bagbot/dashboard.py |
FastAPI web UI (Chinese-first, dark theme) |
scripts/install_launchd.sh |
One-command macOS service install |
scripts/install_systemd.sh |
One-command Linux service install |
scripts/mutation_test.py |
Crash-safe mutation tester (used in CI nightly) |
tests/test_*.py |
80 tests across 8 modules (~30s, parallel) |
docs/guide.zh-CN.md |
283-line Chinese user guide |
docs/BUILD_WEEK.md |
Pre-filled Build Week application text |
skills/bagbot/ |
Installable Agent Skill (SKILL.md + zero-config Python facades) |
scripts/install_skill.sh |
One-command skill installer โ Claude/Codex/Gemini/agents skill dirs |
CHANGELOG.md |
Version history with bug-fix attribution |
pyproject.toml |
ruff + mypy + pytest configuration |
BagBot also ships as an Agent Skill that any LLM agent (Claude Code, Codex, Gemini CLI, or a generic agent runtime) can pick up:
bash scripts/install_skill.sh # symlinks into ~/.claude/skills, ~/.codex/skills, โฆ
# or target one: SKILL_DEST=~/.claude/skills bash scripts/install_skill.shOnce installed, an agent can use the skill's zero-config facades:
PYTHONPATH=skills/bagbot/scripts python3 skills/bagbot/scripts/bagbot_cli.py decide 10.0
# โ action: create | reason: no key yet; creating (key is free, spends balance)| Tool | Status | Where |
|---|---|---|
| Unit + integration tests | 80 passing, ~30s | tests/, runs in CI on Python 3.10/3.11/3.12 |
| Mutation testing | nightly, score: policy 92.9% / daemon 94.1% | scripts/mutation_test.py, runs in CI nightly |
| Ruff lint | passing | pyproject.toml ([tool.ruff.lint]) |
| MyPy type check | passing | pyproject.toml ([tool.mypy]) |
| Shellcheck | passing | .github/workflows/ci.yml |
| Pre-commit safety | secrets in .gitignore, MCP secrets redacted in CLI output |
_redact() in src/bagbot/cli.py |
Run all checks locally:
make test # 80 tests
ruff check src/ tests/ # lint
mypy src/ # type check
python scripts/mutation_test.py --module policy # ~90sThis project was built in 7 days for Orbio Build Week
(7-day competition, 8M $ORBIO prize, 10 winners).
Builder: @keyneszeng ยท X: @keyneszeng Live project: github.com/keyneszeng/bagbot
MIT โ take anything. Same as orbio-starter.