bai is an AI pair programmer that lives in your terminal.
Ask it to fix a test, refactor a package, or explain a codebase — it reads and writes your files, runs shell commands, and works the problem turn by turn until it's done. No browser, no copy-paste, no leaving the terminal.
curl -fsSL https://bluefunda.com/ai/install.sh | sh
bai login
bai "add table-driven tests for the parser package"That's the whole setup. The installer picks the right binary for your OS, verifies the checksum, and drops bai on your PATH. After bai login, you're working.
- It does the work, not just the talking. bai edits files and runs commands in your project. You review and approve; it executes.
- Stays in your flow. It's a terminal tool. It fits next to git, your editor, and your shell — and into CI.
- You stay in control. Every tool call is yours to approve. Use
--autowhen you trust the task,--worktreeto keep changes isolated,--printfor a dry run. - Tuned for real work.
--fastfor quick answers,--thinkfor hard problems, and automatic context compaction so long sessions don't fall over. - Extensible. Connect tools via MCP (Model Context Protocol) — including SAP operations through ABAPer.
- Embeddable. Drop the agentic loop straight into your own Go programs with the SDK.
bai # open an interactive session
bai "why is the build failing?" # start with a prompt
bai --fast "rename this variable" # quick, low-latency model
bai --think "design a retry strategy" # extended reasoning for hard problems
bai --auto "add godoc to all exports" # auto-approve tool calls
bai --worktree "try a risky refactor" # run in an isolated git worktree
bai -c # resume your most recent sessionInside a session, type / for slash commands — /model to switch models, /clear to reset, /help for the rest. Enter sends, Ctrl+C interrupts the current turn (or quits when idle), Ctrl+D quits.
Scrolling and copying: scroll the conversation with the mouse wheel, PgUp/PgDn, or arrow keys. To copy text, hold Shift while clicking and dragging — this hands selection back to the terminal when mouse-scroll mode is active.
Scaffold project-level config and conventions once:
bai init # creates .bai/ for the current project| Command | What it does |
|---|---|
bai [prompt] |
Interactive agentic session with file + shell access |
bai login / logout |
Sign in / out via browser (OAuth device flow) |
bai doctor |
Check configuration and connectivity |
bai init |
Scaffold .bai/ config for a project |
bai sessions |
List past sessions; resume with -c or --resume |
bai chat |
Manage named chat sessions (list, start, history, title, stop) |
bai model list |
List available LLM models |
bai mcp |
Connect and manage MCP tool integrations |
bai plugins |
Manage plugins |
bai billing |
View subscription and plans |
bai update |
Update bai to the latest release |
bai completion |
Generate shell completions (bash, zsh, fish, PowerShell) |
Useful flags: --model, --fast, --think, --auto, --auto-apply, --max-turns, --max-budget-usd, --dir, --worktree, -c/--continue, --resume, --print, --no-tools, -o/--output {table,json,quiet}.
Run the full bai agentic loop in-process — no bai binary, no subprocess. Bring your own tools.
import "github.com/bluefunda/bluefunda-ai/sdk/agent"
runner := agent.New(agent.Options{
Model: "auto",
MaxTurns: 5,
OnEvent: func(ev agent.Event) {
switch ev.Type {
case "text": fmt.Print(ev.Text)
case "tool_use": fmt.Printf("[tool: %s]\n", ev.ToolName)
case "result": fmt.Printf("\n--- done (%s) ---\n", ev.StopReason)
}
},
})
defer runner.Close()
runner.WithSystemPrompt("You are a concise Go assistant.")
err := runner.Run(ctx, "summarize this repository")Register your own tools via OnToolCall, and fall back to agent.DefaultExecute for the built-in file and shell ops. The SDK reads credentials from ~/.bai/config.yaml (written by bai login). For cross-language use, the subprocess-based sdk.Client is also available.
macOS / Linux (one-liner) — installs to /usr/local/bin or ~/.local/bin, verifies SHA256:
curl -fsSL https://bluefunda.com/ai/install.sh | shHomebrew (macOS)
brew tap bluefunda/tap && brew install baiDebian / Ubuntu — replace amd64 with arm64 as needed:
curl -sL https://github.com/bluefunda/bluefunda-ai/releases/latest/download/bai_linux_amd64.deb -o bai.deb
sudo dpkg -i bai.debRHEL / Fedora / Rocky
curl -sL https://github.com/bluefunda/bluefunda-ai/releases/latest/download/bai_linux_amd64.rpm -o bai.rpm
sudo rpm -i bai.rpmFrom source (Go 1.26+)
go install github.com/bluefunda/bluefunda-ai/cmd/bai@latestOr grab a binary from Releases.
bai reads ~/.bai/config.yaml:
gateway: api.bluefunda.com # API gateway
endpoint: grpc.bluefunda.com:443 # BFF gRPC address
domain: your-tenant.bluefunda.com # tenant domain
defaults:
model: auto # default model
output: table # default output format| Environment variable | Description |
|---|---|
BAI_ACCESS_TOKEN |
Bearer token — skips bai login in CI/CD |
BAI_GATEWAY |
Override the gateway URL |
BAI_BFF |
Override the BFF gRPC address |
BAI_MODEL |
Override the default model |
BAI_INSTALL_DIR |
Custom install directory for install.sh |
Prerequisites: Go 1.26+, protoc (+ protoc-gen-go, protoc-gen-go-grpc) for proto regen, goreleaser for releases.
make build # build the bai binary
make test # tests with race detector
make vet # go vet
make fmt # format
make proto # regenerate protobuf
make snapshot # release snapshot via goreleasercmd/bai/ Entry point
internal/
auth/ OAuth2 device flow (RFC 8628)
cmd/ Cobra command definitions
config/ Config loader (~/.bai/config.yaml)
grpc/ gRPC connection + interceptors
tools/ Agentic tool implementations
ui/ Output formatting + Bubble Tea TUI
sdk/agent/ Embeddable in-process agent SDK
api/proto/ Protobuf definitions + generated code
Releases are automated via Release Please and GoReleaser: merge a feat: or fix: commit to main, then merge the release PR to publish. See CHANGELOG.md.
- Contributing: CONTRIBUTING.md
- Security: report vulnerabilities via SECURITY.md
- SAP / ABAP developers: see ABAPer — the same agent, specialized for ABAP
Apache 2.0 — see LICENSE. Copyright © BlueFunda, Inc.