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 login openai OpenAI Codex OAuth
bub hooks Print hook-to-plugin bindings

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

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_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.2.tar.gz (81.9 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.2-py3-none-any.whl (78.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bub-0.3.2.tar.gz
Algorithm Hash digest
SHA256 76858d78bfa7e23ccc9a97a6dc8511d6f8c411fae31c9887a9bcf3fc82b45cbe
MD5 1129e74c46402ca5afb88cf5ba88a957
BLAKE2b-256 9fe5cfa164248081ef4527ce7e77d7b27dfa485f5491e9d6a0d4fd6d65c442ce

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for bub-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a4b3807c4b98c28630346396fcb107f8a7a749af92e6079cbd1000a811bebc3a
MD5 c6aeca84ed7746f49466c0630df81817
BLAKE2b-256 6dbcb4fcb2ce0352bfa9b416412b62e3590d84cfad01d28c45dbd0a314f5d7e7

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