I have been working on Noviz AI, an AI agent integration for ERPNext, and one architectural principle has become particularly important during development:
The LLM should reason about the user’s request, but it should not become the database, reporting engine, or visualization engine.
ERPNext and Frappe already provide most of the infrastructure required to execute business operations reliably. The AI layer can sit above that infrastructure and use it through a controlled tool interface.
Architecture
The integration is intentionally divided into separate responsibilities.
The LLM / AI layer understands the user’s intent, reasons about the required operations, selects the appropriate tools, determines filters, grouping and metrics, and interprets the returned results.
The Frappe execution layer performs the actual DocType operations, queries, aggregations, pagination and analytics while operating within Frappe’s existing permission model.
ERPNext remains the source of truth for the underlying business data, DocTypes, relationships, permissions, reports and document-generation capabilities.
This separation is important because the LLM is not being turned into an ERP database engine.
simplechart
simplechart
871×784 35 KB
Generating reports without sending the entire dataset to the LLM
One of the areas we have focused on is analytics and reporting.
Suppose a user requests a customer-wise sales analysis.
The reasoning layer can translate the request into an analytical operation containing the relevant entity, filters, grouping field, metric, aggregation and pagination requirements.
The execution layer performs that operation directly against ERPNext.
The complete result does not necessarily need to become part of the LLM’s context. The model can receive a compact representation of the analytical result, while the complete dataset remains available to the application for presentation.
This creates a useful separation:
LLM context → information required for reasoning
UI / report layer → complete information required for presentation
That becomes increasingly important when dealing with hundreds or thousands of records.
Tables, charts and reports as reusable capabilities
Tables, charts and reports do not have to become separate hard-coded AI features.
An analytics operation can produce structured data, and that same result can be consumed by different presentation capabilities.
A table can display the complete dataset. A chart can visualize the aggregated values. A report can use the same underlying query definition, and the report can subsequently be rendered as a PDF.
The LLM’s role is primarily to determine what needs to be calculated and how the result should be presented.
The deterministic execution and presentation layers perform the actual work.
This makes the system much more composable. New reporting or visualization capabilities can be added without requiring the reasoning layer to understand every implementation detail.
Reducing unnecessary token usage
This architecture also has an important effect on LLM costs.
A naive ERP AI implementation could retrieve a large number of records and repeatedly place those records into the model’s context during multi-step reasoning.
That is expensive and often unnecessary.
Instead, Noviz separates:
data retrieval → analytical processing → presentation → reasoning
For example, an aggregated result may contain hundreds of groups, but the reasoning model may only need summary information and pagination metadata to decide what to do next.
The complete dataset can remain outside the model context and be rendered directly to the user.
The LLM can therefore concentrate on the part where it provides the most value: reasoning and decision-making.
Working with Frappe’s existing permission model
Another important aspect is security.
The public Noviz Frappe application does not maintain a separate ERP credential for performing operations on behalf of the user.
The execution request is handled by the Frappe application under the authenticated user’s session. The existing ERPNext permission system therefore remains an important enforcement boundary.
The AI can request an operation, while Frappe determines whether that operation is permitted for the current user.
This keeps authorization close to the system that owns the data rather than attempting to recreate ERPNext’s permission model inside the AI layer.
User Request
│
▼
┌──────────────────┐
│ LLM / AI Layer │
│ │
│ Intent + Reasoning
│ Tool Selection │
│ Planning │
└────────┬─────────┘
│
Tool / Call Spec
│
▼
┌──────────────────────┐
│ Frappe Execution │
│ │
│ DocTypes / ORM │
│ Filters / Queries │
│ Permissions │
│ Analytics │
└──────────┬───────────┘
│
ERPNext Data
│
┌──────────┼──────────┐
▼ ▼ ▼
Table Chart Report
│
▼
PDF
Why this architecture fits Frappe particularly well
Frappe already provides the fundamental building blocks required for this type of AI integration: DocTypes, ORM, permissions, reports, print formats, APIs and the Desk environment.
The AI layer therefore does not need to rebuild an ERP abstraction from scratch.
Instead, it can act as an intelligent orchestration layer over the existing Frappe ecosystem.
A generic execution protocol is particularly useful here. Rather than exposing every internal implementation detail to the model, the AI platform can translate its reasoning into controlled operations such as retrieving documents, retrieving lists, creating or updating documents, and executing analytical operations.
The Frappe application then performs those operations using its native mechanisms.
A useful direction for AI + Frappe
This architecture opens an interesting direction for ERPNext.
Instead of building an AI feature for every individual report, dashboard or analytical question, the AI can be given a well-designed set of composable capabilities.
The intelligence determines the required operation.
Frappe executes it.
The analytics layer processes the data.
The UI renders the result.
The goal is not to replace ERPNext’s reporting or business logic. It is to make those existing capabilities accessible through a reasoning interface.
This makes it possible to build increasingly sophisticated natural-language workflows while keeping the underlying execution deterministic, permission-aware and efficient in terms of LLM context.
For AI integrations with Frappe, the separation between reasoning and execution provides a practical foundation for natural-language reporting, analytics, charts, tables, PDFs and broader ERP workflows
Top comments (0)