Skip to main content

A common shape for agents that live alongside people.

Project description

Bub

Bub logo

A common shape for agents that live alongside people.

Bub started in group chats. Not as a demo or a personal assistant, but as a teammate that had to coexist with real humans and other agents in the same messy conversations — concurrent tasks, incomplete context, and nobody waiting.

It is hook-first, built on pluggy, with a small core (~200 lines) and builtins that are just default plugins you can replace. Context comes from tape, not session accumulation. The same pipeline runs across CLI, Telegram, and any channel you add.

Website · GitHub

Quick Start

pip install bub

Or from source:

git clone https://github.com/bubbuild/bub.git
cd bub
uv sync
uv run bub chat                         # interactive session
uv run bub run "summarize this repo"    # one-shot task
uv run bub gateway                      # channel listener mode

How It Works

Every inbound message goes through one turn pipeline. Each stage is a hook.

resolve_session → load_state → build_prompt → run_model
                                                   ↓
              dispatch_outbound ← render_outbound ← save_state

Builtins are plugins registered first. Later plugins override earlier ones. No special cases.

If AGENTS.md exists in the workspace, it is appended to the system prompt automatically.

Key source files:

What Sets It Apart

Bub grew up in multi-person chats with multiple agents running at the same time. Single-user flows hide structural problems; shared environments expose them fast. That shaped a few things:

  • Context from tape. History is append-only facts. Anchors mark phase transitions. Context is assembled on demand — not accumulated, not compressed into lossy summaries.
  • Hooks all the way down. The turn pipeline is hooks. Override build_prompt, run_model, or render_outbound to change behavior. The core does not privilege its own builtins.
  • One pipeline across channels. CLI and Telegram share the same process_inbound() path. Hooks don't know which channel they're in.
  • Skills as documents. Skills are SKILL.md files with validated frontmatter, not code modules with magic registration.

Extend It

from bub import hookimpl

class EchoPlugin:
    @hookimpl
    def build_prompt(self, message, session_id, state):
        return f"[echo] {message['content']}"

    @hookimpl
    async def run_model(self, prompt, session_id, state):
        return prompt
[project.entry-points."bub"]
echo = "my_package.plugin:EchoPlugin"

See the Extension Guide for hook semantics and plugin packaging.

CLI

Command Description
bub chat Interactive REPL
bub run MESSAGE One-shot turn
bub gateway Channel listener (Telegram, etc.)
bub install Install or sync Bub plugin deps
bub update Upgrade Bub plugin deps
bub login openai OpenAI Codex OAuth

Lines starting with , enter internal command mode (,help, ,skill name=my-skill, ,fs.read path=README.md).

bub hooks still exists for diagnostics, but it is hidden from top-level help. bub install and bub update manage a separate uv project for Bub plugins, defaulting to ~/.bub/bub-project or BUB_PROJECT.

Configuration

Variable Default Description
BUB_MODEL openrouter:qwen/qwen3-coder-next Model identifier
BUB_API_KEY Provider key (optional with bub login openai)
BUB_API_BASE Custom provider endpoint
BUB_API_FORMAT completion completion, responses, or messages
BUB_CLIENT_ARGS JSON object forwarded to the underlying model client
BUB_MAX_STEPS 50 Max tool-use loop iterations
BUB_MAX_TOKENS 1024 Max tokens per model call
BUB_MODEL_TIMEOUT_SECONDS Model call timeout (seconds)

Background

We care less about whether an agent can finish a demo task, and more about whether it can coexist with real people under real conditions. Context is not baggage to carry forever — it is a working set, constructed when needed and let go when done.

Read more: Context from Tape · Socialized Evaluation and Agent Partnership

Docs

Development

uv run ruff check .
uv run mypy src
uv run pytest -q

See CONTRIBUTING.md.

License

Apache-2.0

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

bub-0.3.6.tar.gz (86.2 kB view details)

Uploaded Source

Built Distribution

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

bub-0.3.6-py3-none-any.whl (83.8 kB view details)

Uploaded Python 3

File details

Details for the file bub-0.3.6.tar.gz.

File metadata

  • Download URL: bub-0.3.6.tar.gz
  • Upload date:
  • Size: 86.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for bub-0.3.6.tar.gz
Algorithm Hash digest
SHA256 d165e1f716f675e0b110971a3620f39e15829c6b5ad5305b3d23cf444648bfe5
MD5 7ff9156416d068696504447785ee58ef
BLAKE2b-256 4cfb49cc21b69b1adfbaa6950d1e6e7edf30a3a40248b7017748dbee1595bca0

See more details on using hashes here.

File details

Details for the file bub-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: bub-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 83.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for bub-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 24fba14b488c7fb6b97a7b10366dfdcb659390672c6f5dcdd4aa4dc16233b6d7
MD5 90610af2511795e9cc85a70c5a1830f6
BLAKE2b-256 a3aa6bc2906cf27b60f287585cf564cbceaa090f8246a9ae0ec54e232b12b3af

See more details on using hashes here.

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