I run autonomous AI agents against live Odoo databases daily: data reconciliation, scheduled reporting, migration verification. This is the pattern that keeps it safe.
The connection Odoo 19 speaks XML-RPC and JSON-RPC. Generate an API key per user (Preferences → API Keys), then authenticate with username plus key instead of password. The agent stores the key, not the password, and revocation is one click.
import xmlrpc.client url = "https://odoo.example.com" db = "production" username = "agent@company.com" key = "API_KEY" common = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/common") uid = common.authenticate(db, username, key, {}) models = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/object") models.execute_kw(db, uid, key, "res.partner", "search_count", [[["customer_rank", ">", 0]]]) JSON-RPC works the same way with the /json/1 endpoint and the API key in the password field. I use XML-RPC for scripts (stdlib only, no dependencies) and JSON-RPC when the agent already speaks HTTP.
...