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.5.tar.gz (83.8 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.5-py3-none-any.whl (82.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bub-0.3.5.tar.gz
Algorithm Hash digest
SHA256 76b6e54542d53d9862e69bf4a61c0a709a45d29a3c026fe6f99bed75081ed577
MD5 071195a12cbcbc2b40e9d718f75c69ab
BLAKE2b-256 eca1ca567e7b5897e22c43b23f34786a1d6d5143da31c73e01dbcaff59ee9790

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for bub-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8831b15df13623e8c7c8f480f7aac7176f6b7b9840bc7b04978703cbb03905cf
MD5 8cfacf927157a270a7cb06614232d91f
BLAKE2b-256 6a28f9eba5bba7054637c2af4abb9122036e75e2a316f2f58bf57815d03660bc

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