Skip to content

KodyKendall/LlamaBot

Repository files navigation

LlamaBot logo

LlamaBot

The open-source AI coding agent that rapidly builds MVPs, prototypes, and internal tools.

Live Site LLM Prompts AGPL License Discord

LlamaBot live demo
---

✨ What is LlamaBot?

LlamaBot is a production-ready AI coding agent framework that generates working prototypes, embeds AI directly into the app, and runs real workflows β€” letting you move from idea to production in record time.

It works across the full spectrum of users:

  • Non-technical founders who want to build without code.
  • Product teams who need to spin up prototypes fast.
  • Engineers who want an AI teammate to automate workflows inside production apps.

Unlike typical codegen tools, LlamaBot doesn't just write snippets β€” it can embed directly in your app and run real workflows. This makes it ideal for collaborative software building: founders guide the vision, engineers stay in control, and AI fills the gap.


LlamaBot is built for moving ideas fast:

  • πŸš€ Prototype an AI MVP in a weekend β€” landing pages, user flows, backend logic, all scaffolded by AI.
  • πŸ§ͺ Experiment with workflows β€” test reporting, notifications, automations directly inside your app.
  • πŸ‘₯ Collaborate with teammates β€” Bridge the gap between non-technical founders and engineering teams.
  • πŸ”§ Production automation β€” Trigger Sidekiq jobs, query databases, send emails/SMS, all from natural language.

🎯 Key Features

Multi-Agent Architecture

LlamaBot includes 6 specialized agents for different tasks:

  • rails_agent - Full-featured Rails development with 20+ tools
  • llamapress - HTML/webpage editing and website cloning
  • rails_testing_agent - Automated test generation and execution
  • rails_ai_builder_agent - Build custom LangGraph agents
  • rails_frontend_starter_agent - Rapid frontend scaffolding
  • llamabot - General-purpose helpful assistant

Powerful Tool Ecosystem (20+ Built-in Tools)

  • πŸ“ File Operations: Read, write, edit with smart whitespace normalization
  • 🌿 Git Integration: Status, commit, push, full command execution
  • πŸ’» Bash Execution: Run shell commands directly
  • πŸ” Internet Search: Tavily-powered web search
  • 🌐 Web Scraping: Playwright + BeautifulSoup for browser automation
  • πŸ™ GitHub CLI: Issue management, PR creation, workflow automation
  • πŸ“ Task Management: Built-in TODO tracking with status updates

Multiple LLM Support

Choose your preferred AI model:

  • Claude (Anthropic) - Sonnet 4.5, Haiku 4.5 with prompt caching
  • GPT (OpenAI) - GPT-5-Codex, GPT-4.1
  • Gemini (Google) - Full Generative AI support

Real-Time Streaming

  • WebSocket-based streaming shows AI thinking token-by-token
  • Live code preview with iframe updates
  • Message history with thread management
  • Mobile-responsive interface

Production-Ready Persistence

  • PostgreSQL checkpoint-based conversation state
  • Graceful fallback to in-memory storage
  • Connection pooling and automatic reconnection
  • Message history trimming (prevents unbounded growth)

πŸ“Š By the Numbers

  • 12,753 lines of Python code across 71 source files
  • 6 specialized agents for different workflows
  • 20+ built-in tools covering file ops, git, web, and more
  • 3 LLM providers (Claude, GPT, Gemini)
  • 1,392 lines of comprehensive tests (unit + integration)
  • Production-ready with PostgreSQL persistence, Nginx deployment, SSL/TLS

πŸš€ Quick Start (<5 Minutes)

Requires:

  • Docker Compose
  • OpenAI API Key

Run the install script remotely (no Github clone)

# Only requirement: docker compose + your OpenAI key
curl -fsSL "https://raw.githubusercontent.com/KodyKendall/LlamaBot/refs/heads/main/bin/install_llamabot_local.sh" -o install_llamabot_local.sh && bash install_llamabot_local.sh

Open your browser:

http://localhost:8000/chat

πŸš€ Dev Start (5-10 Minutes)

Clone repo & run install script locally

git clone https://github.com/kodykendall/LlamaBot
cd LlamaBot
bash bin/install_llamabot_local.sh

πŸ”Œ Embed in an Existing App (Rails first, others coming)

Today, Rails is the primary supported framework. With the llama_bot_rails gem, you can use LlamaBot to:

  • Call existing ActiveRecord models
  • Trigger your real services, jobs, and routes
  • Automate workflows with natural language

Example use cases:

  • Refund a user and send SMS
  • Generate a weekly revenue report
  • Queue 100 Sidekiq jobs from chat

Future adapters: Django, Laravel, Node.js.

Not a developer but want to build something with LlamaBot? Join the Discord or reach out directly β€” we’d love to collaborate on real-world MVPs and prototypes.


🧠 Under the Hood

Core Architecture

Browser (Modular ES6 JavaScript)
    ↕ WebSocket (Real-time streaming)
FastAPI Backend (Python 3.11+)
    β”œβ”€ LangGraph Workflows (6 specialized agents)
    β”œβ”€ 20+ Tools (file, git, bash, web, GitHub)
    β”œβ”€ PostgreSQL Checkpointer (conversation state)
    └─ Multiple LLM Providers (Claude, GPT, Gemini)

Tech Stack

  • Agent Framework: LangGraph 1.0.0 + LangChain
  • Web Framework: FastAPI + Uvicorn (ASGI)
  • Communication: WebSocket (starlette) with chunked streaming
  • Database: PostgreSQL 16 (optional, falls back to in-memory)
  • Frontend: Vanilla JavaScript with modular architecture
  • Observability: LangSmith integration for tracing

Key Design Patterns

  • Singleton Workflow Compilation: Agents compiled once at startup, cached globally
  • Checkpoint-Based State: All conversation history persisted to PostgreSQL
  • Streaming Architecture: Real-time token-by-token message delivery
  • Tool Node Pattern: LangGraph conditional edge routing
  • Graceful Degradation: Falls back to MemorySaver if PostgreSQL unavailable

Smart Optimizations

  • Prompt Caching (Anthropic): Reduces costs by 90% for repeated calls
  • Path Normalization: Automatically fixes common LLM path mistakes
  • Whitespace Normalization: Flexible string matching for code edits
  • Failed Tool Recovery: Switches to text-only after 3 failed tool calls
  • Message History Trimming: Keeps last 30 messages + system messages

πŸ“¦ Project Structure

LlamaBot/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ main.py                    # FastAPI app with WebSocket + API routes (480 LOC)
β”‚   β”œβ”€β”€ websocket/                 # WebSocket layer
β”‚   β”‚   β”œβ”€β”€ web_socket_handler.py  # Connection lifecycle management
β”‚   β”‚   β”œβ”€β”€ request_handler.py     # Core streaming logic (357 LOC)
β”‚   β”‚   └── web_socket_connection_manager.py
β”‚   β”œβ”€β”€ agents/                    # LangGraph agent workflows
β”‚   β”‚   β”œβ”€β”€ llamabot/              # Basic assistant
β”‚   β”‚   β”œβ”€β”€ llamapress/            # HTML/webpage editor (supervisor pattern)
β”‚   β”‚   └── leonardo/              # Full-featured agents
β”‚   β”‚       β”œβ”€β”€ rails_agent/       # Rails development (1,342 LOC tools!)
β”‚   β”‚       β”œβ”€β”€ rails_testing_agent/
β”‚   β”‚       β”œβ”€β”€ rails_ai_builder_agent/
β”‚   β”‚       └── rails_frontend_starter_agent/
β”‚   β”œβ”€β”€ frontend/                  # Modular JavaScript architecture
β”‚   β”‚   β”œβ”€β”€ index.html             # Chat interface
β”‚   β”‚   β”œβ”€β”€ chat/                  # ES6 modules
β”‚   β”‚   β”‚   β”œβ”€β”€ index.js           # Main ChatApp class
β”‚   β”‚   β”‚   β”œβ”€β”€ websocket/         # WebSocket management
β”‚   β”‚   β”‚   β”œβ”€β”€ messages/          # Message rendering
β”‚   β”‚   β”‚   β”œβ”€β”€ ui/                # UI components
β”‚   β”‚   β”‚   └── threads/           # Thread management
β”‚   β”‚   └── styles/                # CSS
β”‚   └── db/                        # Database utilities
β”œβ”€β”€ bin/
β”‚   β”œβ”€β”€ install_llamabot_local.sh  # Local dev install script
β”‚   └── install_llamabot_prod.sh   # Production deployment script
β”œβ”€β”€ tests/                         # Comprehensive test suite (1,392 LOC)
β”‚   β”œβ”€β”€ test_app.py                # FastAPI endpoint tests
β”‚   β”œβ”€β”€ test_websocket.py          # WebSocket tests
β”‚   β”œβ”€β”€ test_agents.py             # Agent workflow tests
β”‚   └── test_integration.py        # End-to-end tests
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ DEPLOY.md                  # Production deployment guide
β”‚   └── dev_logs/                  # Version history
β”œβ”€β”€ langgraph.json                 # Agent configuration
β”œβ”€β”€ Dockerfile                     # Container definition
β”œβ”€β”€ docker-compose.yml             # Local development setup
β”œβ”€β”€ requirements.txt               # Python dependencies
└── README.md

🚒 Deployment Options

1. Standalone (Docker)

Run as an independent service with web UI:

docker-compose up
# Access at http://localhost:8000/chat

2. Embedded (Rails Integration)

Integrate into existing Rails apps via the llama_bot_rails gem:

# Gemfile
gem 'llama_bot_rails'

# Can now:
# - Call ActiveRecord models
# - Trigger Sidekiq jobs
# - Send emails/SMS
# - Query databases
# - Automate workflows with natural language

3. Production (Multi-tenant SaaS)

Full deployment guide available in docs/DEPLOY.md:

  • Ubuntu 20 LTS with systemd
  • Nginx reverse proxy (HTTPS/WSS)
  • PostgreSQL for persistence
  • SSL/TLS via Certbot
  • Multi-worker support (Uvicorn)

βš™οΈ Configuration

Environment Variables

Variable Required Default Purpose
OPENAI_API_KEY βœ… Yes - OpenAI LLM access
ANTHROPIC_API_KEY ❌ No - Claude LLM access
GOOGLE_API_KEY ❌ No - Gemini LLM access
DB_URI ❌ No "" PostgreSQL connection (falls back to MemorySaver)
TAVILY_API_KEY ❌ No - Internet search capability
LANGSMITH_API_KEY ❌ No - LangSmith tracing/observability
LANGSMITH_TRACING ❌ No false Enable LangSmith

Agent Selection

Configure available agents in langgraph.json:

{
  "graphs": {
    "llamabot": "./agents/llamabot/nodes.py:build_workflow",
    "rails_agent": "./agents/leonardo/rails_agent/nodes.py:build_workflow",
    "llamapress": "./agents/llamapress/nodes.py:build_workflow"
  }
}

LLM Model Selection

Choose your preferred model per conversation:

  • claude-4.5-sonnet (default for rails_agent)
  • claude-4.5-haiku (faster, cheaper)
  • gpt-5-codex (OpenAI)
  • gpt-4.1 (OpenAI)
  • gemini-pro (Google)

πŸ§ͺ Testing

Run the comprehensive test suite:

pytest                           # Run all tests
pytest -m unit                   # Only unit tests
pytest -m integration            # Only integration tests
pytest --cov=app --cov-report=html  # Coverage report

Test coverage includes:

  • FastAPI endpoint testing
  • WebSocket communication
  • Agent workflow execution
  • End-to-end integration tests
  • Mock LLM and database interactions

🀝 Contributing

We welcome PRs, issues, and ideas! Jump into Discord to collaborate.

πŸ“œ License

LlamaBot is AGPLv3 open source. For commercial licensing, contact kody@llamapress.ai.

Made with ❀️ in San Francisco β€” inspired by the next wave of AI-powered software.