automatic.co

Running Accounts Payable and Receivable With Agents Inside Your ERP

How AI agents actually run accounts payable and receivable inside SAP, Oracle, NetSuite, and Dynamics, from invoice capture and three-way match to cash application.

Eric Lamanna6 min read
A translucent invoice hovering above a server cabinet with glowing data lines flowing into it, representing autonomous AP processing inside an ERP.

Can AI agents actually run accounts payable and receivable inside SAP, Oracle, NetSuite, or Dynamics without breaking the sub-ledger? Yes, for the predictable majority — invoice capture, three-way match, cash application, remittance parsing, routine dunning — provided every write is idempotent, posting keys stay intact, and a person sits on every tier-two exception.

The interesting work is no longer document capture. It is the mapping between an agent's tool calls and the ERP's own posting, locking, and period-close rules, where a careless automation turns a $40,000 invoice into a duplicate payment and a tidy demo into an audit finding.

Where Agents Fit in the AP Flow

AP is six sub-workflows stacked on each other: capture, validate, three-way match, exception coding, approval, post. Each one has a different autonomy ceiling.

Capture and classification run fully autonomous once you have reliable vendor master data and a tolerable duplicate-detection hash. A three-way match agent compares invoice lines to the PO and the goods receipt inside a tolerance group — the pricing, quantity, and date tolerances defined per vendor class. When everything lines up, the agent posts through the standard BAPI or REST call that the ERP exposes and writes back the document number. When it does not, the agent routes the exception with structured context, not a screenshot.

Coding exceptions are the sub-workflow where vendors overpromise. Missing cost centers, blocked GL accounts, split-across-projects invoices — these need a retrieval layer over prior postings plus a rules engine. An agent that learns from the last twelve months of your postings resolves most of them, but the long tail is why AP is still the right first workflow rather than a solved one.

AP performance: industry average vs best-in-class
AP performance: industry average vs best-in-classTouchless invoice rate (%): 31.4; Cost per invoice ($): 12.5; Invoice cycle time (days): 10.9; PO coverage (%): 47.3Industry averageBest-in-classTouchless invoice rate(%)31.455.2Cost per invoice ($)12.52.7Invoice cycle time(days)10.93.1PO coverage (%)47.384
The touchless rate gap is where posting-key-aware agents earn their place. Source: Kefron (Ardent Partners data), 2026

The ERP Mechanics Agents Must Respect

An agent that cannot read a posting key, a tolerance group, or a closed-period status will quietly corrupt the sub-ledger before anyone notices. Each ERP exposes these rules differently.

  • SAP S/4HANA. Posting keys determine debit/credit side per line; tolerance groups gate auto-posting per user and per vendor; MM and FI period locks run on separate clocks. Agents post via MIRO / FB60 BAPIs, never by UI scraping, and check T001B before every write.
  • Oracle Fusion / EBS. Invoice holds, distribution sets, and approval groups live in Payables; period status is per ledger and per module. Agents use the REST Payables Invoice API and respect the hold types before release.
  • NetSuite. Vendor Bill records carry matching rules against the item receipt; closed periods are enforced per subsidiary. Agents call SuiteTalk or RESTlets and must verify the accounting period is open for the transaction date, not today's date.
  • Dynamics 365 F&O. Posting profiles, approval journals, and vendor invoice workflows all route through the Data Management Framework. Agents should use the invoice journal entity, not direct SQL.

The common requirement across all four: the agent needs an idempotency key on every write (vendor + invoice number + line hash is the usual shape) so that a retry after a network blip does not re-post the same document. Without it, you get the duplicate-payment class of incident that ERP automation projects fail on.

What AP staff think about automation in 2025
45%
Feared layoffs in 2025
27%
Feared layoffs in 2024
69%
Expect positive automation impact
Survey of 588 AP professionals conducted in May 2025. Source: AvidXchange / IOFM, 2025

Where Agents Fit in the AR Flow

AR inverts the problem. The agent is reading unstructured remittance — PDFs, portals, emails, ACH addenda — and matching it against open invoices with partial payments, deductions, and short-pays. Cash application is the highest-value action because most middle-market AR teams still do it by hand, and 83% of firms have yet to fully automate the function, with mid-market firms losing an average of $19 million in annual revenue to delayed payments.

A cash application agent parses the remittance, matches at the invoice-line level, writes a receipt into AR, and codes the deduction with the right reason code (shortage, pricing dispute, promotion). When confidence is below threshold, it opens a dispute ticket with the matched candidates attached. Dunning agents segment by aging, promise-to-pay history, and credit risk, then send escalations that are different from the generic weekly email blast.

What AR teams using AI report
What AR teams using AI reportAI in AR -> Reduced DSO: 99%; AI in AR -> Cut DSO by 6+ days: 75%; AI in AR -> Scaled ops 11%+ without adding staff: 82%AI in AR256%Reduced DSO99%Cut DSO by 6+ d…75%Scaled ops 11%+…82%
Survey of 500 finance decision-makers at North American firms over $250M in revenue. Source: Wakefield Research for Billtrust, 2025

Three constraints keep the AR agent from going rogue. Credit limit changes stay human. Write-offs above a threshold stay human. Any change to a customer bank account is treated the same as an AP bank change, because the inbound-fraud attack surface is the same as the outbound one.

A ledger book sealed with multiple locks, representing ERP posting keys and period-close controls that agents must respect.

Approval Gates and Idempotent Writes

The architecture that separates a production AP/AR agent from a demo is the approval gate topology. Every action maps to a tier: autonomous below a dollar threshold, single-approver in the middle band, dual-approver above, and bank-detail or vendor-master changes always routed to a human regardless of amount. Which agent actions actually need approval is a separate decision from how the approval itself is captured, which should land in the ERP's own workflow rather than a shadow tool.

The fraud surface is the reason the gates are non-negotiable. The FBI's 2024 IC3 report logged business email compromise as a multi-billion-dollar category that targets exactly the vendor-change and payment-release flows AP agents touch.

FBI IC3 2024: top cybercrime loss categories ($B)
FBI IC3 2024: top cybercrime loss categories ($B)Investment fraud: $6.6B; Business email compromise: $2.8B; Phishing: $0.1BInvestment fraud$6.6B · 70%Business email compromi…$2.8B · 29%Phishing $0.1B
BEC targets the vendor-change and payment-release flows AP agents touch. Source: FBI IC3 / Abnormal, 2024

Idempotency sits underneath the gates. Every tool call carries a client-generated key the agent framework persists before the ERP write. If the write succeeds and the ack is lost, the retry returns the same document number instead of creating a second one. This is not optional, it is the single mechanism that lets you run the agent at an unattended cadence without a reconciliation team behind it.

What Changes Over the Next Year

The decision facing a platform team in 2026 is no longer whether to build an AP capture agent. The ERP vendors are shipping their own. Workday's Illuminate Document Driven Accounting Agent is targeted for general availability in early 2026, SAP Joule has AP agents in preview, and Oracle's Fusion AR agents are shipping into cash application. Deloitte's view of the agentic-ERP shift is that the sub-ledger itself becomes an agent surface, not an endpoint.

That reframes the question. The next twelve months are about deciding where the ERP's native agent ends and where a custom agent takes over — exception coding against your own GL structure, deduction reason codes against your own trade terms, dunning that reflects your actual credit policy. Pick those boundaries now, write them into the agent's tool registry, and the ERP-native agents become a layer you compose against rather than a decision you have to redo when the next release lands.

written by
Eric Lamanna
Director of Business Development

Eric Lamanna is a Digital Sales Manager with a strong passion for software and website development, AI, automation, and cybersecurity. With a background in multimedia design and years of hands-on experience in tech-driven sales, Eric thrives at the intersection of innovation and strategy—helping businesses grow through smart, scalable solutions. He specializes in streamlining workflows, improving digital security, and guiding clients through the fast-changing landscape of technology. Known for building strong, lasting relationships, Eric is committed to delivering results that make a meaningful difference. He holds a degree in multimedia design from Olympic College and lives in Denver, Colorado, with his wife and children.

Put an agent to work, the right way.

Start on Automatic and put the workflow you want to automate in front of engineers who have shipped agents in regulated environments.

Explore services
the briefing

Agentic AI, in your inbox.

Occasional, high-signal notes on building and operating AI agents — automation patterns, architecture, and governance. No spam.