# cola **Repository Path**: heiwuqi/cola ## Basic Information - **Project Name**: cola - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-19 - **Last Updated**: 2026-05-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ๐Ÿฅค Cola - Intelligent Agent Orchestration Platform A ToB platform for building, managing, and orchestrating AI agents and workflows. ## Architecture (5 Layers) ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Layer 1: Industry Agent Templates โ”‚ โ† ้”€ๅ”ฎๅ•ๅ…ƒ โ”‚ Pre-built templates per industry โ”‚ Sales, CS, Marketing, Finance... โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Layer 2: Agent Orchestration โ”‚ โ† LangGraph-style Workflow Engine โ”‚ Graph-based execution with conditions โ”‚ Agent, Tool, Condition, Parallel โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Layer 3: Tools & Plugins โ”‚ โ† ่กŒไธš Tool / API / RAG โ”‚ Registry: Web, RAG, CRM, Code, SEO... โ”‚ Pluggable tool execution โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Layer 4: Model Adapter (LLM Router) โ”‚ โ† GPT / Claude / Gemini / Private โ”‚ Multi-provider routing with fallback โ”‚ Cost-aware model selection โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Layer 5: Multi-tenancy & Billing โ”‚ โ† ๅคš็งŸๆˆท้š”็ฆป + ่ฎก่ดน โ”‚ Tenant isolation + token tracking โ”‚ Tier-based pricing + overage โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` ## Tech Stack - **Backend**: Python + FastAPI - **Frontend**: TypeScript + React + Vite - **Database**: SQLite (default) / PostgreSQL - **Cache/Queue**: Redis - **Task Queue**: Celery - **State Management**: Zustand ## ToB Features ### Layer 1: Industry Agent Templates (Sales Unit) - Pre-built templates: Sales Assistant, Customer Service, Marketing, Financial Analyst - One-click deploy โ†’ generates workflow graph - Industry-specific node chains with system prompts - Template execution with automatic tool routing ### Layer 2: Agent Orchestration - LangGraph-style graph engine - Node types: Agent, Tool, Condition, Parallel, Loop, Human-in-loop - Conditional edges with field-based routing - Execution state tracking with iteration limits ### Layer 3: Tools & Plugins - Tool registry with 8 built-in tools - Categories: Web, RAG, CRM, Code, SEO, File, Communication, Analytics - Pluggable architecture - add custom tools easily - Async tool execution with error handling ### Layer 4: Model Adapter (LLM Router) - 8 supported models across 4 providers (OpenAI, Anthropic, Google, Mistral) - Capability-based model selection (text, vision, function calling, streaming) - Cost-aware routing with fallback models - Per-model pricing for cost estimation ### Layer 5: Multi-tenancy & Billing - `X-Tenant-ID` header for all API isolation - 4 billing tiers: Free, Standard ($49), Premium ($149), Enterprise ($499) - Token budget enforcement with overage calculation - Per-tenant usage stats and cost tracking ## Quick Start ### Backend ```bash cd backend python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install -r requirements.txt cp .env.example .env uvicorn app.main:app --reload ``` Backend: `http://localhost:8000` | API docs: `http://localhost:8000/docs` ### Celery Worker ```bash cd backend celery -A app.tasks worker --loglevel=info ``` ### Frontend ```bash cd frontend npm install npm run dev ``` Frontend: `http://localhost:3000` ### Docker ```bash docker-compose up --build ``` ## Project Structure ``` cola/ โ”œโ”€โ”€ backend/app/ โ”‚ โ”œโ”€โ”€ core/ # Config, database, celery, dependencies โ”‚ โ”œโ”€โ”€ models/ # Pydantic & SQLAlchemy models โ”‚ โ”œโ”€โ”€ routers/ # API endpoints โ”‚ โ”œโ”€โ”€ templates/ # Layer 1: Industry Agent Templates โ”‚ โ”‚ โ”œโ”€โ”€ models.py # Template definitions โ”‚ โ”‚ โ””โ”€โ”€ industry_templates.py # Pre-built templates โ”‚ โ”œโ”€โ”€ orchestration/ # Layer 2: Agent Orchestration โ”‚ โ”‚ โ”œโ”€โ”€ models.py # Graph models โ”‚ โ”‚ โ””โ”€โ”€ graph_engine.py # LangGraph-style engine โ”‚ โ”œโ”€โ”€ tools/ # Layer 3: Tools & Plugins โ”‚ โ”‚ โ”œโ”€โ”€ models.py # Tool definitions โ”‚ โ”‚ โ””โ”€โ”€ registry.py # Tool registry + built-in tools โ”‚ โ”œโ”€โ”€ adapters/ # Layer 4: Model Adapter โ”‚ โ”‚ โ”œโ”€โ”€ models.py # Model/provider definitions โ”‚ โ”‚ โ””โ”€โ”€ llm_router.py # Multi-provider LLM router โ”‚ โ”œโ”€โ”€ billing/ # Layer 5: Billing โ”‚ โ”‚ โ””โ”€โ”€ models.py # Tier pricing, invoices, usage โ”‚ โ”œโ”€โ”€ services/ # Shared services (tokens, cache) โ”‚ โ”œโ”€โ”€ tasks.py # Celery async tasks โ”‚ โ”œโ”€โ”€ websocket.py # WebSocket manager โ”‚ โ””โ”€โ”€ main.py # FastAPI app โ”œโ”€โ”€ frontend/src/ โ”‚ โ”œโ”€โ”€ components/ # Layout with tenant selector โ”‚ โ”œโ”€โ”€ pages/ # Dashboard, Agents, Workflows, Tokens โ”‚ โ”œโ”€โ”€ services/ # API client with tenant interceptor โ”‚ โ”œโ”€โ”€ store/ # Zustand state management โ”‚ โ””โ”€โ”€ types/ # TypeScript types โ””โ”€โ”€ docker-compose.yml ``` ## API Endpoints ### Layer 1: Templates - `GET /api/templates/` - List all templates - `GET /api/templates/{id}` - Get template detail - `POST /api/templates/deploy` - Deploy template to tenant - `POST /api/templates/{id}/execute` - Execute template ### Layer 2: Workflows - `POST /api/workflows/` - Create workflow - `GET /api/workflows/` - List workflows (tenant-scoped) - `PUT /api/workflows/{id}` - Update workflow ### Layer 3: Tools - `GET /api/tools/` - List all tools - `GET /api/tools/{id}` - Get tool detail - `POST /api/tools/{id}/execute` - Execute tool ### Layer 4: Models - `GET /api/models/` - List available models - `GET /api/models/{id}` - Get model info - `POST /api/models/select` - Smart model selection - `POST /api/models/chat` - Chat with LLM (auto-routed) - `POST /api/models/chat/stream` - Streaming chat ### Layer 5: Tenants & Billing - `POST /api/tenants/` - Create tenant - `GET /api/billing/tiers` - List pricing tiers - `GET /api/billing/usage-summary` - Get tenant usage - `GET /api/billing/overage/calculate` - Calculate overage cost ### Agents & Executions - `POST /api/agents/` - Create agent (tenant-scoped) - `POST /api/executions/` - Queue workflow execution (async) - `GET /api/executions/task/{task_id}` - Check task progress ### WebSocket - `WS /ws/{tenant_id}` - Real-time updates ## License MIT ## Documentation | ๆ–‡ๆกฃ | ่ฏดๆ˜Ž | |:---|:---| | [ๅŠŸ่ƒฝๆ–‡ๆกฃ](docs/functional.md) | ไบงๅ“ๅŠŸ่ƒฝ่ฏดๆ˜Žใ€ไฝฟ็”จๆŒ‡ๅ—ใ€ๅธธ่ง้—ฎ้ข˜ | | [ๆŠ€ๆœฏๆ–‡ๆกฃ](docs/technical.md) | ๆŠ€ๆœฏๆžถๆž„ใ€API ่ง„่Œƒใ€้ƒจ็ฝฒๆŒ‡ๅ— | | [ๆต‹่ฏ•ๆŠฅๅ‘Š](docs/test-report.md) | ๅ•ๅ…ƒๆต‹่ฏ•็ป“ๆžœ | | [ๅŠŸ่ƒฝ่ฏฆ็ป†่ฏดๆ˜Ž](docs/features/README.md) | ๅ„ๅŠŸ่ƒฝๆจกๅ—่ฏฆ็ป†่ฏดๆ˜Ž |