Production Workflow Agent
Read job card state, detect overdue work orders, find the bottleneck workstation - then let an LLM write the briefing
The Problem
The production manager starts every day without knowing which jobs are at risk
ForgeFlow has 50 work orders, 250 job cards, and 6 workstations. Every morning, someone manually checks which WOs are running, where they are in the routing, and whether any deliveries are at risk. It takes 30-45 minutes and is usually wrong by the time the shop floor shift starts. The workflow agent does this in seconds - reads the current job card state, identifies what is overdue, finds the bottleneck workstation, and produces a briefing the production manager can act on before the first tool is picked up.
- Reads work order and job card data from ERP to reconstruct current production state
- Identifies current operation per WO by finding the last completed job card in the routing sequence
- Flags overdue WOs, counts concurrent load per workstation, detects the bottleneck
- Generates a structured daily briefing - rule-based core, optional LLM natural language summary
The Data
Work orders and job cards
9 item families, Jan-Jun 2026. Planned vs actual start and end dates. Source of delivery risk calculation.
5 operations per WO. Status (Completed/In Progress/Pending). Source of current-stage detection per WO.
Induction Heating, Die Forging, Flash Trimming, Dimensional Inspection, CNC Turning, VMC Milling.
Heavy Forging Press, Light Forging Press, Induction Furnace Bay, Quality Lab, CNC Turning Bay, VMC Bay.
Agent Output
Production state - 16 Jul 2026
Filter by status. Click any work order to expand its detail. The daily briefing at the bottom shows the agent output - the same text the production manager receives each morning. Click “Show” to read it.
The Approach
Sense, reason, act
- Load work_orders.json and job_cards.json from ForgeFlow (or ERP export)
- For each WO, find the last completed job card to determine current operation
- Build a workstation load map: {workstation: [list of WO IDs currently there]}
- Calculate elapsed days: today - actual_start_date for each open WO
- Overdue rule: elapsed_days > planned_days for item family (from playbook 2 calibration table)
- Bottleneck rule: workstation with concurrent_wo_count >= 2 ranked by load
- Delivery risk rule: projected_completion_date > customer_delivery_date
- Template error rule: planned_days < 10 for Heavy Press items (known legacy misconfiguration)
- Rule-based briefing: structured JSON with flags per WO, bottleneck workstation, recommended actions
- LLM extension (optional): pass briefing JSON to Claude as context, ask for natural language summary
- Output channels: print to console, write to Slack webhook, email to production manager
- Next step (not in this playbook): agent with ERP write access to create task escalations directly
First LLM in the series
Why add an LLM here, not earlier?
The first three playbooks in this series used pure Python - no API key, no model calls, no hallucination risk. The data spoke for itself. A supplier scorecard, a lead time calibration, a spend dashboard - these are tables and numbers. A production manager reading them does not need a model to interpret what 0% on-time delivery means.
This playbook is different. The agent output is not a table - it is a prioritised list of decisions: which WOs to escalate, which customer to call, which workstation to relieve. That is where language models add real value - taking structured data and producing a clear, prioritised, customer-context-aware summary that a production manager can read in 90 seconds.
The rule-based core does the reasoning. The LLM adds readability. This is the correct architecture: rules for deterministic decisions, models for communication.
Core Concepts
Key ideas in this playbook
- Sense (read data) → Reason (apply rules) → Act (produce output) → repeat
- This playbook implements one iteration. A production agent runs this loop every morning
- The loop becomes more powerful when the "act" step can write back to the ERP, not just output text
- Start with read-only agents. Only add write access once the reasoning is validated over several weeks
- An ERP does not usually expose "current operation" as a single field on the work order
- You derive it from job cards: sort by routing sequence, find the first non-complete status
- This requires knowing the standard routing per item - either from BOM or from historical job card patterns
- ForgeFlow: routing is Induction → Die Forging → Trimming → Inspection → CNC/VMC (optional)
- Rules: fast, deterministic, auditable. Correct for structured decisions with clear thresholds
- LLMs: flexible, contextual, readable. Correct for summarisation, prioritisation, communication
- Never use an LLM to make a yes/no production decision (pause a work order, approve a PO)
- Use an LLM to communicate the result of a rule-based decision to a human in natural language
Architecture
Taking it to production
- Pull open WOs and job card statuses from ERP API or nightly export
- Run sense-reason-act loop against calibrated lead time table from playbook 2
- Generate structured JSON briefing with flags and recommended actions
- Optional: call LLM to produce natural language summary paragraph
- Send to Slack #production-briefing or email production manager
- After 4 weeks of validated read-only output, add ERP write tools
- Agent creates task: "Reassign WO-203 from Heavy Press - alternative routing needed"
- Agent updates planned dates on legacy-template WOs automatically
- Agent drafts customer communication for delivery risk WOs (human approves before send)
- Each new tool requires explicit validation before enabling in production
Run the notebook
Builds the production workflow agent from ForgeFlow work order and job card data. Reconstructs current production state, detects overdue WOs and workstation bottlenecks, and generates the daily briefing. No API key required for the core analysis. Optional LLM extension at the end uses the Anthropic API to add natural language summarisation.
Open in ColabWant this running on your business?
We implement these systems on your ERP, ecommerce platform, or existing data. Most projects go from data to production in 4-8 weeks.
Related services
Manufacturing Series
Manufacturing Series
Resources
This playbook
Tech stack