# ActiveBlue AI Multi-agent AI system integrated with Odoo 18 Community Edition. ## Architecture ``` Odoo 18 (ai.activeblue.net) └── activeblue_ai module ├── OWL2 systray brain icon + slide-in chat panel ├── Models: ab.ai.bot, ab.ai.directive, ab.ai.log, ab.ai.agent.registry └── Controllers: /ai/chat, /ai/webhook/callback, /ai/health, /ai/approval/* FastAPI Agent Service (192.168.2.47:8001) ├── POST /dispatch — route user message to MasterAgent ├── GET/POST /approval/* — human approval workflow ├── GET/POST /registry/* — agent registry + LLM backend overrides ├── POST /sweep — trigger proactive agent sweeps └── GET /health — service health + Odoo/Ollama status MasterAgent (singleton) ├── Classifies intent via LLM ├── Routes to specialist agents in parallel (asyncio.gather) ├── Manages 3-tier memory (conversation / operational / knowledge) └── Synthesises responses Specialist Agents (8, stateless): finance_agent, accounting_agent, crm_agent, sales_agent, project_agent, elearning_agent, expenses_agent, employees_agent ``` ## Privacy Modes | Mode | Behaviour | |---------|--------------------------------------------| | `local` | Ollama only for all agents | | `hybrid`| Per-agent override (DB → env → fallback) | | `cloud` | Claude for non-HIPAA agents | **HIPAA-locked agents** (always Ollama, no exceptions): `finance_agent`, `accounting_agent`, `employees_agent`, `expenses_agent` ## Quick Start ### 1. Clone and configure ```bash git clone http://192.168.1.64:3000/tocmo0nlord/odoo-ai.git cd odoo-ai cp .env.example .env # Edit .env — set POSTGRES_PASSWORD, ODOO_API_KEY, etc. ``` ### 2. Run Odoo 18 ```bash docker compose -f docker-compose.odoo.yml up -d ``` ### 3. Run the Agent Service ```bash docker compose up -d ``` Or for development: ```bash pip install -r requirements.txt uvicorn agent_service.main:app --reload --port 8001 ``` ### 4. Run database migrations ```bash cd agent_service/migrations alembic upgrade head ``` ### 5. Install Odoo module In Odoo → Settings → Apps → search "ActiveBlue AI" → Install. ## Environment Variables See `.env.example` for the full list. Key variables: | Variable | Description | |----------|-------------| | `ODOO_URL` | Odoo base URL (e.g. `http://ai.activeblue.net`) | | `ODOO_API_KEY` | Odoo user API key | | `OLLAMA_URL` | Ollama API URL (e.g. `http://192.168.2.47:11434`) | | `ANTHROPIC_API_KEY` | Required only if `LLM_PRIVACY_MODE=cloud` or `hybrid` | | `LLM_PRIVACY_MODE` | `local` / `hybrid` / `cloud` (default: `local`) | | `POSTGRES_PASSWORD` | Required — no default | | `WEBHOOK_SECRET` | Shared secret between Odoo and agent service | ## Development ### Running tests ```bash pip install pytest pytest-asyncio pytest tests/ -v ``` ### Project structure ``` odoo-ai/ ├── agent_service/ │ ├── agents/ # MasterAgent + 8 specialist agents + PeerBus + SweepCoordinator │ ├── llm/ # OllamaBackend, ClaudeBackend, LLMRouter, ToolCallValidator │ ├── memory/ # ConversationStore, OperationalStore, KnowledgeStore, MemoryManager │ ├── tools/ # OdooClient + per-domain tools (finance, crm, sales, ...) │ ├── routers/ # FastAPI routers (dispatch, approval, registry, sweep, health) │ ├── prompts/ # System prompts for each agent │ ├── migrations/ # Alembic migrations (7 tables) │ ├── logging_utils/ # Structured JSON logging + Loki push │ ├── config.py # pydantic-settings │ ├── app_state.py # Global singletons │ └── main.py # FastAPI app + lifespan startup ├── addons/ │ └── activeblue_ai/ # Odoo 18 module │ ├── models/ # ab.ai.bot, ab.ai.directive, ab.ai.log, ab.ai.agent.registry │ ├── controllers/ # webhook, health_proxy, approval + chat │ ├── views/ # XML views + menus │ ├── security/ # groups + ACL │ ├── data/ # cron jobs │ └── static/ # OWL2 JS + CSS + XML templates ├── research/ # Per-domain research notes ├── tests/ # pytest test suite ├── docker-compose.odoo.yml # Odoo 18 + PostgreSQL 15 ├── docker-compose.yml # Agent service + PostgreSQL 15 ├── Dockerfile ├── requirements.txt └── .env.example ``` ## Agent Tool Limits Each specialist agent is capped at **8 tools** (`MAX_TOOLS_PER_AGENT`). The `ToolCallValidator` raises `AgentConfigError` at startup if exceeded. ## Memory Architecture | Tier | Store | TTL | Scope | |------|-------|-----|-------| | Tier 1 | `ab_conversation_memory` | Hard cap: 200 rows/user | Per user | | Tier 2 | `ab_operational_memory` | 90 days | Per agent+scope | | Tier 3 | `ab_knowledge_store` | Permanent | Entity-keyed | ## License LGPL-3.0