Connecting an AI agent to Odoo without breaking user permissions
Most Odoo integrations run as one account that sees everything, bypassing Odoo access rules entirely. Here is the alternative.
· 8 min read
What the usual integration gets wrong
The typical integration stores one API key and uses it for every request. The agent therefore sees the union of whatever that key can see, for every employee. A salesperson can ask the chat about a colleague's payroll, and the agent will answer.
This is not a bug but a structural consequence of the design. The controls usually on offer (an allowed-tool list, a write switch) are all agent-wide, and none of them vary by who is asking.
Identity comes from Odoo, not the browser
First rule: never let the browser decide who the user is. If your system accepts a user id from the request body, anyone can type someone else's and read their conversations and data.
The correct shape: the Odoo server signs a short-lived assertion stating who the current user is, read server-side from `request.env.user`. The browser only carries the sealed envelope and cannot alter what is inside.
- Sign the assertion with a shared secret and keep its lifetime short: two minutes is plenty.
- Give each assertion a single-use nonce, or a captured one can simply be replayed.
- Refuse the superuser (`uid <= 1`) explicitly at every layer.
Writes need a human gate
Reads can be delegated confidently because Odoo guards them. Writes are another matter: creating an invoice or amending an order is irreversible. Every write should be shown to the user in its final form and wait for explicit approval in the chat.
And log every write to an audit trail attributed to the real user, not to "the agent". When something goes wrong and someone investigates, the difference between those two is everything.
Frequently asked
- Does this slow the agent down?
- Only marginally: the identity exchange happens once at the start of a session, not per message. Executing as the user costs Odoo no more than a normal session does.
- What if a user tells the agent they are the manager?
- The model has no mechanism to change the acting identity: it is bound at tool-build time from the signed session, outside the model's reach. What the user claims in chat changes nothing.
Read next
A security checklist before launching an AI agent
What to verify before your agent talks to a real customer: prompt injection, tenant isolation, data leakage, and audit.
How to build an Arabic AI agent for customer service
A practical guide to an agent that understands Modern Standard Arabic and dialects, answers only from your knowledge, and hands off to a human when needed.
Running an AI agent on WhatsApp Business
What running an agent on WhatsApp actually requires: the account, the 24-hour window, templates, and human handoff.
