"How much stock of item X is left?" "Which customers still owe us money this month?" These are the questions people in a small company ask all day, and they are exactly the questions an ERP can answer. So the obvious next step is a chat assistant on top of the ERP.
The hard part is not the language model. It is permissions. In an ERP the cashier must not see payroll, a salesperson usually sees only their own customers, and the accountant sees money but not HR records. An assistant that quietly runs with an admin key breaks all of that in one prompt.
This post describes the design we use as a reference when thinking about assistants on top of Softway ERP, an MIT-licensed ERP for Vietnamese SMEs with a documented REST API and role-based access (the public demo has twelve roles). The pattern applies to any ERP with an API and real access control.
Rule 1: the assistant has no permissions of its own
The assistant never holds a service account. Every call it makes to the ERP is made as the logged-in user, with that user's token or session. If the cashier asks about payroll, the ERP returns "forbidden", exactly as it would in the web UI.
This one rule removes a whole class of bugs. You do not need to re-implement the ERP's access rules inside the prompt, and you cannot "prompt inject" your way past a 403.
Rule 2: tools, not raw queries
Do not let the model write SQL against the ERP database. Give it a small set of tools that map to existing API endpoints:
# illustrative pseudo-code, not a real Softway API get_stock(product_query) -> on-hand, reserved, by warehouse list_overdue_invoices(period) -> customer, amount, days overdue get_sales_summary(period, scope) -> totals the current user may see Each tool calls the REST API with the user's credentials and returns only fields that endpoint already exposes. The model chooses which tool to call and how to phrase the answer, nothing more.
Rule 3: read first, write with confirmation
Start read-only. When you add write actions (create a quotation, log a payment), have the tool return a draft that the user confirms in the normal UI. The ERP's own approval steps then apply as usual.
Rule 4: log every tool call
Store user, tool, parameters and result size for every call. When someone asks "why did the assistant tell me X?", you can replay it. It also shows which questions people actually ask, which is the best input for the next tool to build.
Rule 5: keep data where the company wants it
Many SMEs self-host their ERP precisely to keep data in-house. If you send ERP results to a hosted model, say so plainly and send only what is needed for the answer. For sensitive deployments, a model you can run on the same infrastructure keeps the whole loop inside the company.
A minimal flow
- User asks in chat, already logged in to the ERP.
- The assistant picks a tool and parameters.
- The tool calls the ERP REST API with the user's token.
- The ERP enforces its normal role rules and returns data or "forbidden".
- The assistant answers in plain language and links to the ERP screen where the user can check the numbers.
Step 5 matters: the assistant is a shortcut to the right screen, not a second source of truth.
Try the ERP side
The public demo lets you log in as each of the twelve roles and see how differently the same system looks to each person, which is the behaviour your assistant should inherit:
If you are building assistants on top of business systems, I would like to hear how you handle permissions. Comments are open, or reach us via softway.vn.