Skip to main content
← All posts
By Abhay Muttreja, Founder, SolvTreeAI

An AI Agent on ERPNext: Draft, Review, Post

Add an AI agent to your existing ERPNext: draft bills, WhatsApp order updates and exception queues, with a person reviewing before anything is posted.

·8 min read
  • erpnext
  • india
  • integrations

The short answer

An ERPNext AI agent is a layer that reads documents and messages, prepares drafts inside ERPNext (purchase invoices, sales orders, payment follow-ups, replies to customers), and leaves them for a person to review and submit. You keep ERPNext. The agent uses ERPNext's REST API and permissions, and nothing is posted without a human step unless you explicitly decide otherwise.

Key points

  • An ERPNext AI agent should draft, a named person should review, and ERPNext permissions should decide who posts.
  • Start with frequent, reversible documents such as purchase invoices from known suppliers.
  • The agent must be allowed to say it is not sure, and to leave a document in review.
  • Your administrator should be able to turn the agent off in one step.

What this page is not: a new ERP, and not another ERPNext versus Odoo comparison. For that, read ERPNext vs Odoo vs custom ERP. For the bigger idea, see AI-native ERP.

What people usually mean by "AI in ERPNext"

  • "Read the supplier's PDF bill and create the Purchase Invoice."
  • "Tell customers on WhatsApp when their Delivery Note is submitted."
  • "Answer 'what's my outstanding?' without someone opening the ledger."
  • "Show me which orders are stuck and why."

What ERPNext already does, and where it stops

ERPNext (built on the Frappe framework) has a REST API, webhooks, server scripts, notifications and role permissions. That makes it a good base for an agent. Frappe community apps and forum threads cover WhatsApp and some AI experiments, but quality and maintenance vary. Check the current Frappe documentation and the app's maintenance history before relying on any community app.

Where it stops:

  • ERPNext stores and validates documents. It does not read an unstructured PDF or WhatsApp voice note.
  • It does not decide which exceptions matter to whom.
  • Custom doctypes and naming series differ between companies, so generic AI plugins rarely fit.

A recommended workflow

  1. Intake. Bills arrive by email, WhatsApp or upload; customer messages arrive on WhatsApp.
  2. Extract. The agent reads supplier name, GSTIN, invoice number, date, items, HSN, quantities, rates and taxes.
  3. Match. It looks up the Supplier, Items and open Purchase Orders or Receipts in ERPNext.
  4. Draft. It creates a draft Purchase Invoice (docstatus 0) linked to the PO, with any mismatch noted in a comment.
  5. Exception queue. Mismatches (rate, quantity, tax, unknown item, possible duplicate invoice number) go to a list for the accounts user.
  6. Human submit. A person reviews and submits. The agent's API user cannot submit documents; its role allows only create and comment.
  7. Messaging. On Delivery Note submit, a webhook triggers an approved WhatsApp template to the customer.

Failure cases

  • The agent's API user has too many permissions. Give it its own role with draft-only rights.
  • Supplier names in PDFs that do not match ERPNext. Use GSTIN as the primary match.
  • ERPNext version upgrades changing field names in custom scripts. Test after each upgrade.
  • Self-hosted ERPNext not reachable from outside. Plan network access carefully, or run the agent on the same network.

Local rules

  • GST invoice particulars follow the CGST Rules; e-invoicing applies above the notified turnover threshold. The agent checks fields against your configured rules; your accountant remains responsible.
  • WhatsApp Business Policy: opt-in and approved templates for outbound updates.
  • Data: India's Digital Personal Data Protection Act, 2023 applies to customer data the agent reads. Decide which data may be sent to an external AI model, and mask what does not need to leave.

Example (illustrative, not a SolvTree client)

A Rajkot engineering components maker runs self-hosted ERPNext. Supplier bills arrive as PDFs and photos on WhatsApp. After the change, the agent creates draft purchase invoices linked to receipts, flags rate differences, and the accounts executive reviews a short list each afternoon instead of typing every bill. Customers get a dispatch message when the delivery note is submitted.

Draft, review, post: making the three states visible in ERPNext

An AI agent on ERPNext is useful only if people can see what state a document is in. "The AI is handling bills" is not a state. The three states that keep accounts calm are: a draft the agent prepared, a review a named person made, and a posted document that ERPNext treats as a real voucher.

Give each of those states a clear home. Drafts should appear in a list the reviewer already opens, with the original file (the supplier PDF or the WhatsApp photo) next to the extracted fields, and with the differences from a purchase order highlighted when a PO exists. Review should require a person to accept, edit or reject, and should record who did it. Posting should use ERPNext's own permissions: if a clerk is not allowed to post a purchase invoice above a certain value today, the agent must not give them a back door.

ERPNext, through the Frappe framework, already gives you a REST API, roles, permissions and webhooks. That is enough to attach an agent without replacing ERPNext. The work is in the mapping: which Doctype is created, which fields are mandatory, which Workflow state is used, and which Notification goes to the reviewer. If those names are wrong, the agent's "success" will be a document the accountant cannot find.

Documents that should wait, and documents that can go first

Start with a document type that is frequent, structured and reversible. Incoming purchase invoices from a known set of suppliers are a common first choice: the GSTIN is on a master, the item codes are mostly known, and a wrong draft can be cancelled before posting. Leave journal entries, payroll-related vouchers, and anything that touches a GST return until the first type is trusted. A clever agent that drafts a journal is a larger risk than a modest agent that drafts a purchase invoice well.

For Indian GST, the draft must respect the particulars a tax invoice has to carry under the CGST Rules, and it must not invent an IRN or a credit note. Where e-invoicing applies to your turnover, the IRN comes from the GST e-invoice system through the process your accountant already uses. The agent can prepare data and can flag a missing GSTIN or a mismatch with GSTR-2B when you have that data; it should not "fix" a tax amount quietly.

When a supplier sends a bill that does not match a PO, or that uses a unit of measure you do not stock, the document stays in review with a reason. The agent is allowed to say "I am not sure." That sentence is more valuable than a confident, wrong post.

A controlled first month on one company

If you have several companies in ERPNext, pick one. If you have many warehouses, pick one. Run the agent in draft-only mode for at least two weeks. Every morning, the reviewer clears the queue, and once a week you measure: drafts accepted without edit, drafts edited, drafts rejected, and the time from receipt of the file to a posted invoice. You are looking for a trend, not a target we invented.

Access rights should be reviewed as part of the same month. An agent that can read all customers and all supplier bills is a personal-data and a commercial-data decision. India's DPDP Act applies to personal data in those records; commercially, you may also not want every operations user to see every margin. Use ERPNext roles, and give the agent the least access it needs.

At handover, your ERPNext administrator should be able to turn the agent off, to change the reviewer, and to add a mapped supplier, without a code change. If "turn it off" is not a one-step action, we are not done.

Notifications that accountants will not ignore

An ERPNext reviewer who is emailed fifty times a day will stop reading. Design notifications as a single morning list (and a shorter afternoon list if the volume needs it), with a count of drafts waiting, a count that are older than your service level, and a link to the list, not fifty separate mails. Urgent items (a bill with a discount date that is about to pass, a document that failed to save) can be an exception; they should be rare, or they are not urgent.

The same list is what we use at handover to show the workflow is alive. If the list is empty because nothing is flowing, or always full because nobody is reviewing, the project is not in production, whatever the go-live date said. Your ERPNext administrator should be able to change the reviewer and the notification schedule without us.

Opening balances and the documents you should not backfill

It is tempting, once the agent works on new bills, to point it at last quarter's PDF folder and "catch up." Do not, without a written plan. Historic documents may already be posted, may already be in a GST return, or may belong to a cancelled bill that someone filed twice. A backfill should run as a labelled batch, in draft only, against a list accounts has approved, and should refuse to post anything whose invoice number already exists.

Opening balances, similarly, stay a human job. The agent is for documents that arrive from today forward. Mixing a catch-up with a live queue is how a posted duplicate appears and how trust in the first-month numbers is lost.

Next step

Pick one ERPNext company and one reversible document type, usually purchase invoices from known suppliers, and run the agent in draft-only mode for two weeks. Use ERPNext roles so the agent has the least access it needs, and make "turn it off" a one-step action for your administrator. We implement a draft-review-post layer around ERPNext through its documented API, without replacing it. See ERPNext vs Odoo vs custom ERP, our AI-native ERP article, our ERP working layer project, or book a call.

Frequently asked questions

Do we need to leave ERPNext to use AI?
No. The agent works through ERPNext's API with its own restricted user. Your data, doctypes and processes stay in ERPNext. If anything, an agent works better on a well-configured ERPNext because the masters it matches against are already clean.
Does this work on Frappe Cloud and self-hosted ERPNext?
Yes, in both cases through the REST API. Self-hosted instances need a secure way for the agent to reach the server, or the agent can run inside your network. We check your hosting, version and custom apps in the first session.
Can the agent post invoices without a person?
Technically it could, but we set it up so it cannot by default. Its role allows creating drafts and adding comments, not submitting. After a few months, some teams choose to auto-submit narrow, low-risk cases, such as a bill that matches a receipt exactly. That is your decision, written down.
How does this relate to Odoo?
The pattern is the same: read, draft, review, post. The connection details differ. If you run Odoo in the UAE, see our AI agent on Odoo for UAE businesses. If you are still choosing an ERP, our comparison post covers the decision.
What data leaves our server?
Only what the AI step needs, such as the text of a bill. We can mask or exclude fields, use providers with clear data terms, and keep logs of what was sent. For sensitive setups, parts of the processing can run on your own infrastructure. We document the data flow before go-live.

Sources

  1. REST API (Frappe Framework documentation)
  2. ERPNext introduction (Frappe documentation)
  3. Tax Invoice, Credit and Debit Notes (CBIC GST)
  4. Government notifies DPDP Rules (Press Information Bureau)