How pallavi-sinha-12/bitefix works
Project Type and Purpose
• Project Type: Open-source Python library (not a full-stack app)
• Purpose: Provide two decorators (@resolve, @resolve_with_openai) that automatically orchestrate a team of AI agents to diagnose and fix runtime errors in user functions, using either OpenAI’s API or a local LLM.
File Structure
• bitefix/ package
– BiteFixAITasks.py: task definitions for each agent
– BiteFixAIAgents.py: agent role classes (Diagnosis, Senior Dev, Lead, Code Developer)
– BiteFixAICrew.py: crew/agent assembly logic
– BiteFixAIRunner.py: orchestrator/pipeline manager that runs agents in sequence
– bitefix_utils.py: logging, export directory management, utilities
• Top-level scripts: setup.py, requirements.txt, CI config in .github/, assets for README images
README for Insights
• Two decorators wrap user functions and catch runtime errors.
• In case of error: decorator triggers a “crew” of AI agents.
• Agents interact with external LLM backends (OpenAI via openai library or any langchain-compatible LLM, e.g. Ollama).
• The pipeline: diagnosis → idea generation → idea evaluation → code rewriting → apply fix → re-execute.
Main Components
A. User Function (client code) with a BiteFix decorator
B. Decorator Layer (resolve_with_openai / resolve)
C. AIRunner (pipeline manager)
D. AICrew (agent factory, from crewAI)
E. AIAgents (4 roles)
F. AITasks (prompt templates & task specs)
G. External LLM Service(s)
– OpenAI API (GPT-4, etc.)
– Local LLM via Ollama / other langchain backends
H. Utilities & Export (logging, report generation in export_dir)
Relationships and Data Flows
1. User invokes decorated function
2. Decorator intercepts; on exception, calls AIRunner
3. AIRunner uses AICrew to spawn AIAgents with AITasks
4. Each agent sends prompts to the chosen LLM service (via openai or langchain_community.llms.ollama.Ollama)
5. Agents return results (diagnosis, ideas, selected fix, rewritten code) back to AIRunner
6. AIRunner aggregates feedback, writes logs and error-resolution report (assets/, export_dir)
7. Optionally, the fixed code is re-executed or returned to the user
Architectural Patterns & Design Principles
• Decorator Pattern – wraps user functions transparently
• Pipeline & Chain of Responsibility – sequential agent handling
• Strategy/Plugin Pattern – pluggable LLM backends (OpenAI vs custom)
• Modular Separation – cleanly separated modules for tasks, agents, orchestration, utilities
Detailed Elements
– Component names matching module names (bitefix_utils, BiteFixAIRunner, etc.)
– Notes or annotations for key design patterns (Decorator, Pipeline)