Open-Source AI Copilot for ERPNext — DeepSeek, Ollama & OpenAI Support

I built an open-source AI Copilot for ERPNext and wanted to share it with the community, particularly because there has already been discussion around native AI / DeepSeek integration in ERPNext.

GitHub: ameenmari/erpnext_copilot

The goal of this project is to provide a practical AI interface directly inside ERPNext without giving the LLM unrestricted access to the database or Python environment.

What it currently does

You can ask ERPNext questions in natural language such as:

  • Show unpaid invoices older than 30 days

  • Show low-stock items

  • Show this month’s sales invoices

  • How many sales orders were created this week?

  • Show customers with overdue payments

  • Show purchase orders waiting for approval

  • Find customer ABC

The flow is:

Natural-language question → structured query plan → validation → ERPNext execution

The important part is that the model does not directly execute SQL or arbitrary Python.

Security / permissions

The app executes reads through the current ERPNext user context, using Frappe APIs such as frappe.get_list and frappe.get_doc.

The current implementation intentionally avoids:

  • Raw SQL execution by the LLM

  • Generated Python execution

  • ignore_permissions

  • Unapproved mutations

Create operations, where enabled, are presented as drafts and require explicit approval.

The idea is that the AI should operate within the permissions the ERPNext user already has rather than becoming a privileged database interface.

LLM providers

The app uses OpenAI-compatible endpoints, so it can work with providers such as:

  • OpenAI

  • Azure OpenAI

  • Groq

  • Ollama

  • Other OpenAI-compatible endpoints

This also means local models can be used instead of sending requests to a hosted provider.

For example, Ollama can be configured with an OpenAI-compatible base URL.

Privacy

ERP business records are queried locally inside ERPNext.

The LLM receives the user’s question and the relevant DocType metadata needed to construct the query plan, rather than receiving the entire ERP dataset.

This is intended to make the architecture more suitable for organizations that are concerned about sending ERP data to external AI services.

Current status

This is an MVP and is intentionally read-focused at the moment.

Current capabilities include:

  • Natural-language ERPNext queries

  • DocType/schema-aware planning

  • Structured JSON query plans

  • Query validation

  • Permission-aware execution

  • Counts, lists and document lookups

  • Optional draft creation with explicit approval

  • OpenAI-compatible model support

  • Local LLM support through compatible endpoints

It does not currently attempt to handle every ERPNext workflow or mutation.

Why I’m sharing it here

The ERPNext community has already expressed interest in AI/DeepSeek integration, and I would rather get feedback from actual Frappe/ERPNext users than continue developing this in isolation.

I’m particularly interested in feedback on:

  1. Which ERPNext workflows would benefit most from an AI assistant?

  2. Would you prefer hosted models, local models, or both?

  3. What permission/security controls would you consider mandatory?

  4. Which DocTypes or ERPNext modules should be supported next?

  5. Would this be useful as a standalone community app, or would parts of it make sense as a native Frappe/ERPNext capability?

If you’re running ERPNext and have a use case for this, I’d appreciate it if you could try it and report what works, what doesn’t, and what you would want changed.

Feedback and contributions are welcome.

1 Like