Skip to main content

Add your description here

Project description

BroCode

Goal

BroCode is a study of agentic workflow and AI agents framework designed to solve coding problems. It's model-agnostic and aims to work with all files in a repository like Claude, Amazon Q Developer, and other AI coding tools. Future versions will include code acceptance/rejection capabilities.

Overview

A CLI tool for managing and running LLM-based chat agents with support for multiple model backends. BroCode uses an agentic workflow system that combines code generation, chat capabilities, and codebase analysis in an interactive flow.

Installation

Use this:

pip install brocode  

Or this:

uv add brocode  

Quick Start

  1. Register a model:
brocode register --path mylocal.py --model llama3.2-11b --default
  1. Start chatting:
brocode start

Commands

Register Models

Register LLM models from Python files:

# Register and set as default
brocode register --path mylocal.py --model mymodel --default

# Register with auto-generated name
brocode register --path mylocal.py

Start Chat

Start interactive chat sessions:

# Use default model
brocode start

# Use specific model
brocode start --llm mymodel

Model Management

# List registered models
brocode model list

# Remove models interactively
brocode model remove

Creating Custom Models

Create a Python file with your LLM class:

# mylocal.py
from brollm import BaseLLM, BedrockChat
from brocode.register import register_llm

@register_llm("llama3.2-11b")
class MyLocalLLM(BedrockChat):
    def __init__(self):
        super().__init__(model_name="us.meta.llama3-2-11b-instruct-v1:0")

How BroCode Works

When you run brocode start, BroCode initiates an agentic workflow that provides two main modes:

Workflow Overview

[Start] → [User Input] → [Route Decision]
                ↓
        ┌─────────────────┐
        ↓                 ↓
   [Code Mode]      [Chat Mode]
        ↓                 ↓
   [Code Generator]  [Chat Agent]
        ↓                 ↓
        └─────────────────┘
                ↓
        [Back to User Input]

Interactive Commands

  • /code - Enter code generation mode

    • Prompts for coding task description
    • Optionally analyze existing codebase for context
    • Choose output format (terminal display or save to file)
    • Generates Python code following best practices
  • /exit - Quit the session

  • /clear - Clear chat history

  • Default input - Enter chat mode for general conversation

Code Generation Workflow

  1. Task Input: Describe what you want to code
  2. Codebase Analysis (optional):
    • Provide folder or file path
    • BroCode analyzes Python files using AST parsing
    • Extracts classes, functions, imports, and structure
    • Maintains consistency with existing code patterns
  3. Output Selection: Choose terminal display or file save
  4. Code Generation: AI generates code following:
    • PEP 8 style guidelines
    • Google docstring format
    • Type hints and error handling
    • Consistency with existing codebase patterns

Chat Mode

Provides general coding assistance, debugging help, and technical discussions using a knowledgeable coding assistant persona.

Configuration

Models are stored in .brocode_config.yaml in your current directory.

Configuration File Structure

models:
  llama3.2-11b: /path/to/mylocal.py
  gpt-4: /path/to/gpt4_model.py
default_model: llama3.2-11b

Dependencies

  • Python >=3.12
  • click >=8.2.1
  • brollm >=0.1.2
  • broflow >=0.1.4
  • broprompt >=0.1.5

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

brocode-0.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

brocode-0.1.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file brocode-0.1.0.tar.gz.

File metadata

  • Download URL: brocode-0.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for brocode-0.1.0.tar.gz
Algorithm Hash digest
SHA256 88bee396d0d9f539d0fbc7cd0403c7d724a18c3b2c689666bc71f547527d0db8
MD5 930db6d5dc10b2fb252979464b7febb7
BLAKE2b-256 de4ccc80d7c84d7ee91fbe9a86a00ac181fe21a02b2cae3b657009bb30812c1f

See more details on using hashes here.

File details

Details for the file brocode-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: brocode-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.13

File hashes

Hashes for brocode-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe266c83fed1db3fda4e7122b0af077df9d8725449db634822449c8fab447e9b
MD5 9265436653a8c06343f2cf427279e7ca
BLAKE2b-256 84492cc94d83aba5b5a4712a69b9e0338ce6e72c13c3ba1e9c363bce990b75cb

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