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
| Work | Execution pattern | Reason |
|---|---|---|
| Read one customer or invoice | Direct bounded MCP tool | Small, permission-sensitive and quick to verify |
| Update a reviewed set of records | Queued job with approval and status | Needs batching, retry control and an audit trail |
| Scan years of transactions across systems | Warehouse query | Analytical 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
- Submit a job whose expected result is already known.
- Disconnect the client after submission and confirm the job can be found again.
- Force one batch to fail and verify status identifies the failure without rerunning completed work blindly.
- Revoke the credential and test whether future work is blocked as designed.
- Measure worker, database and queue behavior under a representative workload.
Sources
- Odoo system configuration documentation — worker pools, queued requests and resource limits
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.
Continue in this topic
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 →