How pgalko/bambooai works
Project Type and Purpose
• BambooAI is an open-source Python library plus optional web application that enables natural-language data analysis.
• It comprises a core “agent” library (bambooai/…), a sandboxed code execution service, connectors to external LLM providers and search APIs, an optional vector DB memory, and a Flask-based web UI.
File Structure
• Top-level:
• Dockerfile, docker-compose.yaml → containerized deployment
• bambooai/ → core library modules
• web_app/ → Flask application, API endpoints, static assets, HTML templates
• examples/, tests/ → sample datasets and unit tests
• LLM_CONFIG_sample.json, PROMPT_TEMPLATES_sample.yaml → configuration templates
• Core library packages:
• code_executor.py, executor_client.py → local vs remote code execution
• context_retrieval.py, qa_retrieval.py → semantic search & retrieval
• messages/ → prompt templates, message orchestration
• models/ → adapters for OpenAI, Gemini, Anthropic, local models, etc.
• storage_manager.py → vector DB (Pinecone) integration
• output_manager.py, web_output_manager.py → formatting results for CLI vs Web
• google_search.py → external web search tool
• Web UI:
• app.py → Flask entrypoint
• code_executor_api.py → sandboxed execution microservice
• static/, templates/ → frontend assets
README Insights
• Describes a multi-agent LLM workflow: Initiation → Task Routing → Dynamic Prompt Build → Debugging/Execution → Results/Memory
• Optional components: planning agent, vector DB, ontology integration, external search
• Deployment options: local pip, Docker, full repo
• Configuration driven by .env + LLM_CONFIG.json
Main Components and Their Relationships
a. Users and Interfaces
• Jupyter / CLI
• Web Browser → Web UI (Flask)
b. Core BambooAI Library
• Conversation Manager → orchestrates agents
• Agents: Expert Selector, Analyzer, Theorist, Planner, Code Generator, Error Corrector, Reviewer, Summarizer, Search Executor
c. External Services
• LLM Providers (OpenAI, Anthropic, Gemini, Groq, Mistral, DeepSeek, local via Ollama/VLLM)
• Google Search API or Selenium
• Vector DB (Pinecone)
d. Code Execution Service
• Local sandbox or remote API (executor_client)
• Returns execution results or errors
e. Data Sources
• Local datasets (CSV, Parquet)
• Auxiliary datasets
• Dataframe Ontology (.ttl)
f. Storage & Logging
• Log Manager → JSON logs, rotation
• Storage Manager → vector DB put/get
g. Web Application
• Flask API endpoints → /converse, /execute
• Static assets → CSS, JS modules (UI controls, workflow map, PDF export)
• Templates → index.html
Architectural Patterns and Design Principles
• Modular multi-agent architecture – each agent handles a specific responsibility
• Layered separation: Interface (CLI/Web) → Orchestrator (Core Library) → Execution (Code Executor) → Persistence (Vector DB, Logs)
• Configuration-driven: LLM behavior, tools enabled via .env + JSON/YAML
• Plug-and-play adapters for new LLM providers or execution modes
• Containerized sandbox for secure code execution