Connecting an AI Agent to SAP S/4HANA: Options, Permissions, Pitfalls
Most useful business agents eventually need the ERP: order status, open invoices, stock levels, supplier data. With SAP S/4HANA the plumbing is well documented, but the contractual side changed in 2026 and now shapes the architecture as much as the technology does. This guide covers the connection routes for cloud and on-premise systems, how permissions work, where Joule fits, and what the SAP API Policy means for agents. Current as of October 2026.
What does connecting an AI agent to SAP S/4HANA involve?
It means giving an agent controlled access to SAP data and transactions without a person clicking through the user interface. The agent calls interfaces SAP has published, under an identity SAP recognises, over a network path your security team approves. The design decides what the agent can see, what it can change and who is accountable for each action.
Typical uses in mid-sized manufacturing and distribution companies:
- Look-ups: delivery status for a customer's open orders, available stock for a material, a business partner's payment terms.
- Drafting: turning a customer email into a draft sales order, pre-filling a purchase requisition, flagging differences between a delivery note and the purchase order.
- Acting: releasing a block, changing a status, posting a document. Risk rises sharply here, so human approval belongs in the loop.
What separates an agent from a conventional integration is that it decides for itself which interface to call and in what order. That autonomy is exactly what SAP's 2026 policy addresses, so it is worth understanding before you design anything. For a broader view of which tasks suit agents at all, see AI agents for business.
How does the connection work technically?
Every setup combines three parts: a published SAP interface, usually OData; an identity the agent uses inside SAP; and a network route from the agent to the system. Which variants are available depends on whether you run S/4HANA Cloud Public Edition, Private Edition, or your own on-premise installation.
Interface. S/4HANA exposes business objects mainly as OData services, such as the Business Partner API. The SAP API Policy calls these "Published APIs": interfaces listed on the SAP Business Accelerator Hub or named in product documentation. Customer and third-party applications must not call anything labelled internal or private.
Identity. In the Public Edition, inbound calls run as a technical communication user whose rights come from a communication arrangement. Alternatively, the call carries the identity of the person the agent is working for, known as principal propagation.
Network route. Cloud systems are reachable over HTTPS. On-premise systems sit behind the corporate firewall, and the SAP Cloud Connector links them to SAP Business Technology Platform (BTP).
Agent layer. On top sits either a tool call written directly into the agent, or an MCP server that exposes SAP functions as standard tools any MCP client can use. The protocol itself is covered in MCP Servers: Connecting AI Agents to Systems the Standard Way. This article focuses on what is specific to S/4HANA: communication arrangements, the Cloud Connector, SAP authorisations and SAP's policy rules.
Which connection options are there?
There are four common routes: direct OData access through a communication arrangement, on-premise access through the Cloud Connector, an MCP server in front of the SAP APIs, and Joule, SAP's own assistant. Real projects often combine them, for example the MCP Gateway in front of an on-premise system reached through the Cloud Connector.
Direct OData access in S/4HANA Cloud Public Edition
The Public Edition handles every inbound integration through three objects. SAP's Business Partner integration tutorial walks through them:
- Create a communication user in the "Maintain Communication Users" app.
- Create a communication system that represents the external partner, set to "Inbound Only", and attach that user.
- Create a communication arrangement from a communication scenario, in the tutorial
SAP_COM_0008, which contains the Business Partner API. The arrangement shows the service URL.
The same tutorial notes that the remote call does not need a business user in S/4HANA at all, because the communication user's rights come from the arrangement. That is convenient, but it also means the agent can reach everything the scenario exposes, regardless of which employee is using it.
On-premise and Private Edition via the Cloud Connector
If S/4HANA runs in your own data centre or in the Private Edition, the SAP Cloud Connector bridges the internal network and BTP. SAP describes it as a reverse invoke proxy that requires no change to on-premise firewall settings, gives fine-grained control over which internal systems and resources cloud applications may reach, and can pass a cloud user's identity securely to the on-premise system.
In practice the agent never talks to the SAP application server directly. It talks to a service on BTP, which reaches inside through the connector. On private cloud and on-premise deployments, the API Policy also explicitly permits customer-developed ABAP interfaces, which gives you more room than the Public Edition.
An MCP server in front of S/4HANA
An MCP server turns SAP functions into tools any MCP-capable agent can call. SAP's reference architecture distinguishes two patterns for third-party servers: one running on a non-SAP platform, and a custom one hosted in the customer's own subaccount. Both are pointed to a full governance checklist.
For SAP-centric setups, the same page recommends SAP's own building blocks. The MCP Gateway in SAP Integration Suite provides governed tool access, including mixed SAP and non-SAP catalogues. Joule Studio generates MCP servers for SAP business capabilities from SAP's semantic API catalogue. SAP's MCP Gateway tutorial calls the gateway the enterprise control plane for MCP: it aggregates tools from SAP APIs, non-SAP APIs, integration flows, data sources and external MCP servers, and enforces authentication, authorisation, rate limiting and payload protection. For production use the tutorial requires the Premium or Enhanced Edition of Integration Suite.
Joule, SAP's built-in assistant
Joule is the AI assistant SAP embeds in its own applications. For the Private Edition, SAP's Joule architecture page describes a conversational interface in the Fiori Launchpad, running on BTP, available exclusively to RISE with SAP customers, and dependent on activated OData services for transactional tasks. Joule is therefore not a way to plug in an outside agent; it is an alternative or a complement, as the comparison below shows.
What does the SAP API Policy allow for AI agents?
SAP API Policy v.4.2026a states that it forms part of the documentation of each SAP solution. Its section 2.2.2 prohibits API use for interaction with "(semi-) autonomous or generative AI systems that plan, select, or execute sequences of API calls", except through SAP-endorsed architectures, data services or pathways intended for that purpose.
That sentence describes most AI agents. Other provisions matter just as much:
- Published APIs only. Internal, private or SAP-reserved interfaces are excluded. The one stated exception is customer-developed ABAP interfaces on private cloud and on-premise systems.
- No workarounds. Controls must not be bypassed through intermediary services, custom code, proxies, gateways or impersonation. A home-built MCP server that hides where calls originate would sit squarely in that territory.
- No bulk extraction. Scraping and systematic or large-scale extraction or replication are also prohibited outside endorsed routes.
- Enforcement. SAP may monitor usage and throttle, suspend or terminate access on non-compliance.
- Legal duties remain. The policy does not limit data export that the law requires, for example for portability.
SAP's reference architecture lists full adherence to the API Policy as a condition for third-party MCP access. In practice this steers agent projects towards the MCP Gateway, Joule Studio and BTP services. The policy does not spell out an exhaustive list of what counts as "SAP-endorsed". This is orientation, not legal advice; check your own design against your SAP contract with qualified counsel.
What permissions should the agent have in SAP?
Give the agent exactly the rights its tools need, and make every action traceable to a person. There are two models: a technical communication user with fixed rights, or principal propagation, where the agent acts with the rights of the employee it is working for.
Technical user. Quick to set up and fine for background jobs with no individual behind them, such as a nightly reconciliation. The downside: everyone using the agent shares one set of rights, and SAP's logs only show the technical user.
Principal propagation. The agent passes the user's identity through. According to SAP, Joule in the Private Edition works this way, so users only see data and perform actions they are already authorised for. For custom agents this is usually the better model, because existing SAP roles keep doing their job.
Exchange tokens, never forward them. SAP's reference architecture states that an MCP server must never pass the caller's token straight to a downstream API. Instead, a token exchange based on RFC 8693 should produce a new credential that identifies the agent, keeps the user context and is scoped to the minimum permissions the specific tool needs. The agent has to be registered in SAP Cloud Identity Services for this.
The same source adds: do not store long-lived credentials in the MCP server, require TLS 1.2 or later, treat every tool input as untrusted, and keep the server's own rate limits within the quotas of the SAP APIs behind it.
Joule or a custom agent: where is the line?
Joule is designed for work inside SAP: answering questions and triggering transactions under existing SAP roles. A custom agent makes sense when the process crosses system boundaries, when you want a model you choose or host yourself, or when SAP is only one of several data sources.
The line has blurred since SAP TechEd in November 2025, when SAP announced that custom agents in Joule Studio would become generally available in December, with support for MCP and the Agent-to-Agent (A2A) protocol. Through the MCP Gateway, customers can also expose their own APIs and integration flows as agent tools. For multi-agent setups, SAP's reference architecture recommends A2A via its Agent Gateway.
A practical rule of thumb:
| Situation | Likely route |
|---|---|
| Questions and standard tasks inside SAP only | Joule |
| Custom agent, SAP is one system among several | Custom agent via MCP Gateway |
| On-premise S/4HANA, agent running in the cloud | MCP Gateway plus Cloud Connector |
| Fixed background sync, no individual user | Standard integration via communication arrangement, no planning agent |
The last row is deliberate. Not every automation needs an agent. A fixed integration on a published API is easier to audit and, on the wording, stays outside the agent clause, as long as it matches the documented use.
How do you approach the project step by step?
Start with a single read-only use case, settle the permitted route and the agent's identity first, and only enable write actions once logging and approvals work. The steps below apply to cloud and on-premise alike; the differences show up in steps three and four.
- Narrow the use case. Which question or transaction, which SAP objects, read or write? "Delivery status for a customer's open orders" is a use case; "an agent for sales" is not.
- Check the Business Accelerator Hub. Is there a published API for every object you need? If not, the Public Edition cannot support the use case as described; on private cloud or on-premise, a custom ABAP interface may fill the gap.
- Choose a permitted route. Joule, Joule Studio, MCP Gateway or your own server, measured against the API Policy and your contract. Decide this before anyone writes code.
- Set up network and identity. Cloud: communication user, system and arrangement. On-premise: the Cloud Connector with tightly scoped resources, plus principal propagation where needed.
- Keep tools narrow. "Read order status" and "check delivery block" beat a generic "run an OData query". Narrow tools can be authorised and reviewed one by one.
- Add approvals and logging. Write tools only with human confirmation; log every call with agent, user, tool and result.
- Test, then widen. Test tenant first, then read-only in production, then write actions one at a time.
If the agent logic must run in your own data centre, for example for data protection or sovereignty reasons, the background is covered under sovereign AI.
What are the limits and risks?
Right now the biggest risk is contractual rather than technical: an agent that reaches S/4HANA outside an SAP-endorsed route may breach the API Policy and put access at risk. On the technical side, the usual problems are overly broad permissions, weak traceability and unexpected load on the production system.
- Contract. The agent clause is broadly worded, and what counts as endorsed may change with new policy versions. Always check the current text.
- Cost of the endorsed routes. The MCP Gateway and Joule Studio depend on BTP and suitable Integration Suite editions. Factor that into the business case before committing.
- Over-privileged technical users. A communication arrangement opens the whole scenario, not just what the agent needs.
- Prompt injection through SAP data. Free-text fields in orders or partner records can contain instructions the model mistakes for commands. Never let the model alone trigger write actions.
- Load and quotas. SAP documents rate limits and quotas per API. An agent that queries in loops will hit them sooner than a conventional integration.
- Poor fit. If the process is fully predictable, a fixed integration is cheaper, easier to audit and contractually simpler than an agent.
How do I get started?
Pick one read-only use case, one published API and one clearly defined, SAP-endorsed access route. Once that runs reliably and the business team confirms the value, add more tools, and only then add write actions with approval steps.
A short inventory is a good first move: which S/4HANA edition and release you run, whether a BTP subaccount and Integration Suite already exist, and which SAP roles the agent's future users hold. Those three answers usually narrow the route in the table above to one or two options.
To see how agents work with the ERP in specific functions, look at quotation agents and technical service agents. The protocol background on tools, transport and permissions is in the MCP server guide.
Frequently asked questions
Can my own AI agent call SAP APIs directly?
Section 2.2.2 of SAP API Policy v.4.2026a prohibits API use by AI systems that plan, select or execute sequences of API calls, except through SAP-endorsed architectures. Whether your setup falls under that clause is a question for your SAP contract and your legal advisers.
Do I need SAP BTP?
For the routes SAP recommends, usually yes: the MCP Gateway, Joule Studio and the Cloud Connector all connect to SAP BTP. A technical connection without BTP is possible, but it raises the policy question.
Whose permissions does the agent use?
Either a technical communication user scoped by the communication arrangement, or the permissions of the person it acts for via principal propagation. For agents that work on behalf of individual employees, the second model is usually the cleaner one.
Is Joule a replacement for a custom agent?
For questions and standard tasks inside SAP, often yes. A custom agent is still needed when the process spans non-SAP systems or must run on a model you choose and host.
Can the agent use custom ABAP interfaces?
On private cloud and on-premise deployments the API Policy explicitly allows customer-developed ABAP interfaces. Internal, unpublished SAP APIs remain off limits.
Sources
- SAP API Policy v.4.2026a (SAP Help Portal) help.sap.com
- SAP Architecture Center – Third-Party MCP Server Access to SAP Solutions architecture.learning.sap.com
- SAP Developers – MCP Gateway in SAP Integration Suite developers.sap.com
- SAP News – New Agentic Capabilities in SAP BTP (TechEd, November 2025) news.sap.com
- SAP Developers – Integrate SAP BTP ABAP Environment and SAP S/4HANA Cloud Public Edition (Communication Arrangement) developers.sap.com
- SAP Learning – Explaining the SAP Cloud Connector learning.sap.com
- SAP Architecture Center – Joule with SAP S/4HANA Cloud Private Edition architecture.learning.sap.com