MCP and AI operations

Offload AI Agent Work from Odoo Workers

Short answer

Long AI jobs should not hold an Odoo HTTP request open while they scan, transform or update large record sets. Submit bounded work to a background queue, return a job identifier, and move warehouse-style analytics outside the transactional worker pool.

Why a long request is the wrong contract

In a production Odoo deployment, new HTTP requests wait when the worker pool is busy. An AI client that opens one request for a large export, multi-step analysis or batch change makes three things harder at once: capacity planning, timeout recovery and proof of what actually ran.

A better contract separates submission from execution. The initial tool call validates the user, scope and payload, records the job and returns quickly. A worker processes bounded batches. The client reads status and results with separate calls instead of assuming that a disconnected request failed.

Choose among a direct tool, queued job and warehouse query

WorkExecution patternReason
Read one customer or invoiceDirect bounded MCP toolSmall, permission-sensitive and quick to verify
Update a reviewed set of recordsQueued job with approval and statusNeeds batching, retry control and an audit trail
Scan years of transactions across systemsWarehouse queryAnalytical workload should not repeatedly scan the operational database

The MCP Server for Odoo exposes asynchronous job capabilities for supported operations. A BigQuery pipeline is a separate option when the question needs a maintained analytical dataset rather than a live transactional call.

Make every queued task bounded and repeatable

  • Store the authenticated user, company, tool, arguments and scope used at submission.
  • Cap record counts and batch sizes; do not let an agent silently widen the job.
  • Use an idempotency key or stable fingerprint where a retry could duplicate work.
  • Expose pending, running, completed, failed and expired states.
  • Keep partial progress and error evidence without returning protected fields.
  • Define whether cancellation is safe and what happens to a partly completed batch.

Test failure, not only success

  1. Submit a job whose expected result is already known.
  2. Disconnect the client after submission and confirm the job can be found again.
  3. Force one batch to fail and verify status identifies the failure without rerunning completed work blindly.
  4. Revoke the credential and test whether future work is blocked as designed.
  5. Measure worker, database and queue behavior under a representative workload.

Sources

Frequently asked questions

Why should an AI agent avoid one long Odoo request?

Odoo has finite request workers and resource limits. A long request occupies capacity while the client waits, and a timeout can leave the client unsure whether work completed. Short submission and status requests make execution and recovery easier to govern.

Which AI tasks belong in a warehouse?

Large historical scans, cross-system joins, repeated aggregates and model-training extracts are better candidates than transactional lookups. Keep permission-sensitive operational actions in Odoo and move only approved analytical data.

Does a background queue make every task safe?

No. The task still needs bounded scope, idempotency, permission checks, status, cancellation or expiry, failure evidence and an owner. A queue changes execution timing; it does not replace governance.

Review one long-running agent workflow

Share the models, record volume, current request shape and required outcome. We will identify what stays transactional, what queues and what belongs in a reporting destination.

Review the workflow →