Skip to main content

🇮🇳 BHAI-CLI

The Dual-Brain Agentic Coding CLI — 22 Indian Languages. One CLI.

भाई · ভাই · ભાઈ · ਭਾਈ · భాయ్ · ಭಾಯ್ · भाऊ · ଭାଇ

BHAI is a lean, zero-state resilient CLI tool that acts as your 10x Senior SDE from India. It uses a Dual-Brain Manager-Worker Architecture — a VibeLLM for persona, planning, and review, and a CoderAgent for autonomous tool-calling execution — all powered by litellm for universal LLM provider support and Sarvam AI for 22 Indian language understanding.

"You are BHAI, a 10x Senior SDE from India. Sab bhasha samajhte ho. You roast O(N²) loops and unoptimized Dockerfiles."


✨ Features

  • 🧠 Dual-Brain Agentic Architecture: VibeLLM (Manager/Planner) delegates step-by-step tasks to the CoderAgent (Worker) which autonomously executes tools in a loop.
  • 🤖 MCP-Powered File Operations: Full agentic capability to read_file, write_file, edit_file, and list_directory autonomously to build features from scratch.
  • 💾 Persistent Session Management: Chat histories are saved locally with LLM-auto-generated titles. Resume past context anytime from the interactive menu.
  • 🖥️ Interactive Menu-Driven CLI: Simply run bhai-code for a rich, beautifully colored terminal UI to chat, manage sessions, and configure settings.
  • 🔒 Secure Secrets Storage: API keys are strictly separated into a 0600 permission secrets.yaml and masked during screen display.
  • 🇮🇳 22 Indian Languages: Speak in Hindi, Punjabi, Bengali, Tamil, Telugu, Gujarati, Marathi, Kannada, Malayalam, and more.
  • 🌍 Universal LLM Support: DeepSeek, xAI (Grok), Qwen, OpenAI, Anthropic, Groq, Google Gemini, Sarvam, Mistral, Cerebras, Ollama, Bedrock, and more.
  • 🎙️ Indic Voice Interface: Sarvam Saaras v3 (STT) translates any Indian language to English, Bulbul v3 (TTS) reads responses back.
  • ⚡ Zero-State Resilience: Boots in <300ms, persistent YAML config, hot-swappable model overrides.

🚀 Installation

pip install bhai-cli

With voice support (optional):

pip install "bhai-cli[audio]"
# Also needs: sudo apt install libportaudio2  (Linux)

⚙️ Setup

bhai-code setup

The interactive wizard will configure:

  1. VibeLLM — Your planner/persona brain (e.g., sarvam/sarvam-105b, groq/llama-3.3-70b-versatile)
  2. CoderAgent — Your autonomous worker brain (e.g., openai/gpt-4o, anthropic/claude-3-5-sonnet-20241022)
  3. Sarvam AI — Voice interface API key (optional)
  4. Ollama Port — Local inference configuration

Model Format

Uses litellm's model naming:

Provider Format Example
Anthropic anthropic/model anthropic/claude-3-5-sonnet-20241022
OpenAI openai/model openai/gpt-4o
Google gemini/model gemini/gemini-2.5-pro
DeepSeek deepseek/model deepseek/deepseek-coder
xAI xai/model xai/grok-beta
Groq groq/model groq/llama-3.3-70b-versatile
Sarvam sarvam/model sarvam/sarvam-105b
Ollama ollama/model ollama/llama3

💬 Usage

# Opens the rich terminal UI for chats, session management, and settings
bhai-code

Text Mode

# Directly start a new chat session interactively
bhai-code text

# Single prompt execution
bhai-code text "explain the pyproject.toml file"

# Resume a specific session
bhai-code text --session-id <uuid>

# Override models on the fly
bhai-code text "optimize this Dockerfile" --vibe-model groq/llama-3.3-70b-versatile --coder-model openai/gpt-4o

Voice Mode

# Live microphone
bhai-code listen

# From audio file
bhai-code listen --file recording.wav

View Config

bhai-code config

🏗️ Architecture

User Input (Any of 22 Indian Languages / English)
         │
         ▼
┌─────────────────────┐
│   VibeLLM (Brain A)  │  ← Persona + Planning + Session Management
│   Sarvam-105B / any  │
└──────────┬──────────┘
           │ {"task": "step-by-step instructions"}
           ▼
┌─────────────────────┐
│  CoderAgent (Brain B)│  ← Autonomous Execution Loop
│  Any litellm model   │
│                      │
│  Tools:              │
│  • read/write/edit   │  ← File System Ops
│  • execute_bash      │  ← [Y/n] Guardrail
│  • web_search        │  ← DuckDuckGo
│  • codebase_context  │  ← AST signatures
└──────────┬──────────┘
           │ Results
           ▼
┌─────────────────────┐
│   VibeLLM (Brain A)  │  ← Review & Final Output
└─────────────────────┘

🔧 Tools (MCP-Powered)

Tool Description
read_file Read the exact contents of a file before editing
write_file Create a new file with provided content
edit_file Target specific line ranges to replace code blocks
list_directory Explore project structure to navigate codebase
execute_bash Run shell commands (tests, docker, git) with [Y/n] confirmation
web_search DuckDuckGo search for real-time debugging
codebase_context Smart directory scanner with AST-based signature extraction

📁 Project Structure

bhai-cli/
├── src/bhai_cli/
│   ├── __init__.py          # Package metadata
│   ├── cli.py               # Rich interactive Typer CLI
│   ├── config_manager.py    # Configuration & secure secrets
│   ├── session_manager.py   # Chat history persistence & auto-titling
│   ├── orchestrator.py      # Dual-Brain Agentic Loop
│   ├── audio_engine.py      # Sarvam STT/TTS
│   └── tools/
│       ├── __init__.py      # Tool registry + JSON schemas
│       ├── file_ops.py      # Read, Write, Edit, List tools
│       ├── bash.py          # execute_bash with guardrails
│       ├── search.py        # web_search via DuckDuckGo
│       └── codebase.py      # codebase_context with AST
├── tests/
├── website/                 # Next.js Landing Page Frontend
├── pyproject.toml
├── bhai_cli_documentation.html # Exhaustive local docs (gitignored)
└── README.md

🔑 Environment Variables & Secrets

API keys are securely isolated in ~/.config/bhai/secrets.yaml (0600 permissions). Supported keys include: SARVAM_API_KEY, VIBE_API_KEY, CODER_API_KEY, GROQ_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, DEEPSEEK_API_KEY, XAI_API_KEY.


📄 License

Apache-2.0 — see LICENSE.

Built with ❤️ from India by Madhav Kapila.

Metadata

Release files for bhai-cli 0.2.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bhai-cli 0.2.12
File Size Uploaded
bhai_cli-0.2.12.tar.gz 38.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bhai-cli 0.2.12
File Interpreter ABI Platform
bhai_cli-0.2.12-py3-none-any.whl Python 3 none any Details

Total release size: 81.6 kB

Release files / bhai_cli-0.2.12.tar.gz

Download URL bhai_cli-0.2.12.tar.gz
Size 38.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dfc3927c0821afecbc20a49e2bdf77e71ef7e2028af8c87e24e77beee77a85f6
BLAKE2b-256 checksum
How to use checksums
91d951632c73e5b039e21a0d45f08ddb963987cb7aa29dd8a6354a5c6af23a23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.14.4 Linux/7.0.0-15-generic

Release files / bhai_cli-0.2.12-py3-none-any.whl

Download URL bhai_cli-0.2.12-py3-none-any.whl
Size 42.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf6990a5d4e31886a91d097f7b568599119890d0d9cd9247fa098413958bc812
BLAKE2b-256 checksum
How to use checksums
c7aaea22b540610a5065152a35c6c9e41f0c9e8c4ff8e5960bad343ccc76a57e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.14.4 Linux/7.0.0-15-generic

Release history Release notifications | RSS feed

This release

0.2.12 This release

2 release files

0.2.11

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page