BHAI โ The Dual-Brain AI Coding Agent with Punjabi Swagger. Indic-native voice + universal LLM tool-calling.
Project description
๐ฎ๐ณ 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, andlist_directoryautonomously 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-codefor a rich, beautifully colored terminal UI to chat, manage sessions, and configure settings. - ๐ Secure Secrets Storage: API keys are strictly separated into a
0600permissionsecrets.yamland 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:
- VibeLLM โ Your planner/persona brain (e.g.,
sarvam/sarvam-105b,groq/llama-3.3-70b-versatile) - CoderAgent โ Your autonomous worker brain (e.g.,
openai/gpt-4o,anthropic/claude-3-5-sonnet-20241022) - Sarvam AI โ Voice interface API key (optional)
- 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 |
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
Interactive Menu (Recommended)
# 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bhai_cli-0.2.5.tar.gz.
File metadata
- Download URL: bhai_cli-0.2.5.tar.gz
- Upload date:
- Size: 35.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.4 Linux/7.0.0-15-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11ff7b74227f6eb60b6cfa81f1cb1488fabdc4412cc9d7a07f71dfb9021e26b6
|
|
| MD5 |
7dafefa29ef03a9836a0574641c21936
|
|
| BLAKE2b-256 |
3d48fc0bf4c9c26bd644db5ca03e459dbd57e69bbbc70cf5630a14b691d9280a
|
File details
Details for the file bhai_cli-0.2.5-py3-none-any.whl.
File metadata
- Download URL: bhai_cli-0.2.5-py3-none-any.whl
- Upload date:
- Size: 40.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.4 Linux/7.0.0-15-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a61348e95aad3bff4be0cd21c1ed0b3c3e568f6b046087b456889e033e135eeb
|
|
| MD5 |
b4615fc336e7560457c19293eb986a4a
|
|
| BLAKE2b-256 |
2c2ac7b560e7d78dda4ea02106ac0f525c47111a9ded58d42c727db0782bf5f6
|