> How to build an AI agent for after-sales service: serial number to spare part, RMA drafting, manual RAG, and the rule that identifiers only come from tools.
>
> Web page: https://balazscsorba.com/blog/aftersales-agent-rma-spare-parts · Language: English · Also available in: [Deutsch](https://balazscsorba.com/de/blog/aftersales-agent-rma-spare-parts.md) · [Magyar](https://balazscsorba.com/hu/blog/aftersales-agent-rma-spare-parts.md)
> Author: Balázs Csorba · Published: 2026-10-13 · Keywords: AI agent for after-sales service, spare parts identification AI, rma automation, serial number to spare part, service parts agent, service knowledge RAG, first-time-fix rate, aftermarket revenue, exploded diagram parts catalog, part number hallucination

[Blog](https://balazscsorba.com/blog)/AI agents

# AI agent for after-sales service: RMA, spare parts and exact-match rules

How to build an AI agent for after-sales service: serial number to spare part, RMA drafting, manual RAG, and the rule that identifiers only come from tools.

[Balázs Csorba](https://balazscsorba.com/about)·October 13, 2026·8 min read

-   After-sales
-   Spare parts
-   RMA
-   AI agents
-   Aftermarket

![A spare part rises from an open box, with a return arrow from a parcel.](https://balazscsorba.com/images/blog/aftersales-agent-rma-spare-parts/cover.webp?v=ad1c4b877a)

## Key takeaways

-   An after-sales agent covers intake, asset identification, spare-part lookup, RMA creation and status, and credit-note follow-up, while safety advice, goodwill and credit decisions stay human.
-   Part numbers, serial numbers, RMA and credit-note numbers may only appear in an answer if a tool returned them in that turn; anything else is rejected and escalated.
-   A study of 2.23 million package recommendations found 19.7% pointed to packages that do not exist, which is why an agent must never generate identifiers.
-   Aftermarket is where industrial margin sits: McKinsey reports 25% average EBIT for aftermarket services versus 10% for new equipment, and BCG puts spare-part gross margins at about 50%.
-   Measure first-time-fix rate, RMA cycle time, handling time per ticket and the share of self-served part orders; Aquant’s 2026 benchmark puts median first-time-fix at 77%.

On this page

1.  [What does an after-sales agent own?](https://balazscsorba.com/#what-an-aftersales-agent-owns)
2.  [How does the agent get from a serial number to an RMA?](https://balazscsorba.com/#the-happy-path-serial-number-to-rma)
3.  [Why exact match or nothing?](https://balazscsorba.com/#exact-match-or-nothing)
4.  [Which system owns which after-sales data?](https://balazscsorba.com/#who-owns-which-data)
5.  [How should the agent use manuals and diagrams?](https://balazscsorba.com/#service-knowledge-rag-over-manuals-and-diagrams)
6.  [Which actions may the agent take on its own?](https://balazscsorba.com/#permissions-and-guardrails)
7.  [What is an after-sales agent worth?](https://balazscsorba.com/#what-it-is-worth)
8.  [When should you not build an after-sales agent?](https://balazscsorba.com/#when-not-to-build-one)
9.  [A build checklist for an after-sales agent](https://balazscsorba.com/#checklist)
10.  [Sources](https://balazscsorba.com/#sources)

Listen to this article

0:000:00

An **AI agent for after-sales service** handles the life of a product after the sale: a service ticket comes in, the agent identifies the machine, finds the spare part, drafts a return or replacement, and follows the shipment and the credit note until the case is closed. It does that through tools over the ERP, the catalog, the document store and the CRM, and it follows one hard rule: part numbers, serial numbers and RMA numbers come from those tools, never from the model.

This article covers what the agent owns, the happy path from serial number to RMA, the exact-match rule and how to enforce it, the data ownership map, retrieval over manuals and diagrams, permissions and approval gates, the aftermarket business case and when not to build one. Pre-sale questions on the shop are a different job, covered in [AI support for B2B shops](https://balazscsorba.com/blog/ai-assistant-b2b-shop-customer-support).

## What does an after-sales agent own?

It owns the routine post-sale work: intake and triage of defects, wrong deliveries, warranty cases and wear parts; asset identification; spare-part lookup; RMA creation and status; shipment and credit-note follow-up; and escalation. People keep safety-critical part advice, credit and goodwill decisions, and contract exceptions.

Triage decides the path. A defect on a machine under warranty, a wrong delivery and a wear-part reorder look similar in an email, but they follow different processes, different approvers and different ERP documents. The agent’s first job is to classify the case and collect the missing facts, such as serial number, order number and photos, before any lookup starts.

Platforms already model this surface. Spryker’s Self-Service Portal, announced in August 2025, includes asset-aware reordering, service and warranty claims and RMA workflows integrated with ERP and logistics, with role-based permissions ([Spryker](https://www.globenewswire.com/news-release/2025/08/04/3126598/0/en/spryker-unveils-self-service-portal-to-supercharge-b2b-productivity.html)). An agent sits on top of such a portal and its systems; it does not replace them.

## How does the agent get from a serial number to an RMA?

The agent never “knows” a part; it resolves one. The serial number from the label or the ticket becomes an equipment record, the equipment’s bill of materials gives the candidate parts, the catalog adds price and availability, a person approves, and the ERP creates the return.

![Serial number to RMA flow Six steps from left to right: a service ticket arrives by mail or portal; the serial number is resolved to an equipment record; the equipment bill of materials is exploded; candidate parts are matched in the catalog with price and stock; a human approves the part and the return; the RMA is created in the ERP as a return order with disposition, followed by shipment and credit-note status.](https://balazscsorba.com/images/blog/aftersales-agent-rma-spare-parts/diagram-8.webp?v=07d92fcf1d)

The happy path: every identifier in this flow comes from the ERP or the catalog, and the approval step sits before anything is committed.

-   **Asset identification:** a machine-readable label helps. IEC 61406-2, published in May 2024, specifies an identification link, a URL-based unique identifier on the physical object that points to its digital information, including digital product passports ([IEC](https://webstore.iec.ch/en/publication/77973)).
-   **Bill of materials:** in SAP S/4HANA Service, equipment and functional-location BOMs and maintenance assemblies group the spare parts relevant for maintenance, and BOM explosion is available as an OData operation ([SAP Learning](https://learning.sap.com/courses/configuring-organizational-and-master-data-in-sap-s-4hana-service/configuring-and-creating-bills-of-material)).
-   **Return:** in Dynamics 365 Supply Chain Management an RMA is a return order with the RMA number as alternate key, a disposition code that can be credit-only, an optional replacement order and a credit note at the end ([Microsoft Learn](https://learn.microsoft.com/en-us/dynamics365/supply-chain/sales-marketing/sales-returns)). Between trading partners the same request travels as X12 180, the Return Merchandise Authorization and Notification transaction set ([X12](https://x12.org/products/transaction-sets)).

Two details break naive implementations. Superseded parts: the BOM may list a part number that has since been replaced, so the lookup must follow the successor chain in the ERP and show both numbers, the one on the drawing and the one that ships. Quantity per assembly: the BOM says how many of a part sit in the machine, not how many the customer needs, so the agent asks instead of assuming. Both facts already live in the ERP; the agent’s job is to read them, not to guess them.

## Why exact match or nothing?

Because language models invent identifiers that look right. An identifier, whether a part number, serial, RMA number or credit-note number, may appear in the agent’s answer only if a tool returned it in the same turn, echoed byte for byte. Everything else is rejected before the user sees it.

The evidence comes from software packages, the closest measured analogue. Spracklen et al. generated 2.23 million package recommendations with 16 models: 19.7% named packages that do not exist, and 43% of the invented names reappeared in all ten repeated runs, so the errors are consistent, not random noise ([USENIX Security 2025](https://arxiv.org/abs/2406.10279)). The attack built on that is described in [slopsquatting and package hallucinations](https://balazscsorba.com/blog/slopsquatting-ai-package-hallucinations). In after-sales, the same failure is a plausible part number that ships the wrong component.

```
// Identifier guard (sketch): every ID in the answer must come from a tool result of this turn
const ID_PATTERN = /\b[A-Z0-9]{2,}(?:[-./][A-Z0-9]+)+\b/g   // tune to your part, serial and RMA formats

function unknownIdentifiers(answer: string, results: ToolResult[]): string[] {
  const returned = new Set(results.flatMap((r) => r.identifiers))   // part, serial, RMA, credit-note numbers
  return [...answer.matchAll(ID_PATTERN)].map((m) => m[0]).filter((id) => !returned.has(id))
}

const unknown = unknownIdentifiers(draft, toolResults)
if (unknown.length > 0)
  return escalate({ reason: 'identifier not returned by ERP or PIM', unknown })   // never auto-correct it
```

The guard is cheap and deterministic. Combine it with structured tool schemas, so identifiers arrive in typed fields, and with a human approval before any part commitment, order or RMA confirmation. I run my own agents through a small set of named, typed tools, including a Jira MCP server with 20 of them, and the principle carries over: the agent acts through tools, and nothing outside the tools counts.

## Which system owns which after-sales data?

Four systems own the data, and the agent reads each field from its owner. The ERP owns serials, equipment, BOMs, RMAs and credit notes; PIM and shop own the parts catalog, prices and availability; the document store owns manuals and diagrams; the CRM owns tickets and history.

![After-sales data ownership map The agent in the center acts as the signed-in user and reads from four systems. The ERP service module owns serial numbers, equipment, bills of material, RMAs and credit notes. PIM and shop own the parts catalog, prices and availability. The document store owns manuals, exploded diagrams and service bulletins. The CRM owns tickets and history. Writes such as an RMA draft go back to the ERP only through human approval.](https://balazscsorba.com/images/blog/aftersales-agent-rma-spare-parts/diagram-18.webp?v=791e999cb8)

Who owns which after-sales data: the agent reads from the system that is authoritative for each field and never treats a cache or its own memory as the source.

Parts master data quality decides how often the agent can answer at all. Missing BOM entries, superseded part numbers without a successor link, and catalog items without the ERP material number are the usual gaps; [RAG over product catalog and PIM data](https://balazscsorba.com/blog/rag-product-catalog-pim-data) covers how to make those attributes usable.

## How should the agent use manuals and diagrams?

Use retrieval for procedures and explanations, cite the document with page or figure, and keep the link from a diagram position to a part number in the catalog rather than in embeddings. The corpus is service manuals, exploded diagrams, service bulletins, schematics and warranty terms.

Chunk per procedure or step, not per page, so an answer cites one coherent instruction. Industries with large documentation sets already structure content this way: S1000D, jointly produced by ASD, AIA and ATA e-Business with Issue 6 as the latest release, organizes technical publications as reusable data modules in a common source database ([S-Series](https://www.s-series.org/s1000d)). The parsing side, from scanned PDFs to tables, is covered in [PDF parsing for RAG](https://balazscsorba.com/blog/pdf-document-parsing-for-rag). Documentation volume will grow for machine builders: under the Machinery Regulation 2023/1230, applicable from 20 January 2027, instructions may be supplied in digital form under specific conditions ([European Commission](https://single-market-economy.ec.europa.eu/sectors/mechanical-engineering/machinery_en)).

Keep answers from manuals short and procedural, with the source document, revision and page in every answer. Service bulletins supersede manual sections, so retrieval should rank the newest applicable bulletin above the manual and say so. When a manual and a bulletin disagree, the agent shows both and escalates, because choosing between two official documents is a service engineer’s decision, not a model’s.

## Which actions may the agent take on its own?

Informational answers, yes; commitments, no. The agent runs as the signed-in user with that user’s scope, own orders, business unit or company, never as a service account with rights over every customer, the pattern described in [agent identity and least privilege](https://balazscsorba.com/blog/ai-agent-identity-least-privilege). Read and write tools are separate, and every tool call is logged.

Action

Required source

Autonomy

Audit

Informational answer

manual with citation

answer

log sources

Price or availability

catalog, ERP

tool call

log tool result

Part recommendation

equipment BOM

tool call

identifier guard

Part order

BOM, catalog, contract price

tool call plus approval

approver and order number

RMA confirmation

ERP return order

tool call plus approval

approver and RMA number

Credit note

ERP

status only

log status read

Repair time or price promise

service planning

never

escalate

**Escalate on these triggers**

Hand the case to a person when it touches safety, warranty law, a credit limit or goodwill, or when the customer’s wording turns legal or angry. My `jev-decide` skill follows the same rule for its own decisions: low confidence goes to a human, and a probability is not permission.

## What is an after-sales agent worth?

It is worth what faster, correct part identification does to an already profitable business. No published ROI figure for after-sales agents exists, so the case rests on the economics of the aftermarket and on the KPIs the agent moves.

-   **Margins:** across 30 industries, McKinsey found an average EBIT margin of 25% for aftermarket services versus 10% for new equipment, with parts typically above 30% gross margin ([McKinsey, 2017](https://www.mckinsey.com/industries/industrials/our-insights/industrial-aftermarket-services-growing-the-core)); in 2024 it described aftermarket margins up to four times those of new units ([McKinsey, 2024](https://www.mckinsey.com/industries/industrials/our-insights/why-aftermarket-and-service-are-vital-to-oems-and-how-to-excel)).
-   **Spare parts:** BCG’s benchmark of about 100 industrial machinery companies puts spare-part and consumable gross margins at about 50% on average, with top performers selling 16 percentage points more spare parts ([BCG, 2025](https://www.bcg.com/publications/2025/aftermarket-services-drive-growth-for-industrial-manufacturers)).
-   **Failed visits:** Aquant’s 2026 benchmark of 161 service organizations puts first-time fix at 77% at the median, 88% for top performers and 60% for the bottom; failed visits account for 25% of total service cost at the median, and one in five cases could be resolved remotely ([Aquant](https://www.globenewswire.com/news-release/2026/02/19/3241231/0/en/aquant-s-2026-field-service-benchmark-companies-can-unlock-up-to-26-in-service-cost-savings-by-scaling-knowledge-across-the-workforce.html)).

Each KPI maps to one mechanism. First-time fix improves when the technician arrives with the right part, which depends on identification before dispatch. RMA cycle time drops when drafting, status lookups and reminders stop waiting in a shared inbox. Handling time per ticket falls when the agent assembles serial, asset history and candidate parts before a person opens the case. The self-served share grows when customers can identify parts in the portal with the same tools. Instrument each one separately; a single blended savings number hides which mechanism works.

One regulatory note, because it is often misread: the EU Right to Repair Directive 2024/1799 applies from 31 July 2026 and obliges manufacturers to repair, offer spare parts at reasonable prices and publish indicative repair prices, but for consumer goods covered by its Annex II ([EUR-Lex](https://eur-lex.europa.eu/eli/dir/2024/1799/oj/eng)), not for industrial machinery in general. For a head of aftermarket or service director, the honest pitch is identification accuracy and turnaround, instrumented as first-time-fix rate, spare-part attach rate, RMA cycle time, handling time per ticket and the share of self-served parts orders.

## When should you not build an after-sales agent?

Do not build one without reliable serial-to-asset data, without read APIs into the ERP, or without clean parts master data, because the agent would only answer “I cannot find it” faster. Low ticket volume, safety-critical parts without a documented approval path, and a warranty regime that nobody has written down as rules are further reasons to wait.

## A build checklist for an after-sales agent

1.  Define the identifier formats and enforce the identifier guard on every answer.
2.  Write typed tool schemas for asset lookup, BOM explosion, part search, RMA draft and status.
3.  Develop against a sandbox ERP client, never production.
4.  Agree an approval matrix: who approves part orders, RMAs and goodwill.
5.  Subscribe to RMA and credit-note status changes instead of polling.
6.  Build an eval set from real, anonymized tickets with known correct parts.
7.  Make the fallback to a human one click, with the full tool trace attached.
8.  Define the KPIs with formulas before launch: first-time fix, RMA cycle time, handling time, self-served share.

A fixed-scope pilot on one product family, read-only part identification over the existing BOM and catalog plus RMA drafting with approval, is the honest first step. I have spent more than ten years building the catalog and shop side such an agent reads from; if you want to scope one, see my [B2B e-commerce work](https://balazscsorba.com/expertise/b2b-ecommerce-developer).

## Sources

1.  [McKinsey: Industrial aftermarket services, growing the core (2017)](https://www.mckinsey.com/industries/industrials/our-insights/industrial-aftermarket-services-growing-the-core)
2.  [McKinsey: Why aftermarket and service are vital to OEMs (2024)](https://www.mckinsey.com/industries/industrials/our-insights/why-aftermarket-and-service-are-vital-to-oems-and-how-to-excel)
3.  [BCG: Aftermarket services drive growth for industrial manufacturers (2025)](https://www.bcg.com/publications/2025/aftermarket-services-drive-growth-for-industrial-manufacturers)
4.  [Aquant: 2026 Field Service Benchmark (press release, 19 Feb 2026)](https://www.globenewswire.com/news-release/2026/02/19/3241231/0/en/aquant-s-2026-field-service-benchmark-companies-can-unlock-up-to-26-in-service-cost-savings-by-scaling-knowledge-across-the-workforce.html)
5.  [Microsoft Learn: Sales returns in Dynamics 365 Supply Chain Management](https://learn.microsoft.com/en-us/dynamics365/supply-chain/sales-marketing/sales-returns)
6.  [SAP Learning: Configuring and creating bills of material in SAP S/4HANA Service](https://learning.sap.com/courses/configuring-organizational-and-master-data-in-sap-s-4hana-service/configuring-and-creating-bills-of-material)
7.  [Spracklen et al.: package hallucinations by code-generating LLMs (USENIX Security 2025)](https://arxiv.org/abs/2406.10279)
8.  [S-Series: S1000D specification](https://www.s-series.org/s1000d)
9.  [IEC 61406-2:2024 Identification link, Part 2](https://webstore.iec.ch/en/publication/77973)
10.  [Directive (EU) 2024/1799 on the repair of goods, EUR-Lex](https://eur-lex.europa.eu/eli/dir/2024/1799/oj/eng)
11.  [European Commission: Machinery Regulation (EU) 2023/1230](https://single-market-economy.ec.europa.eu/sectors/mechanical-engineering/machinery_en)
12.  [X12: transaction sets (180 Return Merchandise Authorization and Notification)](https://x12.org/products/transaction-sets)

## Frequently asked questions

What can an AI agent do in after-sales service?

It can take in service tickets, identify the machine from its serial number, look up spare parts in the ERP bill of materials and the catalog, draft return requests, report RMA, shipment and credit-note status, and answer from manuals with citations. Commitments such as orders, RMA confirmations and credit notes need human approval.

How does an agent find the right spare part from a serial number?

It resolves the serial number to an equipment record in the ERP, explodes the equipment bill of materials, and matches the candidate parts against the catalog for price and availability. The agent never states a part number it did not receive from one of these tool calls.

Why must an after-sales agent not generate part numbers?

Language models invent plausible identifiers. In a USENIX Security 2025 study, 19.7% of package names recommended by code models did not exist, and many invented names repeated across runs. A wrong part number in after-sales means a wrong shipment, a failed visit and a return, so identifiers must come from tools only.

Does the EU Right to Repair Directive apply to B2B machinery?

Directive (EU) 2024/1799 applies from 31 July 2026, but it concerns consumer goods listed in its Annex II, not industrial machinery in general. For machine builders the more relevant change is the Machinery Regulation 2023/1230, which from 20 January 2027 allows instructions in digital form under specific conditions.

How do you measure the value of an after-sales agent?

Set baselines and track first-time-fix rate, RMA cycle time, handling time per ticket, spare-part attach rate and the share of parts transactions customers complete themselves. No published ROI figure for after-sales agents exists, so your own before-and-after numbers are the evidence.

Written by Balázs Csorba

Senior fullstack & AI engineer in Styria, Austria – 10+ years of Vue, Nuxt, Node.js and PHP, now building tooling for AI agents.

[B2B e-commerce & PIM →](https://balazscsorba.com/expertise/b2b-ecommerce-developer)[About me →](https://balazscsorba.com/about)

## More articles

-   [Designing tools for AI agents: names, descriptions, schemas and error messages](https://balazscsorba.com/blog/agent-tool-design-descriptions-errors)
-   [Migrating a legacy codebase with coding agents: a strangler fig playbook](https://balazscsorba.com/blog/coding-agents-legacy-codebase-migration)
-   [Background coding agents that open PRs: a practical async workflow](https://balazscsorba.com/blog/background-agents-async-pr-workflow)
-   [Context rot in long-running agents: clearing, compaction, memory and sub-agents](https://balazscsorba.com/blog/context-rot-compaction-long-running-agents)

## Sounds like what you need?

Tell me about your project or role – I’d love to hear from you.

[Get in touch](mailto:contact@balazscsorba.com) [Connect on LinkedIn](https://www.linkedin.com/in/balazs-csorba)
