Agentic AI

How to Add an AI Agent Without Replacing the System You Run On

Add AI agents to existing systems without waiting for a rewrite or migration: how they connect, three controls against forged email, six checks to run yourself.

There are two ways companies are thinking about AI and their ERP right now. If you are weighing whether to add AI agents to existing systems, your own team is probably split the same way.

The first: rewrite the ERP as your own system. AI has made building software much faster, so why keep paying license fees every year for software you could now build yourself? For many businesses, that is a smart move.

The second: keep the ERP and add AI agents on top of it. Most people treat this as a choice between the two. We do not.

The rewrite decision and the AI decision are separate decisions. Even if you choose to rewrite, the rewrite takes time. Your business does not need to wait for that.

Wherever possible, add AI agents to existing systems now, and build the agents so they can move to the new system when it arrives.

Two decisions, not one

The rewrite decision asks whether the system still fits, what the license costs against a build, and who owns the code. The AI decision asks which inputs an agent can read, which rules the system already enforces, and what repeats often enough to repay the build. Each agent is a small commitment: switch it off and its work returns to manual entry, because the ERP never changed.

Why the AI decision shouldn't wait for the rewrite

Because the rewrite takes time, and every month it runs, the orders, invoices and follow-ups an agent could take over stay manual, with keying errors surfacing as wrong shipments and credit memos. AI that waits inherits the rewrite's delays, and waiting has its own cost.

Your ERP holds years of business rules: how you price, who approves what, how you close the books. Every one of those rules has to be found and rebuilt.

AI writes the new code faster. Finding the old rules sets the pace.

Even when the vendor supplies the new system, nearly 60% of SAP migration projects at large companies run late and over budget, in an ISG survey of more than 200 senior decision-makers, reported by The Register. More than half agreed they had over-customized the system they were leaving.

Gartner wrote on 28 October 2026: "The biggest mistake leaders can make is planning for a rapid replacement of core enterprise applications." The warning is about pace, not the choice to replace.

The pattern: the agent takes the intake, the system keeps the rules, a person approves

A customer order arrives by email with a PDF attached. The agent, for example Claude Sonnet orchestrated with LangGraph, reads it, matches each line to an item number, and fills a typed order record: a form with a fixed box for each field. If a field is missing, a template reply asks for it.

The ERP then prices the order and runs the credit check with its own rules. The draft waits in the ERP as an order on hold until a named person approves it under their own login, and the ERP logs who entered and who approved it: the maker-checker split auditors already know. Built this way, AI agents on top of the ERP never hold the pricing logic or post directly, so the rules stay where they are already tested and audited.

Intake: the agentReading the email, filling the order record
Rules: the ERPPricing, the credit check, validation
Approval: a personA review screen: each field beside its source text

How the agent reaches the system without changing the core

The agent calls a few tools you own, such as match_item and create_draft_order. Behind each tool, an adapter reaches the system through a supported door: its API, the vendor's Model Context Protocol (MCP) server, or a thin interface you build. No door needs ERP code changes, so the agent adds no customization for a later migration to carry.

If agents sound like the RPA bots that broke on every screen change, this agent never touches a screen: it calls your tools.

  • Dynamics 365 finance and operations: an ERP MCP server whose tools reach nearly anything a user can do, within the agent's security role. Your tool calls only what the task needs.
  • SAP: SAP has announced MCP and A2A (agent-to-agent) support for custom agents in Joule Studio. On ECC today, BAPIs and inbound order IDocs run standard order processing, pricing and credit check included. Your tools stay outside the core, as SAP's clean-core guidance asks.

Agentic AI for legacy systems with no API or MCP server uses the third door: a small service that exposes the few operations the agent needs and reads from reporting views or a read replica. The service writes only through an entry path the system already validates (its import, a staging table, an EDI or file interface, a stored procedure), so the system's own rules run on every draft.

Read what the task needs, write narrowly. Reads return only the fields the task uses, and writes go to one or two places. The agent runs in your cloud under its own ERP account, whose security role allows only those reads and writes.

The ERP vendor's own agents start faster when they fit the workflow, but stay behind if you leave that vendor. If a rewrite is possible, own the tools.

Build the agent so it moves to the next system

Replacing the adapter behind each tool is integration work every migration does, with or without an agent. The agent, its review screen and its evals (past orders with known outcomes) carry over. Then nothing gets built twice.

  1. Tools you own: the tool layer is the kind of seam Martin Fowler's strangler fig pattern relies on, so a rewrite can move functions behind it one at a time. A new system can still change identifiers, price structures or approval rules, and those changes can reach the schema.
  2. The rules, written down as you build: the agent holds none of the rules, but its schema and evals have to know them, such as which fields an order needs, which values are valid and which orders need a second approval. A rewrite needs those same rules. Where rules sit in .NET, Java or Salesforce code, our Business Rule Extractor reads the source and returns them as a specification our engineers validate.
  3. Evals that travel: the same past orders, rerun in test before every model upgrade, every ERP update and any cutover, show which tool or field moved.

Treat the intake as untrusted input

An agent that reads email from outside your company reads instructions from strangers, so the control sits between what the model reads and what it can call, not in the prompt.

Simon Willison calls the risk the lethal trifecta: private data, untrusted content, and a way to send data out. An intake agent has all three by design, so a forged email could try to redirect a shipment or leak customer data.

More training is not the control. In a small stress test reported by Help Net Security, an agent retrained on 4,282 prompt-injection attacks was still hijacked on up to 11 of 40 tasks. An agent retrained on 7,132 did worse, at up to 19.

Narrow reads limit the private data in reach, and three controls contain the other two legs:

  1. The model fills a typed schema, and code makes the API call. A Pydantic schema enforced through structured outputs means an injected instruction can only change a field value. Code then checks each value against the ERP's records, such as the sender's customer account and ship-to addresses on file, and flags any that fail.
  2. Replies go to the original sender only: the thread's original From address, never a Reply-To or an address in the text. When a template is enough, code builds the reply. When the workflow needs the agent to write it, the agent can draw only on that sender's own order, and a person approves the reply before it is sent.
  3. The approver sees each field beside the source text it came from. Injected white text and hidden PDF layers vanish when rendered and appear in the source text. The screen flags fields that failed a check or differ from past orders, and each correction becomes an eval case.

When the rewrite is the right call, and when agents should wait for it

The rewrite is the right call when you want the license gone or want to own the code, and the agents still start now unless the system blocks them.

The rewrite school's strongest case: an agent removes effort, not license fees or vendor lock-in. In Retool's 2026 Build vs Buy report, 35% of 817 builders have replaced a SaaS tool with their own build.

When agents should wait for the rewrite:

  • No way in: no API, no MCP server, no validated entry path, and support ending, so an agent would have to scrape screens.
  • Wrong rules the system makes hard to change: an agent in front automates the wrong answer faster.
  • Many write points: one person can approve one or two drafts on one screen, not twenty.

Everywhere else, start with agents now.

Six checks before you add AI agents to existing systems

You can run these checks without us.

CheckReady when
1. Can your tools reach the system through an API, MCP server or validated entry path?Yes, and every write runs through the system's own validation
2. Where does the agent write?One or two places, each a draft one person approves
3. Where do the rules it needs live?In the system, and written down for testing the agent
4. Can an outside email make it act?No: outside text only fills checked fields, and the agent calls only your tools
5. What changes if the system is replaced?The adapter; rerunning past orders shows what else moves
6. Does the volume repay the build?Hours saved each month, after review time, outweigh build and run cost, vendor usage charges included, and the process has held for months

Where AnAr fits

Agents on today's system

Agentic AI development

The rules written down

Business Rule Extractor

A rewrite, when it comes

Legacy application modernization

Agents kept working through updates

Application maintenance

The rules the agents need get written down along the way, which makes the rewrite easier too. Rewrite or not, decide that on its own merits. Start with AI now.

Tell us, in two lines, the workflow you want an agent to run and the system it runs on. An engineer writes back within one business day with how the agent would connect, where a person would approve its work, and why we would start there.

Tell us the workflow

Frequently asked questions

Can we add AI agents to existing systems without replacing the ERP?

Yes, as long as the system has a way in: an API, an MCP server, or an entry path a thin interface can use. The ERP keeps its rules, the agent takes the intake, and a person approves each draft. You can add AI without replacing the ERP and still build the agents to move if the ERP is replaced later.

How do AI agents connect to SAP, Dynamics 365 or NetSuite?

Through tools you own, with an adapter behind each one, so the agent does not depend on one vendor's interface. Dynamics 365 finance and operations apps have an ERP MCP server, SAP has announced MCP and A2A support for custom agents in Joule Studio, and on SAP ECC, BAPIs and IDocs are the API door today. NetSuite, Business Central and other ERPs work the same way: the adapter goes through whichever supported door the system offers.

What happens to our agents if we migrate the ERP later?

Agents that call tools you own carry over to the new system. The migration changes the adapter behind each tool, and evals built from real past cases show whether anything else, such as identifiers or price structures, has to change.

Is it safe to let an agent read customer emails?

Yes, when the controls sit in the architecture, not the prompt, because no model refuses every injected instruction. The agent's tools return only the fields the task needs, the agent fills a typed record that code validates, a person approves each field beside its source text, and replies go to the original sender only. When a template is enough, code builds the reply; when the workflow needs the agent to write it, the agent can draw only on that sender's own order, and a person approves the reply before it is sent.

Who is accountable when an agent gets an order wrong?

The person who approves the draft, just as the person who keys an order is accountable today. The agent enters each draft under its own ERP account, a named person approves it under their own login, and the ERP logs both, so the audit trail shows who prepared each order and who released it. The review screen flags fields that failed a check or differ from past orders, and each correction becomes an eval case that later model and ERP changes are tested against.

What does an AI agent cost to run on top of an ERP?

Running cost has four lines: model usage per document, hosting, the ERP vendor's per-call charge where it bills one, and the approver's review time. The agent repays its build when the cost of the keying hours it replaces each month outweighs those four lines, with the build spread over the months the process stays stable. Once the agent runs, three measures show whether it is repaying: hours of keying replaced, review time, and drafts the approver corrected.

When should we replace the ERP before adding AI agents?

Only when the system has no way in and support is ending, when its rules are wrong and hard to change, or when the agent would write into the core in many places. A license you want gone, or code you want to own, is a reason to rewrite, not a reason for the agents to wait.

Our Latest Blogs
Clear Filters
How to Add an AI Agent Without Replacing the System You Run On
Rewrite the ERP or add AI agents? AnAr Solutions blog on adding AI agents to existing systems.
If AI Writes the Code, Why Build a Team in India?
If AI writes the code, why build a team in India? AnAr Solutions blog on AI-assisted development teams.
The AI Software Factory Is a Process, Not a Product
AnAr Solutions graphic: the AI software factory isn't for sale, so who builds yours?
How to Test a Voice AI Agent
Testing a voice AI agent: the second model that decides what a conversation was worth
Cognitive Debt in AI-Assisted Development
Cognitive debt in AI-assisted development: the understanding that lives in a team rather than in the code
The Technical Debt AI Writes at Machine Speed
Technical debt from AI-generated code: Fowler's debt quadrant and the inadvertent debt AI writes at machine speed
The Five Lenses of AI Code Review
The five lenses of AI code review: functional, regression, security, budget, and maintainability, each a different reviewer read of the same diff
Tests Passed. CI Is Green. Production Just Broke.
AI assisted code verification and testing
Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.