| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Lines of code | 3173 |
| Technical Name |
eh_ai |
| License | OPL-1 |
| Website | https://erpheritage.com.au |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Lines of code | 3173 |
| Technical Name |
eh_ai |
| License | OPL-1 |
| Website | https://erpheritage.com.au |
AI Agents Engine (Full Suite)
Bring-your-own-key multi-provider AI agents with tool calling, RAG, cost governance, and hybrid search for Odoo Community.
Why this module
AI Agents Engine (Full Suite)
Bring your own API key
Choose OpenAI, Google Gemini, xAI Grok, Azure OpenAI, local Ollama, or any OpenAI-compatible endpoint. Models are stored as configuration records, so adding a new model requires no code. One provider can handle chat; another can embed documents. Mix and match per agent.
Agents know your Odoo data
Every agent runs inside the live Odoo database and comes with built-in read-only tools: search_records to query your invoices, contacts, leads, and any document; count_records to tally what you have. The system prompt ensures agents use these tools for data questions and never ask you to upload files like a generic chatbot.
Hybrid vector plus keyword search
Index your PDF files, documents, and web pages once. Agents retrieve relevant chunks using vector similarity (semantic match) fused with Postgres full-text search (exact keywords, codes, IDs you type) via reciprocal rank fusion. Sources are cited inline so you trace every answer. Graceful fallback to in-database cosine if pgvector is absent.
Day in the life
A finance manager using AI Agents
On Monday morning, Maya opens Odoo and clicks the Ask AI button in the systray. A floating Discuss chat window opens with her custom Sales Assistant agent backed by Gemini. She types, Do we have any overdue invoices to the ABC Corp entity? The agent calls the search_records tool with a domain it built from her question, retrieves 3 overdue records, and displays them with amounts and due dates. Later, she switches to the Accounting Assistant agent and asks, Summarize our customer balance for ABC Corp. The agent runs another search, reads the total, and includes a cost row in the usage log ($0.004 from Gemini's input and output tokens). At the end of the month, the Finance Manager reviews AI Agents > Usage and Cost: total spend is $2.18 across 546 calls, trending under the $50/month soft-budget limit. She rotates to a new system prompt for sales forecasting, which auto-snapshots a version, and the team rolls back to the old one within seconds if needed. No API keys stored in Odoo; everyone brings their own Google or OpenAI key via secure Settings.
Edge cases
The cases most modules quietly ignore.
In the shipped code today, each one a place where a cheaper module silently does the wrong thing.
Agents require live outbound HTTPS to your chosen LLM provider (OpenAI, Gemini, etc.). If the provider is unreachable, the agent returns a clean error message and logs the failure without a cost row. Local Ollama instances or air-gapped clouds are supported if you provide the endpoint URL and auth.
Agent tools respect Odoo's record rules and access rules. When a user asks a question, the agent's search_records tool runs as that user, so it returns only the data the user is allowed to see. The embedding search (RAG retrieval) also enforces access: only active sources belonging to the agent are searched.
Models are catalogued as Odoo records with their technical names (e.g., gpt-5.5, gemini-2.5-flash) and pricing. If a provider retires a model or changes pricing, you edit the record in Odoo. The price-per-token is your responsibility to keep current; a timestamp field helps you track when prices were verified.
When spend approaches a soft-warn budget cap, the agent logs a server warning but the request still completes and is logged. Hard-stop budgets are enforced before the call: if exhausted, the request is refused with a UserError message. Budget periods are daily or monthly; the clock resets based on UTC midnight or month start.
Each embedding model has a fixed vector dimension (e.g., OpenAI text-embedding-3-small is 1536). When you switch an agent to a new embedding model, existing chunks are not re-embedded automatically. You must manually mark sources for reprocessing so they are re-chunked and re-embedded under the new model.
What is inside
Built to do the job, end to end.
- No IAP, no cloud lock-in. This is a bring-your-own-key engine. You bring your OpenAI, Google, or other API key; we never touch your credentials or meter calls server-side. Keys are stored in Odoo as ir.config_parameter or environment variables, masked in the UI, and read only by system admins.
- Built on the tested provider abstraction. The engine ships one adapter (OpenAICompatibleProvider) that handles OpenAI, Google Gemini, xAI Grok, Azure OpenAI, and Ollama via the Chat Completions wire format. New providers are added by registering a new adapter in extending modules (additional provider families can ship as separate add-ons).
- Agent partners are hidden from Contacts. Each agent is a res.partner with active=False, like the built-in OdooBot. It appears in Discuss as a Direct Message peer and can author messages and be a channel member, but stays out of your address book.
- Discuss channels are one-to-one by design. When you click Ask AI from anywhere in Odoo, a one-to-one Discuss channel with the agent opens as a floating chat window (not a full page). Your conversation history is stored in the channel; async replies from the agent post back via bus so you see the typing indicator and final message without a page reload.
- Tokens and cost are provider-returned, never guessed. The usage log stores the input_tokens, output_tokens, and cached_tokens exactly as the LLM provider reports them. Cost is computed as (input_tokens x price_input_per_mtok) plus (cached_tokens x price_cached_input_per_mtok) plus (output_tokens x price_output_per_mtok), all per million tokens. No length heuristics.
- Off-request-thread replies prevent timeouts. When you send a message to an agent in Discuss, the channel enqueues the message as an eh.ai.reply.job and returns immediately. A background cron process picks up pending jobs and generates agent replies without blocking your UI. Replies post back to the channel as the agent, with the requester's user context preserved for access control.
- SSRF protection on URL sources. If you add a web page as a RAG source, the engine validates that the URL resolves to a public IP address (no private ranges, no metadata endpoints, no localhost). Redirects are followed with verification; DNS rebind attacks are logged as a known future hardening.
Honest about the edges
What this does not do, so nothing surprises you.
- Does not stream responses in real time. Agents run to completion and post the final reply. A typing indicator appears while the agent runs, so the UX feels responsive.
- Does not include voice, audio transcription, or realtime sessions. Text-only agents and text output.
- Does not auto-generate Odoo views (e.g., a pivot table or a custom search filter from a natural-language question). View generation is deferred to a later milestone.
- Does not include email ingestion or document auto-routing. You manually attach files to agents as sources or upload them to the document library and Odoo indexes them.
- Does not support multi-round prompt caching (prompt caching is a provider-level feature offered by some LLM providers). Cached tokens are logged for cost visibility but are not managed by this engine.
- Does not include fine-tuning or custom embedding training. Agents use the LLM provider's public models only.
AI agents, tool calling, retrieval-augmented generation, RAG, LLM, OpenAI, Gemini, cost tracking, budget, Odoo Community, bring-your-own-key, multi-provider, embedding, vector search, hybrid search
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module