Back to insights
Manufacturing

AI Agents for ERPNext Manufacturing: How to Automate Production Workflows

Techseria
TechseriaTeam

AI Agents for ERPNext Manufacturing: How to Automate Production Workflows

ERPNext is the operational system of record for your manufacturing business. It holds your Bills of Materials, tracks your Work Orders, manages your Production Plan, and runs your MRP. It knows what should be happening.

What ERPNext does not do on its own is monitor what is actually happening against what should be happening, reason about the gaps, and take corrective action — across multiple ERPNext modules and potentially across multiple connected systems — without a human initiating each step.

That is what a LangGraph.js AI agent does. This guide is the technical explanation of how ERPNext manufacturing agents are built, what they look like in code, and what they cost.

ERPNext Manufacturing Module: The Data Foundation

Before the agent architecture, you need to understand what ERPNext's manufacturing module actually contains and how an agent interacts with it.

Bill of Materials (BOM): the master definition of what a product is made of. Every BOM has a parent item, a list of components with quantities, the operations to be performed, and the workstations where they are performed. An agent uses the BOM to determine what materials and capacity are required for any production run.

Production Plan: the weekly or monthly production schedule. Defines what quantities of which finished goods are to be produced, in which week, feeding from Sales Orders or manual planning. An agent monitors the Production Plan for feasibility — checking whether materials and capacity are available as planned.

Work Order: a specific instruction to produce a specific quantity of a specific item. Linked to the BOM, assigned to a workstation, with planned start and end dates. An agent reads Work Order status to track production progress and writes to Work Orders to update status, quantity produced, and quality results.

Job Card: the floor-level execution record. Each Job Card corresponds to one operation within a Work Order — the time a workstation operator starts and finishes a specific operation, and the output quantity. Job Cards are the agent's most granular view of what is happening on the production floor in real time.

MRP (Material Requirements Planning): calculates what materials need to be purchased and when, based on the Production Plan, BOM, and current stock levels. An agent can trigger MRP re-runs when the Production Plan changes, and can act on MRP recommendations to create Purchase Requisitions automatically.

Quality Inspection: records inspection results at goods receipt, in-process, or finished goods stages. An agent monitors Quality Inspections for defect patterns and can trigger holds, quarantine actions, and NCR (non-conformance report) creation.

How LangGraph.js Integrates with ERPNext via REST API

ERPNext exposes its entire data model via the Frappe REST API. The key endpoints for manufacturing agent integration:

Reading data:

GET /api/resource/Work Order?filters=[["status","=","In Process"]] GET /api/resource/Job Card/{id} GET /api/resource/Production Plan/{id}

Writing data (creating and updating records):

POST /api/resource/Work Order # Create new Work Order PUT /api/resource/Work Order/{id} # Update status, quantities POST /api/resource/Purchase Requisition # Create procurement request

Authentication uses API key + API secret passed as Authorization header. For agent-to-ERPNext writes, Techseria creates a dedicated service account with role-based permissions scoped to exactly what the agent needs — it can create Purchase Requisitions but cannot delete Work Orders, for example.

The Frappe REST API is well-documented and version-stable. ERPNext v14 and v15 both support these endpoints. The API does not support all write operations for all doctype states — for example, a submitted Work Order cannot be edited directly; it must be amended. The agent must handle these workflow state transitions correctly.

The TypeScript State Schema for a Manufacturing Agent

LangGraph.js agents are defined as stateful graphs. The state is the shared context that all nodes in the graph can read and update. Here is the TypeScript state schema for a production monitoring agent:

interface ManufacturingAgentState { // Context: what triggered this agent run triggerType: "scheduled" | "work_order_update" | "material_shortage" | "quality_flag";

This schema gives the agent everything it needs to reason about the current production situation and every action it takes — and gives the monitoring dashboard full visibility into what the agent decided and why.

A Real Production Workflow: Plan vs Actual Monitoring Agent

Here is how a production monitoring agent works end-to-end, from trigger to action.

Node 1: Trigger and Context Load

The agent runs on a scheduled trigger every 30 minutes. On each run, it loads the current state: all Work Orders in "In Process" status, their associated Job Cards, the Production Plan for the current week, and material availability for all items with open Work Orders.

This context load typically involves 8–15 API calls to ERPNext. Responses are parsed and stored in the agent state. Total context load time: 3–8 seconds.

Node 2: Plan vs Actual Analysis

The agent compares `plannedQty` vs `producedQty` across all active Work Orders. It calculates:

  • Production pace: are we on track to complete by the planned end date given current throughput?
  • Bottleneck identification: which workstations have Job Cards that are overdue or have unusually long elapsed times?
  • Material risk: for Work Orders not yet started, does material availability support planned start?

This node uses the LLM to synthesise the data into a structured assessment. The prompt is tightly constrained — it receives structured JSON and returns structured JSON, not free text. Example output:

{ "overallStatus": "at_risk", "risksIdentified": [

Node 3: Decision and Action Routing

For each identified risk, the agent applies decision rules:

Material shortage with >48-hour impact and purchase order not yet raised: create a Purchase Requisition in ERPNext with expedited delivery flag. Confidence above 0.85 → auto-create. Below 0.85 → propose to buyer for approval.

Material shortage with <48-hour impact (PO already in transit): create a monitoring task for the buyer to track delivery, flagged as high priority.

Production pace shortfall with <10% gap: log the observation, continue monitoring. No action required.

Production pace shortfall with >10% gap and >2 days remaining to due date: create a ToDo task for the production planner with the analysis and three schedule options. Require approval before ERPNext schedule update.

Node 4: ERPNext Action Execution

For approved or high-confidence decisions, the agent executes the actions in ERPNext:

async function createPurchaseRequisition( state: ManufacturingAgentState, shortage: MaterialShortage

Note the `custom_agent_created` field — every record created by the agent is tagged so the monitoring dashboard can distinguish agent-created records from human-created ones, and so any agent-created record can be reviewed or reversed if needed.

Node 5: Human-in-the-Loop Routing

For decisions that require human approval, the agent creates a ToDo in ERPNext assigned to the relevant person, with a structured description:

"PRODUCTION AGENT: Material shortage detected. Item RM-0042 for Work Order WO-2025-04821 (150 units, planned start 18 June). Shortfall: 150 units. Nearest alternative supplier: ACC Components, 3-day lead time, £4.20/unit vs usual £3.85/unit (£52.50 premium for expedited order). Proposed action: Create PO with ACC Components for 165 units (inc. buffer). Approve / Reject / Modify — please respond within 2 hours."

The agent polls the ToDo status every 15 minutes. When the buyer marks it as resolved with a note, the agent reads the resolution and either executes the approved action, discards the rejected action, or executes the modified action.

This HITL loop is what makes the agent production-safe. The agent never acts autonomously on a decision it is not confident about, and every human decision feeds back into the agent's audit log.

Monitoring: The Production Agent Dashboard

Every agent run is logged to an Azure SQL event table. A Power BI dashboard surfaces:

  • Runs per day, success rate, error rate
  • Actions executed: auto-executed vs HITL-routed, by action type
  • Human approval rate and average resolution time
  • Production risk events detected, by type and severity
  • Work Orders where agent intervention was credited with preventing a delay

This dashboard is the COO's view of what the agent is doing — not just a system health check, but a business performance view.

Build Cost and Timeline

Cost range: £22,000–£45,000 on top of existing ERPNext (not including ERPNext implementation if not already in place).

The range reflects:

  • Lower end (£22k–£30k): single agent focused on one workflow (production monitoring or procurement automation), existing ERPNext with clean data, no custom integrations beyond ERPNext, standard HITL via ERPNext ToDo
  • Upper end (£35k–£45k): two workflows combined (production monitoring + automated procurement), integration with external systems (supplier portal, sensor data feed), custom review interface instead of ERPNext ToDo, higher data complexity or non-standard ERPNext configuration

Timeline: 8–12 weeks

  • Weeks 1–2: ERPNext audit, API access confirmation, process mapping, state schema design
  • Weeks 3–6: Agent build — node implementation, ERPNext integration, HITL workflow
  • Weeks 7–9: Testing with production data (parallel run)
  • Weeks 10–11: Staged deployment to production
  • Week 12: Monitoring dashboard, documentation, hypercare handover

Ongoing costs after delivery:

  • Azure hosting: £150–£350/month
  • LLM API (Azure OpenAI): £80–£200/month depending on run frequency and Work Order volume
  • ERPNext licences: unchanged from current (no additional seats required for agents)
  • Maintenance retainer (optional): £500–£900/month for monitoring, minor updates, and schema change handling

What You Need Before Starting

A successful ERPNext manufacturing agent project requires:

  1. ERPNext v14 or v15 with manufacturing module active and Work Orders in regular use
  2. API access confirmed — service account with appropriate permissions, firewall rules allowing Azure Container Apps outbound connections to your ERPNext instance
  3. Clean BOM and routing data — if your BOMs are incomplete or inaccurate, the agent's material availability calculations will be wrong. BOM audit is often the first task.
  4. Digital Job Cards — if Job Card completion is paper-based, the agent cannot read real-time production progress. Digital job card capture (mobile or workstation terminal) must be in place.
  5. Named internal owner — someone who understands the production planning process and can validate agent decisions during the testing phase

Techseria's pre-build audit (included in project scope, Weeks 1–2) confirms all five prerequisites and identifies any remediation needed before the build starts.

Ready to build your first ERPNext manufacturing agent? Book a technical consultation with our manufacturing AI team. We will review your ERPNext configuration, confirm the integration scope, and give you a fixed-fee quote within 5 business days.

[Get a Fixed-Fee Quote →]

Ready to accelerate your operations?

See how custom AI solutions, ERPNext integration, and workflow automations can lower your operating costs. Book your free 30-minute Workflow Audit with a senior engineer.

Further Reading

Recent Articles

Measuring ROI on AI Agent Deployment: The Only 5 KPIs That Actually Tell You If It's Working

The 5 KPIs that tell you if your AI agent deployment is working: cycle time, error rate, FTE savings, exception escalation rate, cost-per-transaction. Frameworks for CFOs and COOs.

Techseria

Azure DevOps for Mid-Market: Is the Complexity Worth It vs GitHub Actions?

Azure DevOps or GitHub Actions for mid-market teams? Honest comparison covering pipelines, boards, repos, pricing, and the scenarios where each wins.

Techseria

Azure AI Foundry vs Custom LLM Integration: Decision Guide for Enterprise Teams

Azure AI Foundry or custom LLM integration? This decision guide covers when each approach is right, what Azure AI Foundry provides, and what you give up by going custom.

Techseria
Techseria

Engineering the enterprise of tomorrow — from strategy through operations.

UK Address

Techseria (UK) LTD 71-75 Shelton Street, Covent Garden, London, WC2H 9JQ

India Address

Techseria Private Limited G-1209, Titanium City Center, 100 Feet Shyamal Road, Satellite, Ahmedabad – 380015

© 2026 Techseria Technologies, Inc. All rights reserved.