# Agentforce, ServiceNow and Workday agents with SAP: who owns the approval step

> See how CRM, IT service and HR agents from other vendors reach SAP data, what SAP's API policy allows, and why approvals of SAP changes stay in SAP.

- Course: Orchestrate, Unit 15 · SAP AI next to other platforms
- Page: https://erpfde.com/topics/agentforce-servicenow-and-workday-with-sap/
- Updated: 2026-11-25
- Reading time: Foundational 9 min, Deep 32 min

Independent learning resource. Not affiliated with, sponsored by or endorsed by SAP SE. SAP and other SAP products mentioned are trademarks of SAP SE in Germany and other countries.

## Foundational layer

### The 60-second version

SAP is rarely the only place where a company runs agents. The CRM vendor sells sales and service agents, the IT service desk has its own, and the HR suite has more. Sooner or later each of them asks SAP for something: an order's status, a credit block, a role for a new hire, a cost center.

That raises three questions, and this topic answers them in order:

1. **How does the other vendor's agent reach SAP?** Through an MCP server, an agent-to-agent (A2A) call to an SAP agent, or a classic integration connector.
2. **Is that path allowed?** SAP's API policy, published in April 2026, allows AI agents to plan SAP API calls only through paths SAP endorses.
3. **Who approves a change in SAP?** Each platform has its own approval feature. A Salesforce or ServiceNow approval does not make an SAP change safe. The person who owns that SAP decision approves it, in SAP.

The rule: **the other platform may ask and may draft; SAP decides, as a named person.**

### Why it matters to the business

Calder Pumpworks, the course's fictional pump maker, is the example. For this topic, assume Calder's CRM is Salesforce Sales Cloud with Agentforce, and its IT service desk runs on ServiceNow. Calder's HR runs on SAP SuccessFactors, so the Workday case is a what-if for companies whose HR runs on Workday. These are course assumptions, not vendor endorsements.

Three requests show the value and the risk:

- **Sales.** A Calder customer service clerk asks the CRM agent why Hallam's order `1000002` hasn't shipped. The answer sits in SAP: a credit block on a 24,288.00 USD order. An agent that reads SAP saves the clerk a switch to SAP.
- **IT service.** A new master data steward asks the service desk for a purchasing requester role. A ServiceNow agent could file the request. Assigning an SAP role, though, changes what that person may do with suppliers and money.
- **HR.** An HR agent wants to post hours for a technician who has already left. If it writes into SAP as a shared user, nobody notices that the person is gone.

The value is in reading and preparing. The risk is in changing SAP. A credit release, a role assignment or a posting each carries money or compliance with it. Calder's auditors will ask who approved each one, under which SAP authority. "The CRM's approval process" is not an answer they accept for an SAP change.

There is also a contract risk. SAP's API policy says AI agents that plan SAP API calls must use SAP-endorsed paths. A vendor's agent that reaches SAP through an old RFC module or a scraping bot may work today and break or breach terms tomorrow ([SAP API Policy](https://help.sap.com/doc/sap-api-policy/latest/en-US/API_Policy_latest.pdf)).

### How SAP does it

As read on 25 November 2026, SAP offers two kinds of door for other vendors' agents:

- **A2A into SAP's own agents.** SAP says Joule's bi-directional A2A capabilities "will be generally available in Q4" 2026, so that third-party agents can call Joule Agents ([SAP News, 13 May 2026](https://news.sap.com/2026/05/future-enterprise-autonomous/)). SAP's API policy overview names A2A through the Agent Gateway as an endorsed pattern ([SAP overview deck](https://assets.dm.ux.sap.com/sap-user-groups/pdfs/260530_sap_api_policy_overview.pdf)). The SAP agent does the work with SAP's own context.
- **MCP tools through SAP Integration Suite.** The MCP Gateway turns released APIs into tools that other agents call, with SAP's policies in front. The [MCP gateway topic](https://erpfde.com/topics/integration-suite-mcp-gateway-hands-on/) covers it.

SAP's overview deck answers the platform question directly: customers can use any third-party AI platform, provided it connects through an endorsed architecture using open protocols such as A2A and MCP. SAP also keeps an inventory: SAP AI Agent Hub is generally available and is meant to discover and govern SAP and non-SAP agents and MCP servers ([SAP News](https://news.sap.com/2026/05/future-enterprise-autonomous/)).

The other three vendors have built matching doors on their side. Salesforce announced a native MCP client for Agentforce in June 2025 ([Salesforce](https://www.salesforce.com/news/press-releases/2025/06/23/agentforce-3-announcement/)). ServiceNow's Action Fabric covers MCP server, MCP client and A2A ([ServiceNow Community](https://www.servicenow.com/community/servicenow-otto-articles/action-fabric-mcp-server-mcp-client-and-a2a-explained/ta-p/3557794)). Workday's Agent Gateway supports MCP and A2A, and its Agent System of Record is generally available ([Workday](https://blog.workday.com/en-us/managing-ai-powered-future-of-work.html)). Salesforce, through MuleSoft, and ServiceNow also sell SAP connectors for ordinary integration flows ([MuleSoft](https://www.mulesoft.com/integration/sap/s4hana), [ServiceNow docs](https://www.servicenow.com/docs/r/integrate-applications/integration-hub/sap-s4-odata-spoke.html)). None of the vendor pages read for this topic describes a ready-made agent that reads or changes S/4HANA through SAP's endorsed paths. Expect to build that link.

### Who owns which step

The table is the decision this topic asks you to make for each agent. Columns are the steps of a request; rows are the three platforms at Calder.

| Step | Agentforce in the CRM | ServiceNow service desk | Workday HR (what-if) |
| --- | --- | --- | --- |
| Who starts it | Customer service clerk in the CRM | Employee raising a ticket | HR administrator |
| What it asks SAP for | Order status, credit block, delivery date | A role, a locked user, an interface error | Cost center, time posting, open items for a leaver |
| Endorsed path | MCP tools via the gateway; A2A to a Joule agent | MCP tools via the gateway | MCP tools via the gateway |
| Who SAP sees | The clerk's own SAP user | The requester's SAP user | The HR administrator's SAP user |
| What the agent may do | Read, draft a credit release request | Draft a role request | Read, draft a correction |
| Who approves the SAP change | Credit analyst, in SAP | Role owner, in SAP | Payroll or controlling owner, in SAP |
| What the other platform's approval means | Sales agreed to ask; context for the analyst | IT agreed the ticket is valid; context for the role owner | HR agreed; context for the owner |

The bottom row is where projects slip. A ServiceNow catalog approval says the ticket is genuine. It does not say the person should hold that SAP role, or that it doesn't clash with roles they already hold. That check belongs to the role owner, who sees the [role design and its conflict rules](https://erpfde.com/topics/roles-and-authorization-design/).

> **Note** **For functional consultants.** Expect new test cases, not new configuration. For each agent, test a read the person may do and one they may not; test that a change arrives in SAP as a draft or request in the owner's worklist; and test that the owner, not the requester, approves it. Role owners and credit analysts gain a new source of requests. Their workload and response times belong in the change impact assessment.

### Questions to ask

1. When the other vendor's agent reads SAP, whose SAP user does SAP see? Show me the log line.
2. Which path does it use: SAP's MCP Gateway, A2A to an SAP agent, a connector, or something else? Is that path one SAP endorses for agents?
3. Which SAP changes can the agent cause? Where does each one wait for approval, and who approves it?
4. If the other platform's approval and the SAP owner disagree, who wins, and how is that recorded?
5. Is the agent registered in our agent inventory, with an owner and a retirement date?
6. Who pays for each meter: the other vendor's agent licence, SAP Integration Suite, and any SAP AI Units for Joule agents?

### Common misconceptions

- **"The vendor's SAP connector makes it compliant."** A connector proves a technical link. SAP's policy is about agent-planned calls, which need an endorsed path whatever the connector.
- **"We approved it in Salesforce, so the SAP change is approved."** The other platform's approval is context. The SAP owner approves the SAP change, in SAP, as a named user.
- **"A technical user is simpler and just as safe."** It hides who asked, and gives everyone the technical user's access. Map each person to their own SAP user.
- **"A2A means the other agent gets SAP's data."** With A2A into Joule, SAP's agent does the work and returns an answer. The other agent never holds SAP credentials.

### Key terms

- **Agentforce:** Salesforce's platform for AI agents in its CRM and service products.
- **Action Fabric:** ServiceNow's framework for connecting AI agents across systems: an MCP server, an MCP client and A2A.
- **Agent System of Record (ASOR):** Workday's registry for Workday, partner and customer agents, with an Agent Gateway that speaks MCP and A2A.
- **Endorsed path:** an architecture or pathway SAP names for AI agent or bulk data access, such as A2A to SAP agents or the MCP Gateway in SAP Integration Suite.
- **Draft:** a change prepared by an agent that waits in SAP for a named person to approve it.
- **Approval owner:** the SAP role holder who decides a kind of change, such as a credit analyst for credit releases or a role owner for role assignments.
- **Technical user:** one shared SAP user for a system or agent, which hides which person asked.

### Check yourself

1. A Calder clerk approves a credit release request in the CRM. What should happen to the credit block in SAP?
   - A. SAP releases the block at once, because the CRM approval is recorded
   - B. A draft waits in SAP until the credit analyst approves it there
   - C. The CRM agent releases it using its own technical user
   - D. Nothing, because CRM agents may not mention credit blocks at all

   Answer: B. The other platform may ask and draft; the SAP owner approves the SAP change, in SAP, as a named user. The CRM approval travels with the draft as context for the credit analyst.

2. Under SAP's API policy, when may another vendor's AI agent plan and call SAP APIs?
   - A. Whenever the agent uses an SAP-certified connector sold by the agent's vendor
   - B. Only when the agent runs inside SAP Business Technology Platform
   - C. When it goes through an SAP-endorsed path, such as A2A or the MCP Gateway
   - D. Only for read calls, since the policy says nothing about writes

   Answer: C. The policy bars agent-planned API use except through SAP-endorsed architectures or pathways. A certified connector proves a technical link, not an endorsed agent path.

3. Why does the topic insist that SAP sees the clerk's own user rather than a technical user?
   - A. SAP's roles decide what each person reads, and the log names them
   - B. Technical users cost more SAP licences than named users in every contract
   - C. Named users let the agent answer faster in a busy chat
   - D. A technical user can't call the MCP Gateway at all

   Answer: A. With a shared technical user, everyone gets its access and the audit trail can't say who asked. A named user lets SAP's authorizations decide and keeps the record honest.

4. A ServiceNow agent files a request to give a new steward an SAP purchasing role. Who should approve the assignment?
   - A. The IT manager who approved the ServiceNow catalog item for it
   - B. The steward, since they know what their job needs
   - C. The SAP role owner, who sees conflicts with roles already held
   - D. The ServiceNow agent, once the ticket is approved

   Answer: C. The catalog approval says the ticket is genuine, not that the role fits. The role owner sees the conflict rules and decides in SAP.

5. What is a fair summary of what the other vendors offer out of the box for SAP, as read in November 2026?
   - A. A certified agent from each vendor that changes S/4HANA through endorsed paths
   - B. MCP and A2A doors on their side and connectors; the SAP link is yours
   - C. Nothing, since none of them supports MCP or A2A yet
   - D. Direct database access to S/4HANA tables through their gateways

   Answer: B. Salesforce, ServiceNow and Workday each describe MCP or A2A support, and Salesforce and ServiceNow sell SAP connectors. None of the pages read describes a ready agent that works through SAP's endorsed paths.

6. Which question best tests whether a third-party agent design is safe for SAP changes?
   - A. How many languages does the agent support in its chat window for clerks?
   - B. Which large language model does the vendor use?
   - C. How fast can the agent answer in a chat?
   - D. Where does each SAP change wait for approval, and who approves it?

   Answer: D. The risk sits in changes that carry money or access. Knowing where each change waits and who approves it in SAP decides whether the design holds up in an audit.

## Deep layer

### Mental model

Treat every other vendor's agent as **a requester with good manners and no authority in SAP**. It may ask questions, and it may prepare a change. It never decides a change in SAP, and it never borrows someone else's SAP identity to do it.

That splits the design into two lines you draw once per agent:

- **The identity line.** Every SAP call names a person who maps to an active SAP user. SAP's own authorizations decide the rest, as in [agent permissions and SAP authorizations](https://erpfde.com/topics/agent-permissions-and-sap-authorizations/).
- **The decision line.** Reads cross it freely, within that person's roles. Changes stop at it as drafts. A named SAP user who owns that kind of decision approves on the SAP side, and the change runs as that approver. The other platform's approval travels with the draft as context, nothing more.

The same split works whichever vendor sits on the other side, because it lives in SAP's front door, not in the other platform. That is what lets you add a fourth vendor next year without redesigning approvals.

### How it works

#### The doors on each side

On SAP's side there are two endorsed doors for agents, as read on 25 November 2026:

| Door | What crosses it | Who does the work in SAP | Status, as SAP states it |
| --- | --- | --- | --- |
| **A2A into an SAP agent** | A task in plain language, and an answer or an artifact back | SAP's agent, with its own tools and context | Joule's bi-directional A2A "will be generally available in Q4" 2026 ([SAP News](https://news.sap.com/2026/05/future-enterprise-autonomous/)) |
| **MCP Gateway in SAP Integration Suite** | Tool calls generated from released APIs | The calling agent, through tools SAP's policies wrap | Covered with its own sources in [the MCP gateway topic](https://erpfde.com/topics/integration-suite-mcp-gateway-hands-on/) |

SAP's API policy (v.4.2026a) bars API use by "(semi-) autonomous or generative AI systems" that plan, select or run sequences of API calls, and large-scale extraction, except through SAP-endorsed architectures or pathways. Section 3 bars getting around the controls through proxies, gateways or impersonation ([SAP API Policy](https://help.sap.com/doc/sap-api-policy/latest/en-US/API_Policy_latest.pdf)). SAP's own overview deck lists ODP-RFC as the only unpermitted interface so far, with an opt-out until 31 December 2026 ([SAP overview deck](https://assets.dm.ux.sap.com/sap-user-groups/pdfs/260530_sap_api_policy_overview.pdf)). The [API policy radar page](https://erpfde.com/topics/sap-api-policy-and-third-party-agents/) reads both documents in full.

On the other side, each vendor has built its own doors:

- **Salesforce Agentforce.** The Agentforce 3 announcement of 23 June 2025 said Agentforce "will include a native MCP client", listed for July 2025, and listed MuleSoft MCP and A2A support as "generally available in July" ([Salesforce](https://www.salesforce.com/news/press-releases/2025/06/23/agentforce-3-announcement/)). The run couldn't confirm today's status on a Salesforce page; check it before you plan. MuleSoft's SAP connectors cover OData for cloud and on-premise, SOAP, and IDoc or BAPI over RFC, with Basic, OAuth 2.0 or X.509 authentication ([MuleSoft](https://www.mulesoft.com/integration/sap/s4hana)).
- **ServiceNow.** Action Fabric is ServiceNow's framework for connecting agents: an MCP Server Console, an MCP client and A2A. The Console needs Zurich Patch 9 or Australia Patch 2. A2A authenticates with OAuth 2.0 or an API key, and ServiceNow's AI Gateway governs MCP traffic but not A2A ([ServiceNow Community](https://www.servicenow.com/community/servicenow-otto-articles/action-fabric-mcp-server-mcp-client-and-a2a-explained/ta-p/3557794)). ServiceNow's FAQ says it supports and recommends A2A v0.3 as of its December 2025 release, and its MCP client speaks Streamable HTTP with no auth, an API key or OAuth 2.1 ([ServiceNow FAQ](https://www.servicenow.com/community/now-assist-articles/introducing-ai-agent-fabric-enable-mcp-and-a2a-for-your-agentic/ta-p/3373907)). Separately, the SAP S4 HANA OData spoke offers Flow Designer actions for purchase orders, suppliers, goods receipts and invoices; it needs an Integration Hub subscription and was tested with S/4HANA 2023 ([ServiceNow docs](https://www.servicenow.com/docs/r/integrate-applications/integration-hub/sap-s4-odata-spoke.html)).
- **Workday.** The Agent System of Record (ASOR) became generally available in February 2026. Its Agent Gateway supports MCP and A2A, and agents act "on behalf of a user or as themselves" under Workday's security model ([Workday blog](https://blog.workday.com/en-us/managing-ai-powered-future-of-work.html)). Workday's admin guide shows the reverse direction too: an outside assistant calls Workday's Self-Service Agent over A2A after its client is registered in ASOR, and end users must sit in the assigned security groups ([Workday docs](https://doc.workday.com/admin-guide/en-us/workday-ai/agents/external-agents/connect-external-agent-to-workday-using-a2a.html)).

> **Warning** Watch the protocol versions. ServiceNow's FAQ recommends A2A v0.3 and plans v1.0; [the A2A topic](https://erpfde.com/topics/a2a-for-sap-agents/) shows how a server answers both. Pin the version each pair of platforms uses, and retest when either side moves.

#### One request, end to end

Here is the CRM case at Calder: the clerk asks Agentforce to get Hallam's order `1000002` moving.

```mermaid
sequenceDiagram
  participant C as Clerk (CRM)
  participant A as Agentforce agent
  participant G as SAP front door<br/>(MCP Gateway)
  participant S as S/4HANA CP10
  participant K as Credit analyst
  C->>A: Why is 1000002 stuck? Release it
  A->>G: get_sales_order 1000002<br/>token for the clerk
  G->>S: read as SAP user 00100265
  S-->>A: credit block, 24,288.00 USD
  A->>G: request_credit_release 1000002<br/>+ CRM approval as context
  G->>S: create draft CRR-0001
  S-->>K: draft in the analyst's worklist
  K->>S: approve in SAP
  S-->>A: status: approved by 00100304
```

Two things in the diagram carry the design. The agent's token names the clerk, so SAP reads as `00100265`. And the change is a request: it lands in the credit analyst's worklist, and the release runs under the analyst's authority, not the clerk's and not the agent's.

With A2A into a Joule agent, the middle changes: Agentforce sends a task, and the SAP agent decides which SAP tools to call. The identity line still applies. Ask which SAP user the SAP agent acts for; don't assume the handoff carries it.

#### Where approvals live

Each platform has its own approval engine: Salesforce approval processes, ServiceNow catalog approvals, Workday business processes. They are good at the decisions that belong to that platform. The rule is to match the approver to the system of record for the thing being changed:

| Change | System of record | Approver | Approval in the other platform means |
| --- | --- | --- | --- |
| Release a credit block | S/4HANA | Credit analyst | Sales agrees to ask |
| Assign an SAP role | S/4HANA (or SAP's access governance tool) | Role owner | The ticket is genuine |
| Correct a time posting | S/4HANA | Controlling or payroll owner | HR agrees the hours are wrong |
| Change a customer's contact person | CRM | CRM data owner | That is the real approval |

The last row is the reverse case: when the CRM is the system of record, the CRM approval is the one that counts, and SAP is the requester.

### Build it yourself: a front door that keeps approvals in SAP

You will run a small stand-in for SAP's front door. Three foreign agents send fifteen requests: Agentforce from Calder's CRM, ServiceNow from the service desk, and a Workday HR agent as a what-if. The door applies five rules and prints what it allowed, refused or turned into a draft, and who approved each draft.

**Before you start:** complete [Set up your computer for this course](https://erpfde.com/topics/set-up-your-computer/) and [Set up for Unit 15](https://erpfde.com/topics/set-up-for-unit-15/). This lab uses only Python's built-in modules, so there's nothing new to install.

```mermaid
flowchart LR
  R[Request from<br/>another platform] --> G1{G1 route<br/>endorsed?}
  G1 -- no --> X[refused]
  G1 -- yes --> G2{G2 named,<br/>active SAP user?}
  G2 -- no --> X
  G2 -- yes --> T{read or<br/>change?}
  T -- read --> G3{G3 SAP roles<br/>allow it?}
  G3 -- yes --> OK[allowed]
  G3 -- no --> X
  T -- change --> G4[G4 draft in SAP]
  G4 --> G5{G5 owner<br/>approves in SAP}
```

> **Note** New words in this walkthrough:
> - **Route:** the path a request takes into SAP, such as the MCP Gateway, an A2A call or an RFC module.
> - **Mapped account:** the other platform's sign-in name linked to one SAP user. In a real landscape SAP Cloud Identity Services holds this link.
> - **Draft:** a change the agent prepared that waits in SAP for a person.
> - **Approval register:** the list of drafts with who asked, who approved, and what the other platform said.
> - **JSON lines:** a text file with one JSON record per line, easy to read and to load into tools.

#### What you need

- Your course folder from the Unit 15 setup, with `.venv`.
- About 20 minutes.
- Cost: free. No Salesforce, ServiceNow, Workday or SAP account; all three agents are scripted rows.

#### Step 1: Open your course folder and turn on the virtual environment

1. Open VS Code, choose **File > Open Folder**, and open `orchestrate-course`.
2. Open a terminal: **Terminal > New Terminal**.
3. If the prompt doesn't start with `(.venv)`, turn it on:

   - **Windows (PowerShell):**

     ```powershell
     .venv\Scripts\Activate.ps1
     ```

   - **macOS / Linux:**

     ```bash
     source .venv/bin/activate
     ```

#### Step 2: Save the lab

1. In VS Code, right-click the `unit15` folder, choose **New File**, name it `foreign_agent_gate.py`, paste the code below and save.

```python
"""Unit 15: other vendors' agents asking for SAP data, and who owns the approval step.

A course stand-in for SAP's front door. Three foreign agents send requests:

    crm-agentforce   an Agentforce agent in Calder's CRM (Salesforce, a course assumption)
    itsm-servicenow  a ServiceNow agent on Calder's IT service desk (a course assumption)
    hr-workday       a Workday HR agent: a what-if, since Calder's HR runs on SuccessFactors

The gate applies five course rules, in order:

    G1 route     agent traffic only through an endorsed path (MCP gateway or A2A to an SAP agent)
    G2 identity  the call names a person who maps to an active SAP user; no shared technical user
    G3 scope     the mapped SAP user's own authorizations decide what may be read
    G4 change    an agent never changes SAP; a change request becomes an SAP draft for a named owner
    G5 approve   only a named SAP user with the owner role approves, never the requester,
                 never the foreign platform; an approval from the other platform is kept as context

Built-in modules only, no network, no randomness. Every value is a course label. All fictional.

    python unit15/foreign_agent_gate.py check
    python unit15/foreign_agent_gate.py explain A04
"""
import json
import sys
from pathlib import Path

LOG = Path(__file__).with_name("foreign_agent_log.jsonl")

# Endorsed and refused routes (course labels for the paths SAP's API policy material describes).
ROUTES = {
    "mcp-gateway": "endorsed",       # MCP Gateway in SAP Integration Suite, tools over released APIs
    "a2a-joule": "endorsed",         # A2A into an SAP agent, which does the work itself
    "released-api": "not-for-agents",  # a published API, fine for fixed integrations, not agent-planned calls
    "custom-rfc": "unpublished",     # a customer RFC module or other non-published interface
    "odp-rfc": "unpermitted",        # the interface SAP has flagged as unpermitted
    "screen": "unpublished",         # driving SAP screens with a bot
}

# Foreign accounts mapped to SAP users (in production: SAP Cloud Identity Services).
ACCOUNTS = {
    ("crm-agentforce", "cs.clerk@calder-pumpworks.example"): "00100265",
    ("crm-agentforce", "inside.sales@calder-pumpworks.example"): "00100266",
    ("itsm-servicenow", "new.steward@calder-pumpworks.example"): "00100262",
    ("hr-workday", "hr.admin@calder-pumpworks.example"): "00100306",
}

# SAP users: active flag, what they may read, which drafts they own.
SAP_USERS = {
    "00100265": {"role": "customer service clerk", "active": True, "channels": ["10", "20", "30"], "owns": []},
    "00100266": {"role": "inside sales rep", "active": True, "channels": ["10"], "owns": []},
    "00100262": {"role": "master data steward", "active": True, "channels": [], "owns": []},
    "00100306": {"role": "HR administrator", "active": True, "channels": [], "owns": []},
    "00100304": {"role": "credit analyst", "active": True, "channels": ["10", "20", "30"], "owns": ["credit-release"]},
    "00100253": {"role": "purchasing manager", "active": True, "channels": [], "owns": ["role-request"]},
    "00100094": {"role": "maintenance technician", "active": False, "channels": [], "owns": []},
}

# Open orders from the order-to-cash topic (fictional, values as in the MCP gateway topic).
ORDERS = {
    "1000002": {"customer": "Hallam Fluid Systems", "channel": "20", "problem": "credit block",
                "net": "24288.00"},
    "1000003": {"customer": "Brennock Water Utility", "channel": "10", "problem": "billing data incomplete",
                "net": "12300.00"},
}

# Which change becomes which draft, and which SAP role owns its approval.
DRAFT_KINDS = {
    "release-credit-block": ("CRR", "credit-release"),
    "assign-role": ("ARQ", "role-request"),
}

SCENARIOS = [
    # id, platform, route, account (None = technical user), action, target, extra, expected
    ("A01", "crm-agentforce", "mcp-gateway", "cs.clerk@calder-pumpworks.example", "read", "1000002", {}, "allowed"),
    ("A02", "crm-agentforce", "mcp-gateway", None, "read", "1000002", {}, "refused"),
    ("A03", "crm-agentforce", "released-api", "cs.clerk@calder-pumpworks.example", "read", "1000002", {}, "refused"),
    ("A04", "crm-agentforce", "mcp-gateway", "cs.clerk@calder-pumpworks.example", "release-credit-block",
     "1000002", {"foreign_approval": "Salesforce approval by the sales manager"}, "drafted"),
    ("A05", "crm-agentforce", "a2a-joule", "inside.sales@calder-pumpworks.example", "read", "1000003", {},
     "allowed"),
    ("A06", "crm-agentforce", "mcp-gateway", "inside.sales@calder-pumpworks.example", "read", "1000002", {},
     "refused"),
    ("A07", "itsm-servicenow", "mcp-gateway", "new.steward@calder-pumpworks.example", "assign-role",
     "ZD_P2P_REQUESTER_US", {"foreign_approval": "ServiceNow catalog approval by the IT manager"}, "drafted"),
    ("A08", "itsm-servicenow", "custom-rfc", None, "unlock-user", "U00100094", {}, "refused"),
    ("A09", "hr-workday", "odp-rfc", "hr.admin@calder-pumpworks.example", "extract", "all cost centers", {},
     "refused"),
    ("A10", "hr-workday", "mcp-gateway", "hr.admin@calder-pumpworks.example", "post-time", "4000126",
     {"for_sap_user": "00100094"}, "refused"),
    ("P01", "sap", "approval", "00100304", "approve", "CRR-0001", {}, "approved"),
    ("P02", "sap", "approval", "00100265", "approve", "ARQ-0001", {}, "refused"),
    ("P03", "crm-agentforce", "mcp-gateway", None, "approve", "ARQ-0001", {}, "refused"),
    ("P04", "sap", "approval", "00100262", "approve", "ARQ-0001", {}, "refused"),
    ("P05", "sap", "approval", "00100253", "approve", "ARQ-0001", {}, "approved"),
]


class Gate:
    def __init__(self):
        self.drafts = {}      # draft id -> draft
        self.counters = {"CRR": 0, "ARQ": 0}
        self.sap_users_seen = set()

    def new_draft(self, prefix, owner_kind, sap_user, platform, target, foreign_approval):
        self.counters[prefix] += 1
        draft_id = f"{prefix}-{self.counters[prefix]:04d}"
        self.drafts[draft_id] = {"id": draft_id, "kind": owner_kind, "target": target,
                                 "requested_for": sap_user, "via": platform,
                                 "foreign_approval": foreign_approval, "status": "waiting"}
        return draft_id

    def decide(self, platform, route, account, action, target, extra):
        """Return (result, rule, detail)."""
        if action == "approve":
            return self.approve(platform, account, target)
        # G1 route
        kind = ROUTES.get(route)
        if kind != "endorsed":
            return "refused", "G1", f"route {route} is {kind}; agent traffic needs the MCP gateway or A2A"
        # G2 identity
        if account is None:
            return "refused", "G2", "technical user only; SAP would not know which person asked"
        sap_user = ACCOUNTS.get((platform, account))
        if sap_user is None:
            return "refused", "G2", f"no SAP user is mapped to {account} on {platform}"
        user = SAP_USERS[sap_user]
        if not user["active"]:
            return "refused", "G2", f"SAP user {sap_user} is locked"
        self.sap_users_seen.add(sap_user)
        for_user = extra.get("for_sap_user")
        if for_user and not SAP_USERS.get(for_user, {}).get("active", False):
            return "refused", "G2", f"the change is for SAP user {for_user}, who has left (locked)"
        # G3 scope (reads)
        if action == "read":
            order = ORDERS[target]
            if order["channel"] not in user["channels"]:
                return "refused", "G3", f"SAP user {sap_user} may not display orders in channel {order['channel']}"
            who = "Joule agent, for SAP user" if route == "a2a-joule" else "read as SAP user"
            return "allowed", "G3", f"{who} {sap_user}: {order['problem']}"
        # G4 change: never applied, at most drafted
        if action in DRAFT_KINDS:
            prefix, owner_kind = DRAFT_KINDS[action]
            draft_id = self.new_draft(prefix, owner_kind, sap_user, platform, target,
                                      extra.get("foreign_approval", ""))
            owner = next(u for u, d in SAP_USERS.items() if owner_kind in d["owns"])
            return "drafted", "G4", f"draft {draft_id} waits for SAP user {owner} ({SAP_USERS[owner]['role']})"
        return "refused", "G4", f"{action} is not offered to agents; no draft type exists for it"

    def approve(self, platform, account, draft_id):
        # G5: approvals happen in SAP, by a named SAP user who owns the draft kind and did not ask for it
        if platform != "sap":
            return "refused", "G5", f"{platform} can't approve; approvals happen in SAP by a named user"
        draft = self.drafts.get(draft_id)
        if draft is None:
            return "refused", "G5", f"no draft {draft_id}"
        user = SAP_USERS.get(account)
        if account == draft["requested_for"]:
            return "refused", "G5", f"SAP user {account} asked for {draft_id} and can't approve it"
        if user is None or draft["kind"] not in user["owns"]:
            return "refused", "G5", f"SAP user {account} does not own {draft['kind']} approvals"
        draft["status"] = f"approved by {account}"
        return "approved", "G5", f"{draft_id} approved by SAP user {account}; the change runs as that user"


def run_check(show_register=True):
    gate = Gate()
    LOG.write_text("", encoding="utf-8")
    good = 0
    print(f"{'ID':4} {'Platform':16} {'Route':12} {'Action':21} {'Result':9} Rule  Detail")
    for sid, platform, route, account, action, target, extra, expected in SCENARIOS:
        result, rule, detail = gate.decide(platform, route, account, action, target, extra)
        ok = result == expected
        good += ok
        mark = "" if ok else "   UNEXPECTED"
        print(f"{sid:4} {platform:16} {route:12} {action:21} {result:9} {rule:5} {detail}{mark}")
        with LOG.open("a", encoding="utf-8") as f:
            f.write(json.dumps({"id": sid, "platform": platform, "route": route, "account": account,
                                "action": action, "target": target, "result": result, "rule": rule,
                                "detail": detail}) + "\n")
    print(f"\n{good} of {len(SCENARIOS)} scenarios behaved as expected.")
    if show_register:
        print("\nApproval register (drafts in SAP):")
        for d in gate.drafts.values():
            context = f"; outside approval kept as context: {d['foreign_approval']}" if d["foreign_approval"] else ""
            print(f"  {d['id']}  {d['kind']:14} {d['target']:20} for {d['requested_for']} via {d['via']}: "
                  f"{d['status']}{context}")
    print(f"SAP users that acted: {', '.join(sorted(gate.sap_users_seen))}")
    print(f"Log: unit15/{LOG.name}")
    return good == len(SCENARIOS)


def explain(sid):
    for row in SCENARIOS:
        if row[0] == sid:
            gate = Gate()
            for earlier in SCENARIOS:   # replay earlier rows so drafts exist
                if earlier[0] == sid:
                    break
                gate.decide(*earlier[1:7])
            result, rule, detail = gate.decide(*row[1:7])
            print(json.dumps({"id": sid, "platform": row[1], "route": row[2], "account": row[3],
                              "action": row[4], "target": row[5], "extra": row[6],
                              "result": result, "rule": rule, "detail": detail}, indent=2))
            return
    sys.exit(f"No scenario {sid}. Use one of: {', '.join(r[0] for r in SCENARIOS)}")


if __name__ == "__main__":
    if len(sys.argv) >= 2 and sys.argv[1] == "check":
        sys.exit(0 if run_check() else 1)
    if len(sys.argv) == 3 and sys.argv[1] == "explain":
        explain(sys.argv[2].upper())
        sys.exit(0)
    sys.exit("Usage: python unit15/foreign_agent_gate.py check | explain <ID>")
```

#### Step 3: Run the fifteen scenarios

1. Run:

   - **Windows (PowerShell):**

     ```powershell
     python unit15\foreign_agent_gate.py check
     ```

   - **macOS / Linux:**

     ```bash
     python unit15/foreign_agent_gate.py check
     ```

**What success looks like** (the long lines are shortened here; yours show them in full):

```text
ID   Platform         Route        Action                Result    Rule  Detail
A01  crm-agentforce   mcp-gateway  read                  allowed   G3    read as SAP user 00100265: credit block
A02  crm-agentforce   mcp-gateway  read                  refused   G2    technical user only; SAP would not know which person asked
A03  crm-agentforce   released-api read                  refused   G1    route released-api is not-for-agents; ...
A04  crm-agentforce   mcp-gateway  release-credit-block  drafted   G4    draft CRR-0001 waits for SAP user 00100304 (credit analyst)
A05  crm-agentforce   a2a-joule    read                  allowed   G3    Joule agent, for SAP user 00100266: billing data incomplete
A06  crm-agentforce   mcp-gateway  read                  refused   G3    SAP user 00100266 may not display orders in channel 20
A07  itsm-servicenow  mcp-gateway  assign-role           drafted   G4    draft ARQ-0001 waits for SAP user 00100253 (purchasing manager)
A08  itsm-servicenow  custom-rfc   unlock-user           refused   G1    route custom-rfc is unpublished; ...
A09  hr-workday       odp-rfc      extract               refused   G1    route odp-rfc is unpermitted; ...
A10  hr-workday       mcp-gateway  post-time             refused   G2    the change is for SAP user 00100094, who has left (locked)
P01  sap              approval     approve               approved  G5    CRR-0001 approved by SAP user 00100304; the change runs as that user
P02  sap              approval     approve               refused   G5    SAP user 00100265 does not own role-request approvals
P03  crm-agentforce   mcp-gateway  approve               refused   G5    crm-agentforce can't approve; approvals happen in SAP by a named user
P04  sap              approval     approve               refused   G5    SAP user 00100262 asked for ARQ-0001 and can't approve it
P05  sap              approval     approve               approved  G5    ARQ-0001 approved by SAP user 00100253; the change runs as that user

15 of 15 scenarios behaved as expected.

Approval register (drafts in SAP):
  CRR-0001  credit-release 1000002              for 00100265 via crm-agentforce: approved by 00100304; outside approval kept as context: Salesforce approval by the sales manager
  ARQ-0001  role-request   ZD_P2P_REQUESTER_US  for 00100262 via itsm-servicenow: approved by 00100253; outside approval kept as context: ServiceNow catalog approval by the IT manager
SAP users that acted: 00100262, 00100265, 00100266, 00100306
Log: unit15/foreign_agent_log.jsonl
```

Read the rows in pairs:

- **A01 against A02.** Same order, same gateway. With the clerk's token SAP reads as `00100265`; with a technical user the door refuses, because nobody could say who asked.
- **A01 against A06.** The inside sales rep's role covers channel 10 only, so the same question about Hallam's distributor order is refused. SAP's roles decided, not the agent.
- **A03.** A published API is fine for a fixed integration, where code picks every call. An agent planning calls against it needs an endorsed path, so the course door refuses it.
- **A04 and P01.** The CRM approval travels with draft `CRR-0001`, and the credit analyst approves in SAP.
- **A07, P02 to P05.** The role request can't be approved by the clerk (not the owner), by Agentforce (not SAP), or by the steward who asked. Only the role owner can.
- **A10.** The HR agent's own user is fine, but the posting is for a leaver, so the door refuses it. That is the [hire-to-retire](https://erpfde.com/topics/hire-to-retire-touchpoints/) leaver problem seen from an agent.

> **Note** These results come from made-up rows and a stand-in front door. They show the method, not the behavior of SAP, Salesforce, ServiceNow or Workday.

#### Step 4: Look at one decision in detail

1. Run:

   ```bash
   python unit15/foreign_agent_gate.py explain A04
   ```

**What success looks like:**

```text
{
  "id": "A04",
  "platform": "crm-agentforce",
  "route": "mcp-gateway",
  "account": "cs.clerk@calder-pumpworks.example",
  "action": "release-credit-block",
  "target": "1000002",
  "extra": {
    "foreign_approval": "Salesforce approval by the sales manager"
  },
  "result": "drafted",
  "rule": "G4",
  "detail": "draft CRR-0001 waits for SAP user 00100304 (credit analyst)"
}
```

#### Step 5: Read the log

1. Open `unit15/foreign_agent_log.jsonl` in VS Code. There is one line per decision, with the platform, route, account, rule and result. That is the shape an auditor wants from a real gateway: every request from another platform, with the SAP rule that decided it.

#### Step 6: Save your work in Git

1. Run:

   ```bash
   git add unit15/foreign_agent_gate.py
   git commit -m "Unit 15: front door for other vendors' agents"
   ```

The log changes on every run; keep it out of Git.

#### How the code works

| Part | What it does |
| --- | --- |
| `ROUTES` | Labels each route: endorsed for agents, published but not for agent-planned calls, unpublished, or unpermitted |
| `ACCOUNTS` | Maps a platform's account to one SAP user, the job SAP Cloud Identity Services does in production |
| `SAP_USERS` | Each SAP user's role, whether active, which sales channels they may read, and which drafts they own |
| `DRAFT_KINDS` | Which change becomes which draft prefix, and which owner approves it |
| `Gate.decide` | Applies G1 route, G2 identity, G3 scope for reads, G4 draft for changes, in that order |
| `Gate.approve` | G5: only SAP, only an owner of that draft kind, never the person who asked |
| `run_check` | Runs the scenarios, prints the table, the approval register and the log path |
| `explain` | Replays the earlier rows, so drafts exist, then prints one decision as JSON |

#### If something goes wrong

| What you see | What it means | What to do |
| --- | --- | --- |
| `python` is not recognized / command not found | Python isn't on your path, or `.venv` is off | Turn on `.venv` (Step 1); see [Set up your computer](https://erpfde.com/topics/set-up-your-computer/) |
| `can't open file ... foreign_agent_gate.py` | The file is in another folder or has another name | Save it as `unit15/foreign_agent_gate.py` and run from the course folder |
| `UNEXPECTED` at the end of a row | The code differs from the listing | Copy the listing again and save |
| `IndentationError` | A paste changed the indentation | Paste again with **Edit > Paste**, not paste-as-text, and save |
| `KeyError` after your own edit | A new draft prefix is missing from `counters`, or a new user from `SAP_USERS` | Add it where the exercise says |
| A proxy or network message | Not this lab: it makes no network calls | Check you ran this file, not an earlier lab |

### The SAP way

What SAP and the three vendors offer for this, as read on 25 November 2026:

- **A2A into Joule agents.** Joule's bi-directional A2A is planned for general availability in Q4 2026 ([SAP News](https://news.sap.com/2026/05/future-enterprise-autonomous/)). SAP's API policy overview names A2A through the Agent Gateway as an endorsed pattern ([SAP overview deck](https://assets.dm.ux.sap.com/sap-user-groups/pdfs/260530_sap_api_policy_overview.pdf)). This is the door when an SAP agent already does the job, for example explaining a blocked order.
- **MCP Gateway in SAP Integration Suite.** Tools over released APIs with OAuth and policies; set up step by step in [the MCP gateway topic](https://erpfde.com/topics/integration-suite-mcp-gateway-hands-on/). This is the door when the other agent needs a few precise SAP reads or a draft-creating tool.
- **SAP AI Agent Hub.** SAP calls it generally available and describes it as a command center for SAP and non-SAP agents and MCP servers ([SAP News](https://news.sap.com/2026/05/future-enterprise-autonomous/)). Register each foreign agent and server there, as in [registering and approving MCP servers](https://erpfde.com/topics/registering-and-approving-mcp-servers-in-ai-agent-hub/).
- **Approvals in SAP.** Use SAP's own workflow and the worklist of the owning role for drafts, the pattern in [human approval in AI workflows](https://erpfde.com/topics/human-approval-in-ai-workflows/).
- **The vendors' connectors.** MuleSoft's SAP connectors and ServiceNow's SAP spokes are integration products, built for flows a person designs. Under SAP's policy, an agent that plans calls through them is the case to check with SAP and the vendor; fixed flows are a different case.
- **Licensing.** Expect up to three meters: the other vendor's agent licence, SAP Integration Suite for the gateway, and SAP AI Units where a Joule agent does the work. The ServiceNow spoke adds an Integration Hub subscription ([ServiceNow docs](https://www.servicenow.com/docs/r/integrate-applications/integration-hub/sap-s4-odata-spoke.html)). None of the pages read gives prices.

### Build vs. SAP

| Need | Use | Build | Why |
| --- | --- | --- | --- |
| A CRM user asks something a Joule agent already answers | A2A from Agentforce to the Joule agent | Only the call and the answer display | SAP's agent holds the context and SAP's identity handling |
| A CRM or service agent needs two or three SAP reads | MCP Gateway tools over released APIs | The agent on the other platform | Endorsed path, SAP policies, per-user tokens |
| An agent wants to change SAP data | A draft-creating tool and SAP workflow | The draft tool, if SAP offers none | The owner approves in SAP; the agent never writes |
| A fixed nightly sync of CRM and SAP data | An integration flow, not an agent | The flow, with its own monitoring | No agent planning calls, so the agent rules don't bite |
| Bulk HR or finance data for analytics | An endorsed data path, see [the API policy page](https://erpfde.com/topics/sap-api-policy-and-third-party-agents/) | The pipeline | Large-scale extraction is barred outside endorsed paths; ODP-RFC is unpermitted |
| A demo on made-up data | Not needed | A local stand-in, as in this lab | No real data, no real approvals |

### Architecture view

**Where it sits.** At Calder, `CP10` runs on S/4HANA Cloud Private Edition. The CRM (Salesforce in this topic) and the service desk (ServiceNow) run as SaaS in their vendors' clouds. SAP Integration Suite holds the MCP Gateway; Joule agents sit on SAP's side of an A2A call. Existing interfaces don't go away: the CRM still gets `I03` customer and order data and `I12` the availability check while quoting, from the [integration platform](https://erpfde.com/topics/integration-platform-and-clean-core/) design. The agents are new consumers beside them.

```mermaid
flowchart LR
  subgraph Other platforms
    AF[Agentforce<br/>CRM]
    SN[ServiceNow<br/>service desk]
    WD[HR agent]
  end
  subgraph SAP BTP
    GW[MCP Gateway<br/>Integration Suite]
    J[Joule agents<br/>via A2A]
    HUB[SAP AI Agent Hub<br/>inventory]
  end
  S4[S/4HANA CP10<br/>drafts + worklists]
  AF --> GW
  AF --> J
  SN --> GW
  WD --> GW
  GW --> S4
  J --> S4
  HUB -. registers .- AF
  HUB -. registers .- SN
```

**Non-functional requirements.**

| Requirement | Typical target | What breaks if it's missed |
| --- | --- | --- |
| Identity | Every SAP call runs as a mapped, active person | Over-wide access; an audit trail that names a robot |
| Approval | Every SAP change waits as a draft for a named owner | Changes nobody in SAP authorized |
| Latency | A read answers inside a chat turn, a few seconds | Users go back to SAP screens |
| Volume | Agent calls throttled per agent and per user at the gateway | One looping agent eats the quota for everyone |
| Availability | When SAP is down, the agent says so and stores nothing as fact | Stale credit or stock answers |
| Cost | Each meter owned by one budget holder | Three invoices, nobody accountable |

**Integration and identity.** The person signs in to the other platform with the company's identity provider. The agent passes a user token to the MCP Gateway (or the A2A call carries it to the SAP agent). SAP Cloud Identity Services maps the person to the SAP user, and the released API runs under that user's roles. Changes go through a tool that creates a draft, such as a credit release request; SAP workflow routes it to the owning role. Status comes back to the other platform as a read, not as a callback that changes anything.

**The decision to record.**

- *Context:* Calder's customer service works in the CRM and wants an Agentforce agent that explains blocked orders and asks for credit releases. ServiceNow wants an agent for SAP role requests.
- *Options:* A, vendor agents call SAP through their own connectors with a technical user. B, vendor agents call the MCP Gateway with per-user tokens, changes as drafts approved in SAP. C, the vendors hand tasks to Joule agents over A2A only. D, no SAP access from other platforms; users switch to SAP.
- *Decision:* B now, with C for questions a Joule agent covers once Joule's A2A is generally available. A is rejected: a technical user hides who asked and the path isn't endorsed for agents.
- *Consequences:* Calder maintains the identity mapping, owns two draft-creating tools, and registers each foreign agent. Credit analysts and role owners get a new request source and need response targets.

**What a design review will ask.**

1. Show the SAP log line for a test read from each platform. Does it name the person?
2. Which SAP changes can each agent cause, and where does each wait?
3. What happens to the other platform's approval if the SAP owner rejects the draft?
4. Is each path endorsed for agents under SAP's API policy, and who confirmed it with which vendor?
5. When a person leaves, how fast do both the platform account and the SAP user stop working?

### Production concerns

- **Authorizations.** Map people, not platforms. Keep tools read only, plus draft-creating tools for the few changes you allow. Give the agent's own SAP footprint nothing it could use alone, as in [agent permissions and SAP authorizations](https://erpfde.com/topics/agent-permissions-and-sap-authorizations/).
- **Separation of duties.** The requester never approves their own draft. Add the agent's draft tools to the [role design](https://erpfde.com/topics/roles-and-authorization-design/) so conflict rules see them.
- **Leavers.** Lock in both places. A10 in the lab is the case: an HR agent acting for, or on, a leaver.
- **Prompt injection.** A CRM case note or a ticket text can carry instructions. Treat text from the other platform as data, and never let it name a tool or an approver.
- **Evaluation.** Test per platform with two roles and a refusal, plus every approval path, including the owner rejecting a draft.
- **Operations.** Log every foreign call at the gateway with platform, person, tool and rule. Alert on a refusal spike: it usually means an expired mapping or a changed protocol version.
- **Clean core.** No custom RFC modules or screen bots for agents; released APIs behind the gateway. See [the integration platform and clean core](https://erpfde.com/topics/integration-platform-and-clean-core/).
- **Contracts.** Ask each vendor in writing which SAP path its agent uses, and keep the answer with the agent's entry in the register.

### Pitfalls

- **Two approvals, one silent.** The CRM shows "approved" while the SAP draft waits. Show the SAP status in the CRM, read from SAP.
- **The integration user that grows.** A MuleSoft or spoke user created for a nightly sync gets reused by the agent, with all its access.
- **Trusting the label.** A vendor page that says "SAP connector" says nothing about SAP's API policy for agents.
- **Approving where the button is.** Owners approve in the other platform because it's convenient. The SAP change then has no SAP approver.
- **Protocol drift.** One side moves to A2A v1.0 and the other stays on v0.3. Pin and test.
- **Forgetting the reverse direction.** SAP's agents will call Workday or ServiceNow too. The same rule applies the other way: their system of record, their approver.

### Exercise

Add a third kind of SAP change for the CRM agent, with its own owner, and prove the approval stays in SAP.

1. Open `unit15/foreign_agent_gate.py`.
2. In `DRAFT_KINDS`, add the line `"release-billing-block": ("BBR", "billing-release"),`.
3. In `Gate.__init__`, change the counters to `{"CRR": 0, "ARQ": 0, "BBR": 0}`.
4. In `SAP_USERS`, add `"00100308": {"role": "billing clerk", "active": True, "channels": ["10"], "owns": ["billing-release"]},` (a course value).
5. In `SCENARIOS`, before the `P05` row, add two rows:

   ```python
       ("A11", "crm-agentforce", "mcp-gateway", "cs.clerk@calder-pumpworks.example", "release-billing-block", "1000006", {}, "drafted"),
       ("P06", "sap", "approval", "00100308", "approve", "BBR-0001", {}, "approved"),
   ```

6. Run `python unit15/foreign_agent_gate.py check`.
7. In `unit15/README.md`, write two sentences: which SAP user approved `BBR-0001`, and why the clerk who asked couldn't.

**Done when** the check prints `17 of 17 scenarios behaved as expected` and the register lists `BBR-0001 ... approved by 00100308`. Keep the README note: the next topic in Unit 15, on where an agent should live, reuses it.

### Check yourself

1. In the lab, A01 is allowed and A02 is refused for the same order through the same gateway. What decides the difference?
   - A. A02 used a route SAP has flagged as unpermitted
   - B. A02 came as a technical user, so no person could be mapped to an SAP user
   - C. A02 asked about a sales channel the clerk's own SAP role doesn't cover at all
   - D. A02 was sent after the credit block had already been released

   Answer: B. Rule G2 needs a named person who maps to an active SAP user. A technical user hides who asked, so the door refuses before any SAP role is checked.

2. Why does the course door refuse A03, a read through a published SAP API?
   - A. An agent planning calls needs an SAP-endorsed path, not a bare published API
   - B. Published APIs may not be called by any system from outside SAP's own cloud
   - C. The clerk's SAP role doesn't allow reading Hallam's order
   - D. Reads through published APIs always need an approval first

   Answer: A. SAP's policy bars agent-planned API use except through endorsed pathways. A fixed integration flow may use the same published API, because code, not an agent, picks the calls.

3. Draft CRR-0001 carries "Salesforce approval by the sales manager". What does the gate do with that approval?
   - A. It applies the credit release at once, since the sales manager approved it
   - B. It refuses the draft, because two approvals would conflict
   - C. It keeps the text as context for the credit analyst, who decides in SAP
   - D. It forwards the draft back to Salesforce for a second approval

   Answer: C. The other platform's approval says sales agreed to ask. The decision to release credit belongs to the SAP owner, so the approval travels with the draft as context only.

4. In P04 the steward tries to approve ARQ-0001, the role request filed for them. Which rule stops it, and why?
   - A. G2, because the steward's SAP user was locked when they changed jobs
   - B. G5, because the person a draft was requested for can't approve it
   - C. G3, because the steward has no sales channels in SAP
   - D. G1, because approvals must arrive through A2A

   Answer: B. G5 forbids self-approval and only lets the owner of that draft kind approve. Here the purchasing manager owns role requests and approves in P05.

5. Your ServiceNow team proposes reusing the SAP user of the nightly IDoc spoke for its new agent "to save time". What is the best response?
   - A. Accept it, since the spoke user is already certified for S/4HANA
   - B. Accept it if the agent only reads data during working hours
   - C. Refuse it and create a new technical user for the agent with the same roles
   - D. Refuse it; use per-user calls on an endorsed path, with drafts for changes

   Answer: D. A reused integration user hides who asked and carries all its access, and an agent planning calls needs an endorsed path. A new technical user has the same identity problem.

6. A Workday HR agent wants to post hours for technician 00100094, who has left. Why does A10 refuse it even though the HR administrator is a valid SAP user?
   - A. The MCP gateway doesn't accept requests from HR systems
   - B. The posting is for a locked SAP user, and the gate checks that person too
   - C. Time postings can only be approved by the credit analyst who owns releases
   - D. ODP-RFC is the only route for HR data into SAP

   Answer: B. G2 checks the person a change is for as well as the person asking. A posting for a leaver is exactly the hire-to-retire error an agent must not automate.

7. Calder's CRM wants to change a customer contact person that lives only in the CRM. Where should approval happen?
   - A. In SAP, because SAP approvals always win over other platforms' approvals
   - B. In the CRM, because the CRM is the system of record for that data
   - C. In both systems, with SAP approving last
   - D. Nowhere, since contact data needs no approval

   Answer: B. The rule is to match the approver to the system of record for the thing being changed. When the CRM owns the data, its approval is the real one and SAP is only a requester.

8. Which platform protocol detail should you pin and retest when connecting ServiceNow agents to SAP over A2A?
   - A. The A2A version, since ServiceNow recommends v0.3 and plans v1.0
   - B. The CSRF token interval of the OData spoke
   - C. The MCP transport, since A2A messages always run on top of MCP
   - D. The IDoc version, since A2A messages travel to SAP as IDoc files

   Answer: A. ServiceNow's FAQ recommends A2A v0.3 and plans an update to v1.0. If one side moves and the other doesn't, calls fail, so pin the version and retest on change.

## Sources

- [Salesforce Launches Agentforce 3 (Salesforce press release, 23 June 2025)](https://www.salesforce.com/news/press-releases/2025/06/23/agentforce-3-announcement/): Opened 2026-11-25. Agentforce to include a native MCP client, listed under 'To Be Released Soon' for July 2025; MuleSoft MCP and A2A support listed as pilot or beta, 'generally available in July'; MuleSoft turns APIs into MCP servers; MCP traffic through an AI agent gateway. No SAP content. Current status not confirmed in this run
- [SAP S/4HANA integration solutions (MuleSoft, modified 2026-06-11)](https://www.mulesoft.com/integration/sap/s4hana): Opened 2026-11-25. OData connector for cloud and on-premise; SOAP connector; connectors support IDoc or BAPI over RFC; SAP ICC certified; Basic, OAuth 2.0 for delegated user authentication and X.509 certificates. No MCP, A2A or Agentforce content
- [Action Fabric: MCP Server, MCP Client, and A2A explained (ServiceNow Community, 16 June 2026, edited 30 July 2026)](https://www.servicenow.com/community/servicenow-otto-articles/action-fabric-mcp-server-mcp-client-and-a2a-explained/ta-p/3557794): Opened 2026-11-25. Action Fabric is ServiceNow's framework for connecting AI agents; components MCP Server Console, MCP Client, A2A; Console needs Zurich Patch 9 or Australia Patch 2; A2A authentication OAuth 2.0 or API key; AI Gateway governs MCP traffic, not A2A; update to A2A v1.0 planned; spokes are Flow Designer integrations to 200+ systems including SAP
- [Enable MCP and A2A for your agentic workflows, with FAQs (ServiceNow Community, 8 September 2025, edited 4 September 2026)](https://www.servicenow.com/community/now-assist-articles/introducing-ai-agent-fabric-enable-mcp-and-a2a-for-your-agentic/ta-p/3373907): Opened 2026-11-25. Zurich Patch 4: ServiceNow AI agent as MCP client, Now Assist MCP server, A2A protocol support; MCP client over Streamable HTTP (and SSE), authless, API key or OAuth 2.1; A2A v0.3 supported and recommended as of the December 2025 release, OAuth 2.0 or API key
- [SAP S4 HANA OData spoke (ServiceNow documentation, Brazil release, updated 12 March 2026)](https://www.servicenow.com/docs/r/integrate-applications/integration-hub/sap-s4-odata-spoke.html): Opened 2026-11-25. Built by Bristlecone; requires an Integration Hub subscription; v1.13.0, tested with SAP S/4HANA 2023; actions for purchase orders, suppliers, goods receipts, invoices and more; connection and credential aliases including OAuth; SAP spokes on the ServiceNow Store only since 1 March 2022
- [Connect External Agents to Workday Using A2A (Workday documentation, updated 2026-09-18)](https://doc.workday.com/admin-guide/en-us/workday-ai/agents/external-agents/connect-external-agent-to-workday-using-a2a.html): Opened 2026-11-25. External assistants (example Google Gemini Enterprise) call Workday's Self-Service Agent over A2A; client registered in the Agent System of Record; integration system user with an OAuth client; end users must belong to the assigned security groups
- [The Workday Agent System of Record Is Now Generally Available (Workday blog, 18 February 2026)](https://blog.workday.com/en-us/managing-ai-powered-future-of-work.html): Opened 2026-11-25. ASOR generally available; registry for Workday, customer and partner agents; Agent Gateway supports MCP and A2A; agents act on behalf of a user or as themselves under Workday's security model; interactions recorded
- [SAP API Policy v.4.2026a (SAP Help Portal, PDF)](https://help.sap.com/doc/sap-api-policy/latest/en-US/API_Policy_latest.pdf): Opened 2026-11-25. 1.1 Published APIs (Business Accelerator Hub or product Documentation); 1.2 non-published APIs must not be accessed; 2.2.2 bars API use by (semi-) autonomous or generative AI systems that plan, select or execute sequences of API calls, and large-scale extraction, except through SAP-endorsed architectures or pathways; 3 bars circumvention through proxies, gateways or impersonation
- [SAP API Policy overview (SAP slide deck for SAP user groups, 2026)](https://assets.dm.ux.sap.com/sap-user-groups/pdfs/260530_sap_api_policy_overview.pdf): Opened 2026-11-25. Policy published 27 April 2026; endorsed patterns include AI agent integration through A2A (Agent Gateway); FAQ: customers can use any third-party AI platform if it connects through an endorsed architecture using open protocols such as A2A and MCP; ODP-RFC the only unpermitted interface so far, opt-out until 31 December 2026
- [The Future of the Enterprise Is Autonomous (SAP News, 13 May 2026)](https://news.sap.com/2026/05/future-enterprise-autonomous/): Opened 2026-11-25. Joule's bi-directional A2A capabilities 'will be generally available in Q4' so third-party agents can call Joule Agents; Joule Studio agents to support A2A natively; SAP AI Agent Hub generally available as a command center for SAP and non-SAP agents and MCP servers
