2026-03-13 15:52:40 +08:00
2026-03-13 15:52:40 +08:00
2026-03-13 15:52:40 +08:00
2026-03-13 15:52:40 +08:00
2026-03-13 15:52:40 +08:00
2026-03-13 12:33:54 +08:00
2026-03-13 15:52:40 +08:00
2026-03-13 14:55:41 +08:00
2026-03-13 15:52:40 +08:00
2026-03-13 14:55:41 +08:00

VoidBot

VoidBot is a minimal Python agent runtime designed around three ideas:

  • Borrow the lightweight execution loop and session persistence style from nanobot.
  • Borrow the provider compatibility and gateway/runtime separation from openclaw.
  • Keep the first version small: direct CLI or standalone gateway, provider compatibility, tool loop, and persistent session state.

Architecture

CLI Agent
  -> AgentRuntime
    -> ContextBuilder
    -> SQLite SessionStore
    -> ToolRegistry
    -> ProviderManager
      -> OpenAI Compatible Provider

Gateway Server
  -> GatewayApplication
    -> AgentRuntime
    -> ChannelManager
      -> Feishu
      -> QQ

See docs/architecture.md for the layer breakdown and message flow.

Initial Capabilities

  • Build runtime context from workspace metadata, system prompt, tool list, and session history
  • Call an OpenAI-compatible chat completions endpoint
  • Execute tools and feed tool results back into the model loop
  • Run as a direct CLI agent or through a standalone gateway process
  • Let the standalone gateway listen on HTTP, Feishu, and QQ at the same time
  • Persist sessions, messages, and session metadata in SQLite
  • Isolate transcript history by session_id, so each chat keeps its own context
  • Support multiple configured model endpoints and switch per session
  • Support provider presets for:
    • openai_chatgpt
    • zhipu_coding_plan
    • custom_openai_compatible

Quick Start

  1. Create a config file:
{
  "provider": "zhipu_coding_plan",
  "api_key": "YOUR_API_KEY",
  "model": "glm-4.7",
  "workspace": ".",
  "max_iterations": 8
}

You can also start from config.example.json.

  1. Sync the default user config into ~/.voidbot/config.json:
uv run voidbot config sync

This command is incremental:

  • it creates ~/.voidbot/config.json if it does not exist
  • it adds new fields from the latest example template
  • it does not delete your custom fields
  • it does not overwrite values you already filled in
  1. Check or open the config path when needed:
uv run voidbot config path
uv run voidbot config open
  1. Edit ~/.voidbot/config.json with your real values.

  2. Start the CLI directly:

uv run voidbot
  1. Run one turn locally:
uv run voidbot --message "Summarize this repository"
  1. Start the standalone gateway:
uv run voidbot gateway
  1. Call the agent through the HTTP gateway:
uv run voidbot --via gateway --message "Summarize this repository"
  1. Run interactive mode with automatic fallback:
uv run voidbot --via auto
  1. Inspect stored SQLite data:
uv run voidbot data dump

Config Fields

  • default_provider: default provider id for new sessions
  • providers: a list of configured model endpoints
  • providers[].id: stable numeric or string id used for switching
  • providers[].preset: provider preset name
  • providers[].api_key: provider API key
  • providers[].api_base: optional base URL override
  • providers[].model: optional model override
  • providers[].label: optional display name
  • workspace: workspace path used by tools and context
  • database_path: optional SQLite database path
  • max_iterations: max tool-call rounds in one turn
  • history_limit: number of previous messages to include
  • system_prompt: optional custom system prompt
  • gateway_host: default gateway bind host
  • gateway_port: default gateway bind port
  • gateway_url: optional default gateway URL for CLI client mode
  • cli_via: default CLI behavior, one of local, gateway, or auto
  • channels.feishu.enabled: enable Feishu long-connection listener
  • channels.feishu.app_id: Feishu app ID
  • channels.feishu.app_secret: Feishu app secret
  • channels.feishu.group_policy: mention or open
  • channels.qq.enabled: enable QQ bot listener
  • channels.qq.app_id: QQ bot app ID
  • channels.qq.secret: QQ bot secret

Channel Gateway

The voidbot gateway process can expose the same runtime in three ways at once:

  • HTTP requests on /v1/agent/run
  • Feishu events through lark-oapi WebSocket long connection
  • QQ bot events through qq-botpy

Example channel config:

{
  "provider": "openai_chatgpt",
  "api_key": "YOUR_API_KEY",
  "workspace": ".",
  "channels": {
    "feishu": {
      "enabled": true,
      "app_id": "cli_xxx",
      "app_secret": "xxx",
      "group_policy": "mention"
    },
    "qq": {
      "enabled": true,
      "app_id": "1024xxxx",
      "secret": "xxx"
    }
  }
}

Platform notes:

  • Feishu: enable bot capability and subscribe to im.message.receive_v1.
  • QQ: enable C2C messages and group @bot messages for the app.
  • Every Feishu or QQ chat is mapped to its own session_id, so contexts do not leak across chats.
  • Model switching is stored per session, so each chat can stay on its own provider.

Model Switching

Each configured provider has an id, for example:

{
  "default_provider": "1",
  "providers": [
    { "id": "1", "preset": "zhipu_coding_plan", "api_key": "...", "model": "glm-4.7" },
    { "id": "2", "preset": "openai_chatgpt", "api_key": "...", "model": "gpt-4.1-mini" }
  ]
}

Inside a conversation, you can switch the current session model dynamically:

/models
/use 2
  • /models lists all configured providers
  • /use <id> switches only the current session
  • The selected provider id is stored in SQLite session metadata

User Home Layout

VoidBot now keeps user-level state under ~/.voidbot by default.

  • ~/.voidbot/config.json: default config file
  • ~/.voidbot/voidbot.db: SQLite database for sessions, metadata, and messages
  • ~/.voidbot/cli_history: interactive CLI input history

Config lookup order without --config:

  1. ./config.json
  2. ~/.voidbot/config.json

Useful command:

uv run voidbot config sync

This command analyzes the existing JSON structure and only adds missing fields from the latest example config.

Useful data command:

uv run voidbot data dump
uv run voidbot data dump --session-id main

Notes

  • The model layer is deliberately OpenAI-compatible first, so adding more gateways later is straightforward.
  • The current built-in tools are list_dir, read_file, write_file, and run_command.
  • Every inbound request gets session_id, run_id, and message_id before entering the runtime.
  • voidbot agent --via auto tries the gateway first, then falls back to local execution.
  • voidbot without a subcommand starts the interactive CLI.
  • voidbot gateway starts the HTTP listener and any enabled channel listeners.
S
Description
No description provided
Readme
223 KiB
Languages
Python 99.5%
Makefile 0.5%