Skip to main content

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, 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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bhai_cli-0.2.8.tar.gz (38.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bhai_cli-0.2.8-py3-none-any.whl (42.5 kB view details)

Uploaded Python 3

File details

Details for the file bhai_cli-0.2.8.tar.gz.

File metadata

  • Download URL: bhai_cli-0.2.8.tar.gz
  • Upload date:
  • Size: 38.3 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

Hashes for bhai_cli-0.2.8.tar.gz
Algorithm Hash digest
SHA256 5990e466e611d6596e06bf511d94e2cdf7761b0c3de6f1828d4776482f15f703
MD5 c8c0cc54a8418aba587537af93dde546
BLAKE2b-256 0bde3ba3757c61e4d91b6ddf52ea3920f3b98882e65c20239e560aef89482e0c

See more details on using hashes here.

File details

Details for the file bhai_cli-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: bhai_cli-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 42.5 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

Hashes for bhai_cli-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e16cb633855ce440981d93920a61b18bdc2552573445467ba546e3da57f99f09
MD5 c9451719affb8d50c44d65e11cf01bfa
BLAKE2b-256 0bc8c4b226f868a183889024282644d786469851a5e23ba4bea535dda7e50de4

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