Skip to main content

Minimal single-agent gateway with ACP backends, skills, and messaging adapters

Project description

onebot

onebot 是一個以 Python + uv 打造的精簡 single-agent 框架,支援:

  • CLI 與 Web(FastAPI + Uvicorn)
  • Telegram / LINE 作為訊息 I/O
  • Skills(相容 OpenClaw / SKILLS 的 SKILL.md 規範)
  • ClawHub skill 搜尋 / 安裝(透過官方 clawhub CLI)
  • ACP backend 切換:gemini --acpcopilot --acpclaude-code-acp
  • MCP servers(透過 ACP backend 傳入)

PyPI distribution 名稱:onebot-agent(CLI 指令:onebot


1) 需求

  • Python 3.11+
  • uv

依你選的 backend,還需要:

  • Claude:claude-code-acp(由 Python 套件安裝),以及 Claude CLI 已完成登入
  • Gemini:gemini CLI(ACP 模式)
  • Copilot:copilot CLI(ACP 模式)

若要使用 ClawHub skills:

  • clawhub CLI(例如:npm i -g clawhub

2) 安裝與開發

# 進入專案
cd onebot

# 安裝(含 dev)
uv sync --dev

# 看指令
uv run onebot --help

3) 快速開始

3.1 本地單次對話(ACP backend)

export ONEBOT_ACP_BACKEND=claude
uv run onebot chat "請幫我建立一個 hello.py"

切換 backend:

# Gemini
export ONEBOT_ACP_BACKEND=gemini
export ONEBOT_ACP_COMMAND=gemini
export ONEBOT_ACP_ARGS="--experimental-acp"

# Copilot
export ONEBOT_ACP_BACKEND=copilot
export ONEBOT_ACP_COMMAND=copilot
export ONEBOT_ACP_ARGS="--acp"

3.2 啟動 Web API

uv run onebot web --host 127.0.0.1 --port 18790

可用端點:

  • GET /health
  • GET /skills
  • GET /adapters
  • GET /config
  • POST /line/webhook

3.3 啟動 Telegram polling

export ONEBOT_TELEGRAM_TOKEN=<your-bot-token>
uv run onebot telegram

3.4 LINE webhook

  1. 設定:
export ONEBOT_LINE_CHANNEL_SECRET=<secret>
export ONEBOT_LINE_CHANNEL_ACCESS_TOKEN=<token>
  1. 啟動 Web:
uv run onebot web --host 0.0.0.0 --port 18790
  1. 在 LINE Developers 把 webhook URL 設為:
https://<your-domain>/line/webhook

4) Skills / ClawHub

列本地 skills:

uv run onebot skill list
uv run onebot skill list --all

搜尋 / 安裝 / 更新(透過 clawhub CLI):

uv run onebot skill search "postgres backups"
uv run onebot skill install my-skill
uv run onebot skill update my-skill
uv run onebot skill update --all

進階 passthrough:

uv run onebot skill clawhub list

5) MCP 設定

透過 ONEBOT_MCP_SERVERS 以 JSON 陣列提供(會傳入 ACP backend):

export ONEBOT_MCP_SERVERS='[
  {
    "name": "my-mcp",
    "command": "uvx",
    "args": ["my-mcp-server"]
  }
]'

注意:不同 backend 對 MCP 的支援程度不同(例如 Gemini 通常需要先在 CLI 內預先配置)。


6) 主要環境變數

  • ONEBOT_WORKSPACE(預設 ~/.onebot
  • ONEBOT_ACP_BACKENDclaude|gemini|copilot
  • ONEBOT_ACP_COMMAND:覆寫 backend command
  • ONEBOT_ACP_ARGS:覆寫 backend args(shell 字串)
  • ONEBOT_MCP_SERVERS:MCP servers JSON 陣列
  • ONEBOT_TELEGRAM_TOKEN
  • ONEBOT_LINE_CHANNEL_SECRET
  • ONEBOT_LINE_CHANNEL_ACCESS_TOKEN

7) 測試與品質

uv run ruff check .
uv run pytest -q

8) 發佈流程(GitHub Release -> PyPI)

本專案已提供:

  • .github/workflows/ci.yml:push / PR 執行 lint + test
  • .github/workflows/publish.yml:Release published 時 build + publish

建議使用 PyPI Trusted Publisher(OIDC):

  1. 在 PyPI 專案設定 Trusted Publisher 指向本 GitHub repo/workflow
  2. GitHub 建立 Release(Published)
  3. workflow 自動 uv build 並上傳 dist/* 到 PyPI

9) 安全說明(目前)

  • ACP 的檔案讀寫與終端執行有 workspace 限制與危險指令 deny patterns。
  • 目前屬 MVP 安全層;高隔離場景建議後續加 Docker sandbox。

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

onebot_agent-0.1.0.tar.gz (63.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onebot_agent-0.1.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file onebot_agent-0.1.0.tar.gz.

File metadata

  • Download URL: onebot_agent-0.1.0.tar.gz
  • Upload date:
  • Size: 63.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for onebot_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d653d36fa4e7a99e03957d62d841bda405173786c82cb5d58d3c5d8369af06b8
MD5 de70db7a97d42e2b6f3089e9ab12995d
BLAKE2b-256 8321a7494142ae0ef66183fd47884d819b08ab99c6c788a86e528920cf41e503

See more details on using hashes here.

Provenance

The following attestation bundles were made for onebot_agent-0.1.0.tar.gz:

Publisher: publish.yml on yazelin/onebot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file onebot_agent-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: onebot_agent-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for onebot_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55df018af7c74a54b49e089d68212ba938d52d5e9d57301f16eda355e7bbe238
MD5 a366dfd0147f994cb7e655a999482124
BLAKE2b-256 a007805f2e1bf53df9ffd1a20a557f05611685bcbb2fdadff3b1038f96a6d694

See more details on using hashes here.

Provenance

The following attestation bundles were made for onebot_agent-0.1.0-py3-none-any.whl:

Publisher: publish.yml on yazelin/onebot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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