# AI Agent Hub and agent governance: one register for every agent

> Keep one register of SAP and non-SAP agents, approve each with a named verifier, recertify on a clock and retire agents properly, using SAP AI Agent Hub.

- Course: Orchestrate, Unit 23 · Joule and the AI platform: the architect's view
- Page: https://erpfde.com/topics/ai-agent-hub-and-governance/
- Updated: 2026-11-29
- Reading time: Foundational 9 min, Deep 36 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

Companies now run agents from many places. SAP delivers some. Teams build others in Joule Studio. Sales builds a helper in Microsoft Copilot Studio, a developer runs a coding agent on a laptop, and a carrier's agent answers questions about trucks. Each one acts on business data.

**Agent governance** means knowing every agent, who owns it, what it may do, whether someone checked it, and when it should stop. It works like the user master for people: nobody gets access without an entry, an owner and an approval, and leavers lose access on a known date.

**SAP AI Agent Hub** is SAP's register for this. It finds agents across SAP and other vendors, gives each a fact sheet, records a verification decision, and feeds that decision to the places where agents actually run. It is built on SAP LeanIX.

The register only helps if three habits come with it:

1. **Nothing runs unverified.** A new or discovered agent waits until a named person checks it.
2. **Approvals expire.** Each verification has an end date, and the owner renews it with evidence.
3. **Retirement is a step, not a shrug.** An unused or orphaned agent loses its credentials and keeps its records.

This topic covers agents. The same idea for MCP servers, the tool side, is in [registering and approving MCP servers](https://erpfde.com/topics/registering-and-approving-mcp-servers-in-ai-agent-hub/).

### Why it matters to the business

**Agents you don't know about are still acting.** At Calder (the course's fictional pump maker), the first discovery run finds a Copilot Studio assistant that creates SAP sales quotations through a shared technical key. Nobody owns it and nobody approved it. The quotes are real. A register turns "we didn't know" into an inbox item with a deadline.

**Owners leave.** An agent built by a technician who left in October still runs, on credentials nobody watches. People's access is cut on their last day; agents need the same rule, tied to the owner's employment record.

**Audits and regulation ask for evidence.** The EU AI Act and internal audit both ask which AI systems you run, how risky each is and who signed off. A spreadsheet assembled the week before the audit rarely survives the first question. A register with dated verification records does.

**Cost and duplication.** Five teams building five invoice agents is waste. A register with business capabilities mapped shows the duplicates before the second one gets funded.

**Risk without a brake.** If an agent misbehaves, someone must be able to stop it fast. That needs to know where it runs and which credential to revoke. The register holds both. (Running the brake itself, the kill switch, is covered in [operating an agent fleet](https://erpfde.com/topics/operating-an-agent-fleet/).)

### How SAP does it

As read on SAP's and SAP LeanIX's pages on 29 November 2026:

| Piece | What it does | Status as SAP states it |
| --- | --- | --- |
| SAP AI Agent Hub | Register of agents, models and MCP servers from SAP and other vendors, with fact sheets, risk rating and a verification workflow ([product page](https://www.sap.com/products/artificial-intelligence/ai-agent-hub.html)) | Offered to more customers "through Joule Studio"; existing LeanIX customers keep access ([LeanIX update, 2 June 2026](https://updates.leanix.net/announcements/ann_Cfi5Rf9QFCfiJ)). No GA label on the pages read |
| Discovery | SAP agents, Joule Studio agents, agents on Azure, Google Cloud, AWS, ServiceNow and Databricks; local agents such as Claude Code "(in preview)" ([Architecture Center](https://architecture.learning.sap.com/docs/ref-arch/jfhsd9)) | Per source; Google's newer Agent Registry integration since 2 September 2026 ([update](https://updates.leanix.net/announcements/ann_CGDVnA0FPSnhi)) |
| Verification | Items start unverified; assessors mark them verified, rejected or unverified, with custom criteria ([update, 20 May 2026](https://updates.leanix.net/announcements/ann_NgnZHcpWeOwWH)) | Live per the update; on by default in workspaces created after 11 May 2026 |
| Joule Studio enforcement | "Only agents marked as verified" run in production in Joule Studio ([update, 2 June 2026](https://updates.leanix.net/announcements/ann_Cfi5Rf9QFCfiJ)) | Stated as current for Joule Studio agents |
| SAP Agent Gateway | Entry point for third-party agents calling SAP agents, with a per-consumer list of allowed agents ([Architecture Center news](https://architecture.learning.sap.com/news/2026/10/27/a2a-agent-gateway-interoperability)) | Inbound A2A generally available since October 2026; outbound "future" |
| Observability, identity and access control, agent mining | Listed as the hub's next steps ([update, 12 May 2026](https://updates.leanix.net/announcements/ann_PVw7IkOyWN6ma)) | Outlook; the Architecture Center describes them without status labels |

**Pricing.** In SAP LeanIX, the hub is an optional feature of Application Portfolio Management, priced by number of applications, and "five AI agents are equal to one application" ([LeanIX page](https://www.leanix.net/en/ai-agent-hub)). SAP's Architecture Center also says the hub is available standalone for customers without SAP LeanIX ([reference architecture](https://architecture.learning.sap.com/docs/ref-arch/98efa0)). Ask your account team which route your contract uses before you plan the budget.

> **Note** **For functional consultants.** Agents get owners the way roles do: usually the process owner of the process the agent works in. Expect three new jobs: naming the owner when an agent enters your process, renewing its verification with fresh test results (the same idea as role recertification), and adding the agent to the process's test cases and change impact list when the process changes.

### An agent's life on one page

SAP's Architecture Center describes five stages. The table shows what each means in practice and what the register holds afterwards.

| Stage (SAP's name) | What happens | Who decides | What the register holds |
| --- | --- | --- | --- |
| Define | The goal, allowed actions and governance needs are set before building | Owner with the enterprise architect | Planned fact sheet, owner, business capability |
| Verify | Risk classification, identity, permission scope, functional and resilience tests | An Agent Manager who is not the owner | Verification record: who, when, risk tier, EU AI Act class |
| Enforce | The agent goes live; identity and access policies, guardrails and limits apply; it can be suspended or revoked | Runtime: Joule Studio, Agent Gateway, MCP gateway | Status the runtimes read |
| Monitor | Usage and behavior watched; periodic access reviews and recertification | Owner, with the Agent Manager | Renewal dates, findings |
| Optimize | The agent is improved, or retired | Owner proposes, Agent Manager decides | Retirement record: credentials revoked, records kept |

```mermaid
flowchart LR
  D[Define] --> V[Verify]
  X[Discovered<br/>in the inbox] --> V
  V -->|verified| E[Enforce:<br/>live]
  V -->|rejected| R[Rejected]
  E --> M[Monitor]
  M -->|renewed| E
  M -->|suspended| S[Suspended]
  S --> V
  M --> O[Optimize<br/>or retire]
```

### Questions to ask

1. Which agents run on our data today, from every platform, and who owns each one? Show me the register, not a slide.
2. Who may mark an agent verified, and can an owner verify their own agent?
3. When does each verification run out, and what evidence renews it?
4. What happens to an agent when its owner leaves?
5. Which of our runtimes refuse an unverified agent today (Joule Studio, the Agent Gateway, our own gateway), and which don't?
6. How are discovered agents triaged, and within how many days?
7. Which route are we licensed for: SAP AI Agent Hub through Joule Studio, or the LeanIX Application Portfolio Management feature? How do agents count in that quote?
8. When we retire an agent, which credentials are revoked, and where are its records kept?

### Common misconceptions

- **"The register is the control."** A register is a list. The control is the runtime refusing what the register hasn't approved. Check which runtimes read the status.
- **"If SAP built the agent, it doesn't need verifying."** SAP-delivered agents still run on your data with your users' permissions. They get an owner and a verification like any other.
- **"Discovery finds everything."** Discovery finds agents on platforms with an integration. A bot on a developer's laptop or a vendor's agent you call needs to be registered by hand.
- **"Approval is a one-time event."** Models, prompts, tools and owners change. A verification without an end date becomes a rubber stamp.
- **"Retiring means switching it off."** An agent switched off but still holding credentials can be switched on again by anyone with the key. Retirement revokes the credentials and keeps the audit trail.

### Key terms

- **Agent register:** the list of every agent the company knows about, with owner, purpose, tools, state and verification.
- **SAP AI Agent Hub:** SAP's register of agents, models and MCP servers, built on SAP LeanIX.
- **Discovery inbox:** where agents found by integrations wait to be added to the register, linked to an existing entry, or rejected.
- **Fact sheet:** the register entry for one agent, holding identity, owner, capabilities, technology and governance status.
- **Verification:** a named person's dated decision that an agent may run, with its risk tier and evidence.
- **Agent Manager:** SAP's name for the role that verifies, activates and decommissions agents, typically an enterprise architect or IT governance lead.
- **Recertification:** renewing a verification before it runs out, with fresh evidence.
- **Retirement:** ending an agent's life: credentials revoked, integrations disabled, ownership of the records transferred, audit records kept.

### Check yourself

1. What turns an agent register into an actual control?
   - A. Listing every agent with a short description
   - B. Putting the register in SAP LeanIX instead of a spreadsheet
   - C. Runtimes refusing agents the register hasn't verified
   - D. Reviewing the register once a year with audit

   Answer: C. A register is a list until something enforces it. SAP says Joule Studio runs only verified agents in production, and the Agent Gateway checks an allow list on every call; other runtimes need the same rule.

2. Calder's first discovery run finds a Copilot Studio assistant creating SAP quotations through a shared key. What should happen first?
   - A. Leave it running, since the sales team already depends on it
   - B. Give it an owner and suspend it until it is verified
   - C. Delete its fact sheet so it leaves the register
   - D. Verify it at once so the audit list looks complete

   Answer: B. An unowned agent changing SAP data unverified is the case the register exists for. It gets an owner from the business, stops until checked, and comes back once it uses a proper route and approval step.

3. Why should the owner of an agent not verify it?
   - A. Owners don't have access to the register
   - B. SAP AI Agent Hub forbids owners from editing fact sheets
   - C. A check only counts if a second person makes it
   - D. Owners can't name a risk tier under the EU AI Act

   Answer: C. Verification is a four-eyes decision, like approving your own purchase order would be. The course uses an Agent Manager who isn't the owner, which matches SAP's description of that role.

4. An agent's owner left the company six weeks ago and the agent still runs. What does good governance require?
   - A. Nothing, as long as the agent hasn't caused problems
   - B. Waiting for the next annual review to decide
   - C. Moving the agent to the IT department's name
   - D. A new owner decides: keep and recertify, or retire it

   Answer: D. An agent without an active owner has nobody answering for it. A named business owner decides its future, and retirement revokes the credentials and keeps the records.

5. Why give each verification an end date?
   - A. Models, tools and owners change after the check
   - B. SAP charges for each day a verification is valid
   - C. The EU AI Act sets a fixed renewal period for every agent
   - D. Discovery removes agents whose verification has no date

   Answer: A. An approval describes the agent as it was when checked. A renewal date forces fresh evidence; the 180-day clock in this course is a course rule, not a legal or SAP figure.

6. What should a leader ask before budgeting for SAP AI Agent Hub?
   - A. How many MCP servers SAP has published this year
   - B. Whether Joule Studio agents need a separate register
   - C. Which public cloud hosts the LeanIX workspace
   - D. Which route our contract uses and how agents are counted

   Answer: D. LeanIX prices the hub feature by applications, with five agents counting as one, while SAP also offers it through Joule Studio and standalone. The account team confirms which applies to you.

## Deep layer

### Mental model

Treat agents like users with a lifecycle. A user has a master record, an owner (their manager), roles that were approved, a validity period and an end date. An agent needs the same five things: a register entry, a business owner, a reviewed set of tools and data, a verification that expires, and a retirement that removes access.

Two consequences follow:

- **The register is a state machine.** Each agent is in one state (defined, discovered, registered, verified, active, suspended, rejected, retired), and only certain decisions move it. "Activate" is refused without a valid verification; "verify" is refused when the owner tries it.
- **Enforcement lives elsewhere.** The register decides; runtimes enforce. Joule Studio, SAP Agent Gateway, your MCP gateway and your own services must read the state and refuse what isn't active. Governance fails at whichever runtime doesn't.

### How it works

#### Getting agents into the register

There are four ways in, and a complete register uses all of them:

| Path | What arrives | Source |
| --- | --- | --- |
| Discovery integrations | Joule Studio agents; Copilot Studio and Azure AI Foundry agents through Microsoft Entra ID; Google agents through the Agent Registry; ServiceNow agents; Databricks and AWS per SAP's pages | [LeanIX page](https://www.leanix.net/en/ai-agent-hub), [Architecture Center](https://architecture.learning.sap.com/docs/ref-arch/jfhsd9), [Google update](https://updates.leanix.net/announcements/ann_CGDVnA0FPSnhi) |
| Agent card API | Your own agents, posted as A2A agent cards to a REST API | [LeanIX page](https://www.leanix.net/en/ai-agent-hub) |
| Local discovery | Agents in developer environments such as Claude Code, in preview | [Architecture Center](https://architecture.learning.sap.com/docs/ref-arch/jfhsd9) |
| By hand | A planned SAP agent, a vendor's agent you call, anything without an integration | Your process |

Discovered agents land in the **discovery inbox**. There you add each one to the inventory as a new fact sheet (the AI Agent subtype of the application fact sheet), link it to an existing one, or reject it ([LeanIX update, November 2025](https://updates.leanix.net/announcements/ann_1GhIjDxh5q02M)). The ServiceNow integration brings name, description, role definition, active status and owner along ([update, 12 May 2026](https://updates.leanix.net/announcements/ann_PVw7IkOyWN6ma)).

An inbox without a deadline fills up. Set a triage limit (this course uses 14 days) and report what is older.

#### Verification

Since May 2026, a **verification field** replaces the earlier static approval state. Admins define criteria and statuses per asset type under *Administration > AI Governance Configuration*, and choose which fact sheet fields reviewers must check ([update, 20 May 2026](https://updates.leanix.net/announcements/ann_NgnZHcpWeOwWH)). The same update renamed two agent fields: "AI agent type" became **autonomy level** and "AI agent nature" became **build type**.

What a verification should check, from SAP's Verify stage: risk classification, identity and credentials, permission scope, and functional and resilience tests ([Architecture Center](https://architecture.learning.sap.com/docs/ref-arch/jfhsd9)). The EU AI Act risk assessment extension records the regulatory class. The course adds two rules SAP's pages don't state: the verifier isn't the owner, and the verification expires after 180 days.

#### Enforcement: who reads the status

```mermaid
flowchart LR
  H[SAP AI Agent Hub<br/>register and status] -->|verified only<br/>in production| JS[Joule Studio runtime]
  H -. policies .-> AG[SAP Agent Gateway]
  EXT[Copilot Studio agent] -->|A2A, consumer ACL| AG
  AG --> JA[Joule agents]
  H -. verified servers .-> MG[MCP gateway in<br/>Integration Suite]
  OWN[Your own agent<br/>on BTP] --> MG
  OWN -. your gate reads<br/>the register .-> H
```

- **Joule Studio** runs only verified agents in production, per the [June 2026 update](https://updates.leanix.net/announcements/ann_Cfi5Rf9QFCfiJ). How Joule Studio's environments and runtime are set up is in [Joule Studio architecture](https://erpfde.com/topics/joule-studio-architecture/).
- **SAP Agent Gateway** checks, on every inbound call, the caller's token, the tenant and an access control list of the SAP agents that consumer may invoke. Registering a consumer in SAP for Me grants nothing until the authorization step lists agents ([Architecture Center news, 27 October 2026](https://architecture.learning.sap.com/news/2026/10/27/a2a-agent-gateway-interoperability)). The Architecture Center calls the gateway the runtime enforcement point for policies defined in the hub; the pages read don't say how a hub status change reaches the gateway's list, so treat that link as something to test.
- **The MCP side** (verified servers only) is in the [MCP register topic](https://erpfde.com/topics/registering-and-approving-mcp-servers-in-ai-agent-hub/).
- **Your own agents** on BTP or elsewhere: nothing enforces the register unless your gateway or service reads it. That is the gap most landscapes have.

#### Identity

Registering an agent triggers an identity record in SAP Cloud Identity Services ([Architecture Center](https://architecture.learning.sap.com/docs/ref-arch/jfhsd9)). SAP describes two models: an agent acting in a user's context, or an autonomous agent with its own technical identity, and the effective permission is the intersection of user and agent permissions ([reference architecture](https://architecture.learning.sap.com/docs/ref-arch/98efa0)). An agent running on a shared technical user breaks both: you can't tell its actions from another tool's, and you can't revoke one without the other. The permission design itself is in [agent permissions and SAP authorizations](https://erpfde.com/topics/agent-permissions-and-sap-authorizations/).

#### Monitor and retire

SAP lists periodic access reviews, compliance recertification and risk-tier reassessment as recurring work ([Architecture Center](https://architecture.learning.sap.com/docs/ref-arch/jfhsd9)). Retirement there is "a governed process": credentials revoked, integrations disabled, ownership transferred, audit records preserved. The common failure is the half-retirement: status set to retired, credential still valid.

### Build it yourself

You will build Calder's agent register as the first governance board meeting finds it, check it against 13 rules, apply the board's decisions through a state machine that refuses illegal moves, and write a board pack. This is the same logic you will configure in SAP AI Agent Hub's verification fields; the file version makes every rule visible.

**Before you start:** complete [Set up your computer for this course](https://erpfde.com/topics/set-up-your-computer/) and [Set up for Unit 23](https://erpfde.com/topics/set-up-for-unit-23/). This script needs no account and no network.

```mermaid
flowchart LR
  I[--init] --> F[register.json, people.json,<br/>mcp_register.json, gateway_acl.json,<br/>decisions.json]
  F --> R[agent_register.py<br/>review: R01-R13]
  R --> P[board_pack.md]
  F --> A[--apply: decisions<br/>through the state machine]
  A --> H[history.jsonl]
  A --> R
```

> **Note** New words in this walkthrough:
> - **JSON:** a plain text format for structured data, with `{ }` for records and `[ ]` for lists. Every file here is JSON except the board pack.
> - **State machine:** a fixed list of states and the moves allowed between them. The script refuses any other move.
> - **Exit code:** a number a program returns when it ends. This script returns 2 when any rule fails, so a pipeline can stop on it.
> - **Append-only log:** a file you only add lines to, never edit. `history.jsonl` records every decision, including refused ones.

#### What you need

- Your course folder `orchestrate-course` with `.venv`.
- About 30 minutes.
- Cost: free. No account, no network, no model calls.

#### 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
     ```

4. Make sure the `unit23` folder exists. The command does nothing if it is already there.

   - **Windows (PowerShell):**

     ```powershell
     New-Item -ItemType Directory -Force unit23
     ```

   - **macOS / Linux:**

     ```bash
     mkdir -p unit23
     ```

#### Step 2: Create the script

1. In VS Code, create the file `unit23/agent_register.py`, paste the code below, and save.

```python
"""Keep Calder Pumpworks' agent register and check it the way an agent governance board would.

Run it from your course folder:
  python unit23/agent_register.py --init     write the register as the board finds it
  python unit23/agent_register.py            review the register against rules R01-R13
  python unit23/agent_register.py --apply    apply the board's decisions, then review again
Options:
  --today YYYY-MM-DD   the review date (default 2026-11-29)
  --folder PATH        where the files live (default unit23/agents)

Built-in modules only, no network, no randomness. Calder, its agents, people,
rules and decisions are course values. All fictional.
"""
import argparse
import json
import sys
from datetime import date, timedelta
from pathlib import Path

VALID_DAYS = 180       # course rule: a verification lasts 180 days
WARN_DAYS = 30         # course rule: warn 30 days before it runs out
INBOX_DAYS = 14        # course rule: triage the discovery inbox within 14 days
UNUSED_DAYS = 90       # course rule: propose retirement after 90 days unused
TIERS = {"LOW", "MEDIUM", "HIGH"}
EU_CLASSES = {"prohibited", "high-risk", "limited", "minimal"}

STATES = ["DEFINED", "DISCOVERED", "REGISTERED", "VERIFIED", "ACTIVE",
          "SUSPENDED", "REJECTED", "RETIRED"]
# Which state a decision may move an agent from, and to.
MOVES = {
    "register":  ({"DEFINED", "DISCOVERED"}, "REGISTERED"),
    "reject":    ({"DISCOVERED", "REGISTERED"}, "REJECTED"),
    "verify":    ({"REGISTERED", "SUSPENDED"}, "VERIFIED"),
    "activate":  ({"VERIFIED"}, "ACTIVE"),
    "recertify": ({"ACTIVE"}, "ACTIVE"),
    "suspend":   ({"DISCOVERED", "REGISTERED", "VERIFIED", "ACTIVE"}, "SUSPENDED"),
    "retire":    ({"REGISTERED", "VERIFIED", "ACTIVE", "SUSPENDED", "REJECTED"}, "RETIRED"),
    "update":    (set(STATES), None),
}
UPDATABLE = {"capability", "mcp_servers", "credentials_active",
             "integrations_active", "records_kept"}


def tool(name, kind, target="sap", approval="person"):
    return {"name": name, "kind": kind, "target": target, "approval": approval}


def verification(by, on, tier, eu):
    return {"by": by, "date": on, "tier": tier, "eu_ai_act": eu}


def agent(**fields):
    base = {
        "owner": None, "capability": None, "environment": "production",
        "observed_running": True, "identity": "agent-identity", "route": "internal",
        "tools": [], "mcp_servers": [], "verification": None, "last_used": None,
        "credentials_active": True, "integrations_active": True, "records_kept": True,
    }
    base.update(fields)
    return base


REGISTER = {
    "as_of": "2026-11-29",
    "agents": [
        agent(id="A01", name="AGT_INV_TRIAGE", source="joule-studio",
              discovered_via="joule-studio", first_seen="2026-05-18", state="ACTIVE",
              owner="00100244", capability="Invoice management",
              tools=[tool("supplier_invoice_get", "read"), tool("po_get", "read"),
                     tool("invoice_release_draft", "draft")],
              verification=verification("00100290", "2026-05-25", "MEDIUM", "minimal"),
              last_used="2026-11-27"),
        agent(id="A02", name="AGT_ORDER_EXC", source="joule-studio",
              discovered_via="joule-studio", first_seen="2026-10-12", state="REGISTERED",
              owner="00100296", capability="Sales order management",
              environment="test", observed_running=False,
              tools=[tool("get_sales_order", "read"), tool("draft_next_step", "draft")],
              mcp_servers=["calder-order-exc"], last_used="2026-11-26"),
        agent(id="A03", name="AGT_SUPPLY_WATCH", source="btp-custom",
              discovered_via="a2a-card-api", first_seen="2026-03-30", state="ACTIVE",
              owner="00100153", capability="Supply planning",
              tools=[tool("mrp_exceptions_get", "read"), tool("po_get", "read"),
                     tool("po_date_change_draft", "draft")],
              verification=verification("00100290", "2026-04-02", "MEDIUM", "minimal"),
              last_used="2026-11-27"),
        agent(id="A04", name="sales-quote-helper", source="copilot-studio",
              discovered_via="entra-id", first_seen="2026-11-05", state="DISCOVERED",
              identity="TU_COPILOT_MCP", route="shared-key",
              tools=[tool("get_price", "read"),
                     tool("create_sales_quotation", "write", approval="none")],
              last_used="2026-11-27"),
        agent(id="A05", name="copilot-cs-agent", source="copilot-studio",
              discovered_via="entra-id", first_seen="2026-11-02", state="ACTIVE",
              owner="00100296", capability="Sales order management",
              route="agent-gateway", calls=["AGT_ORDER_EXC"],
              verification=verification("00100292", "2026-11-20", "MEDIUM", "minimal"),
              last_used="2026-11-27"),
        agent(id="A06", name="AGT_REWORK_NOTES", source="copilot-studio",
              discovered_via="entra-id", first_seen="2026-02-09", state="ACTIVE",
              owner="00100094", capability="Production execution",
              tools=[tool("read_rework_notes", "read")],
              verification=verification("00100290", "2026-07-01", "LOW", "minimal"),
              last_used="2026-08-14"),
        agent(id="A07", name="dev-claude-code-00100288", source="local",
              discovered_via="local-preview", first_seen="2026-11-16", state="REGISTERED",
              owner="00100288", capability="Integration development",
              environment="development", observed_running=True, identity="user",
              tools=[tool("run_sql", "write", approval="none", target="sandbox")],
              mcp_servers=["calder-o2c-local", "community-erp-tools"],
              last_used="2026-11-27"),
        agent(id="A08", name="Dispute Creation Agent", source="sap-delivered",
              discovered_via="manual", first_seen="2026-11-28", state="DEFINED",
              owner="00100241", capability="Receivables management",
              environment="none", observed_running=False),
        agent(id="A09", name="carrier-eta-agent", source="external",
              discovered_via="manual", first_seen="2026-11-03", state="ACTIVE",
              owner="00100322", route="outbound",
              verification=verification("00100292", "2026-11-10", "LOW", "minimal"),
              last_used="2026-11-27"),
        agent(id="A10", name="AGT_PO_SCREEN_BOT", source="btp-custom",
              discovered_via="manual", first_seen="2026-06-15", state="RETIRED",
              owner="00100211", capability="Purchase order management",
              environment="none", observed_running=False, identity="TU_SCREEN_BOT",
              last_used="2026-10-30", credentials_active=True),
    ],
}

PEOPLE = {
    "active": ["00100153", "00100211", "00100241", "00100244", "00100266", "00100288",
               "00100290", "00100292", "00100296", "00100314", "00100322"],
    "left": {"00100094": "2026-10-16"},
    "governance": {"00100290": "Agent Manager (enterprise architect)",
                   "00100292": "Agent Manager (integration lead)"},
}

MCP_REGISTER = {
    "verified": ["calder-salesorders", "calder-order-exc"],
    "unverified": ["calder-o2c-local"],
    "rejected": ["community-erp-tools"],
}

GATEWAY_ACL = {"copilot-cs-agent": ["AGT_ORDER_EXC"]}

DECISIONS = {
    "meeting": "2026-11-29",
    "decisions": [
        {"id": "D01", "agent": "A04", "action": "register", "by": "00100290",
         "owner": "00100266", "capability": "Quote management"},
        {"id": "D02", "agent": "A04", "action": "suspend", "by": "00100290",
         "reason": "writes SAP quotations through a shared key; rebuild through the MCP gateway with OAuth per user"},
        {"id": "D03", "agent": "A02", "action": "verify", "by": "00100296",
         "tier": "MEDIUM", "eu_ai_act": "minimal"},
        {"id": "D04", "agent": "A02", "action": "verify", "by": "00100292",
         "tier": "MEDIUM", "eu_ai_act": "minimal"},
        {"id": "D05", "agent": "A02", "action": "activate", "by": "00100292"},
        {"id": "D06", "agent": "A01", "action": "recertify", "by": "00100290",
         "tier": "MEDIUM", "eu_ai_act": "minimal"},
        {"id": "D07", "agent": "A03", "action": "recertify", "by": "00100290",
         "tier": "MEDIUM", "eu_ai_act": "minimal"},
        {"id": "D08", "agent": "A06", "action": "retire", "by": "00100290",
         "transfer_to": "00100314"},
        {"id": "D09", "agent": "A07", "action": "update", "by": "00100292",
         "set": {"mcp_servers": ["calder-o2c-local"]}},
        {"id": "D10", "agent": "A10", "action": "update", "by": "00100292",
         "set": {"credentials_active": False, "integrations_active": False}},
    ],
}

FILES = {"register.json": REGISTER, "people.json": PEOPLE, "mcp_register.json": MCP_REGISTER,
         "gateway_acl.json": GATEWAY_ACL, "decisions.json": DECISIONS}


def d(text):
    return date.fromisoformat(text)


def unsafe_writes(a):
    """Names of tools that change SAP data without a person's approval."""
    return [t["name"] for t in a["tools"]
            if t["kind"] == "write" and t["target"] == "sap" and t["approval"] != "person"]


def review(reg, people, mcp, acl, today):
    """Return a list of (agent id, name, rule, level, message)."""
    out = []
    for a in reg["agents"]:
        def add(rule, level, msg):
            out.append((a["id"], a["name"], rule, level, msg))
        state = a["state"]
        live = a["observed_running"] and state not in {"SUSPENDED", "RETIRED", "REJECTED"}
        prod = live and a["environment"] == "production"
        v = a["verification"]

        if state == "RETIRED":                                         # R12
            loose = [k for k in ("credentials_active", "integrations_active") if a[k]]
            if loose:
                add("R12", "FAIL", "retired but still has " + " and ".join(loose))
            elif not a["records_kept"]:
                add("R12", "FAIL", "retired without keeping its records")
            else:
                add("R12", "OK", "retired: credentials revoked, records kept")
            continue

        if state == "DISCOVERED":                                      # R02
            age = (today - d(a["first_seen"])).days
            level = "FAIL" if age > INBOX_DAYS else "OK"
            add("R02", level, f"in the discovery inbox for {age} days (limit {INBOX_DAYS})")
        else:                                                          # R01
            owner = a["owner"]
            if owner is None:
                add("R01", "FAIL", "no owner")
            elif owner in people["left"]:
                add("R01", "FAIL", f"owner {owner} left on {people['left'][owner]}")
            elif owner not in people["active"]:
                add("R01", "FAIL", f"owner {owner} is not an active employee")
            else:
                add("R01", "OK", f"owner {owner}")

        if prod and state != "ACTIVE":                                 # R03
            add("R03", "FAIL", f"runs in production while {state}")
        elif state == "ACTIVE" and not v:
            add("R03", "FAIL", "ACTIVE without a verification record")
        elif state == "ACTIVE":
            add("R03", "OK", f"verified by {v['by']} on {v['date']}")

        if v:
            if v["by"] == a["owner"]:                                  # R04
                add("R04", "FAIL", "verified by its own owner")
            if v.get("tier") not in TIERS or v.get("eu_ai_act") not in EU_CLASSES:
                add("R05", "FAIL", "verification lacks a risk tier or EU AI Act class")
            ends = d(v["date"]) + timedelta(days=VALID_DAYS)           # R06
            left = (ends - today).days
            if left < 0:
                add("R06", "FAIL", f"verification ran out on {ends} ({-left} days ago)")
            elif left <= WARN_DAYS:
                add("R06", "WARN", f"verification runs out on {ends} ({left} days)")
            else:
                add("R06", "OK", f"verification valid to {ends}")

        for name in unsafe_writes(a):                                  # R07
            if live:
                add("R07", "FAIL", f"tool {name} changes SAP data without a person's approval")
            else:
                add("R07", "WARN", f"tool {name} must get an approval step before it returns")

        for s in a["mcp_servers"]:                                     # R08
            if s in mcp["rejected"]:
                add("R08", "FAIL", f"uses rejected MCP server {s}")
            elif prod and s not in mcp["verified"]:
                add("R08", "FAIL", f"uses unverified MCP server {s} in production")

        if a["source"] in {"copilot-studio", "external"} and a.get("calls"):   # R09
            allowed = acl.get(a["name"], [])
            missing = [c for c in a["calls"] if c not in allowed]
            if a["route"] != "agent-gateway" or missing:
                add("R09", "FAIL", "calls SAP agents outside the Agent Gateway ACL")
            else:
                add("R09", "OK", "calls " + ", ".join(a["calls"]) + " through the Agent Gateway")

        if live and a["identity"].startswith("TU_"):                   # R10
            add("R10", "FAIL", f"runs as shared technical user {a['identity']}")

        if live and a["last_used"]:                                    # R11
            idle = (today - d(a["last_used"])).days
            if idle > UNUSED_DAYS:
                add("R11", "WARN", f"unused for {idle} days: propose retirement")

        if state != "DISCOVERED" and not a["capability"]:              # R13
            add("R13", "WARN", "no business capability mapped")
    return out


def apply(reg, people, decisions, today, log, done):
    by_id = {a["id"]: a for a in reg["agents"]}
    lines = []
    for dec in decisions["decisions"]:
        if dec["id"] in done:
            lines.append(f"{dec['id']}: already in history.jsonl, skipped")
            continue
        a = by_id[dec["agent"]]
        frm, to = MOVES[dec["action"]]
        refused = None
        if a["state"] not in frm:
            refused = f"{dec['action']} is not allowed from {a['state']}"
        elif dec["action"] in {"verify", "recertify"} and dec["by"] == a["owner"]:
            refused = "the owner can't verify their own agent"
        elif dec["by"] not in people["governance"]:
            refused = f"{dec['by']} is not an Agent Manager"
        elif dec["action"] in {"verify", "recertify"}:
            if dec.get("tier") not in TIERS or dec.get("eu_ai_act") not in EU_CLASSES:
                refused = "a verification needs a risk tier and an EU AI Act class"
            elif unsafe_writes(a):
                refused = "a tool changes SAP data without a person's approval"
        elif dec["action"] == "activate":
            v = a["verification"]
            if not v or (d(v["date"]) + timedelta(days=VALID_DAYS)) < today:
                refused = "no valid verification"
        elif dec["action"] == "update" and not set(dec["set"]) <= UPDATABLE:
            refused = "update may only change " + ", ".join(sorted(UPDATABLE))
        if refused:
            lines.append(f"{dec['id']} {a['id']} {a['name']}: REFUSED ({refused})")
            log.append({"decision": dec["id"], "agent": a["id"], "result": "refused",
                        "reason": refused, "date": today.isoformat()})
            continue
        before = a["state"]
        act = dec["action"]
        if act == "register":
            a["owner"], a["capability"] = dec["owner"], dec["capability"]
        elif act in {"verify", "recertify"}:
            a["verification"] = verification(dec["by"], today.isoformat(),
                                             dec["tier"], dec["eu_ai_act"])
        elif act == "activate":
            a["environment"], a["observed_running"] = "production", True
        elif act == "suspend":
            a["credentials_active"], a["observed_running"] = False, False
            a["suspended_reason"] = dec["reason"]
        elif act == "retire":
            a["credentials_active"] = a["integrations_active"] = False
            a["observed_running"], a["records_kept"] = False, True
            a["owner"] = dec.get("transfer_to", a["owner"])
        elif act == "update":
            a.update(dec["set"])
        if to:
            a["state"] = to
        lines.append(f"{dec['id']} {a['id']} {a['name']}: {act} ({before} -> {a['state']})")
        log.append({"decision": dec["id"], "agent": a["id"], "action": act,
                    "from": before, "to": a["state"], "by": dec["by"],
                    "date": today.isoformat()})
    return lines


def write_pack(path, reg, findings, today):
    counts = {k: sum(1 for f in findings if f[3] == k) for k in ("OK", "WARN", "FAIL")}
    rows = ["| Agent | Name | State | Owner | Open findings |", "| --- | --- | --- | --- | --- |"]
    for a in reg["agents"]:
        open_ = [f"{f[2]} {f[3]}" for f in findings if f[0] == a["id"] and f[3] != "OK"]
        rows.append(f"| {a['id']} | {a['name']} | {a['state']} | {a['owner'] or '-'} | "
                    f"{', '.join(open_) or 'none'} |")
    text = [f"# Calder agent register review, {today}", "",
            f"{counts['OK']} OK, {counts['WARN']} WARN, {counts['FAIL']} FAIL.", "",
            *rows, "", "## Findings to decide", ""]
    text += [f"- {f[0]} {f[1]}: {f[2]} {f[3]}: {f[4]}" for f in findings if f[3] != "OK"] or ["- none"]
    text += ["", "Course values from synthetic data. All fictional.", ""]
    path.write_text("\n".join(text), encoding="utf-8")
    return counts


def main():
    p = argparse.ArgumentParser(description=__doc__.splitlines()[0])
    p.add_argument("--init", action="store_true", help="write the register files")
    p.add_argument("--apply", action="store_true", help="apply decisions.json, then review")
    p.add_argument("--today", default="2026-11-29")
    p.add_argument("--folder", default="unit23/agents")
    args = p.parse_args()
    folder, today = Path(args.folder), d(args.today)

    if args.init:
        folder.mkdir(parents=True, exist_ok=True)
        for name, data in FILES.items():
            (folder / name).write_text(json.dumps(data, indent=2) + "\n", encoding="utf-8")
        (folder / "history.jsonl").write_text("", encoding="utf-8")
        print(f"Wrote {len(FILES)} files and an empty history.jsonl to {folder}")
        return 0

    missing = [n for n in [*FILES, "history.jsonl"] if not (folder / n).exists()]
    if missing:
        print(f"Missing {', '.join(missing)} in {folder}. Run with --init first.")
        return 1
    load = lambda n: json.loads((folder / n).read_text(encoding="utf-8"))
    reg, people, mcp, acl = (load("register.json"), load("people.json"),
                             load("mcp_register.json"), load("gateway_acl.json"))

    if args.apply:
        log, history = [], folder / "history.jsonl"
        done = {json.loads(x)["decision"] for x in history.read_text(encoding="utf-8").splitlines() if x}
        for line in apply(reg, people, load("decisions.json"), today, log, done):
            print(line)
        (folder / "register.json").write_text(json.dumps(reg, indent=2) + "\n", encoding="utf-8")
        with history.open("a", encoding="utf-8") as fh:
            for entry in log:
                fh.write(json.dumps(entry) + "\n")
        print()

    findings = review(reg, people, mcp, acl, today)
    for aid, name, rule, level, msg in findings:
        if level != "OK":
            print(f"{level:4}  {aid} {name:26} {rule}  {msg}")
    counts = write_pack(folder / "board_pack.md", reg, findings, today)
    print(f"\n{counts['OK']} OK, {counts['WARN']} WARN, {counts['FAIL']} FAIL "
          f"on {len(reg['agents'])} agents as of {today}. Wrote {folder / 'board_pack.md'}")
    return 2 if counts["FAIL"] else 0


if __name__ == "__main__":
    sys.exit(main())
```

2. Nothing to add to `requirements.txt`: the script uses built-in modules only.

#### Step 3: Write the register as the board finds it

1. Run:

   ```bash
   python unit23/agent_register.py --init
   ```

2. You should see:

   ```text
   Wrote 5 files and an empty history.jsonl to unit23/agents
   ```

3. Open `unit23/agents/register.json`. Ten agents, all fictional:

| ID | Agent | Where it comes from | State | Owner |
| --- | --- | --- | --- | --- |
| A01 | `AGT_INV_TRIAGE` | Joule Studio | ACTIVE | `00100244` AP supervisor |
| A02 | `AGT_ORDER_EXC` | Joule Studio | REGISTERED (in test) | `00100296` sales operations manager |
| A03 | `AGT_SUPPLY_WATCH` | Custom on BTP, posted as an A2A card | ACTIVE | `00100153` planner |
| A04 | `sales-quote-helper` | Copilot Studio, found through Entra ID | DISCOVERED | none |
| A05 | `copilot-cs-agent` | Copilot Studio, calls `AGT_ORDER_EXC` | ACTIVE | `00100296` |
| A06 | `AGT_REWORK_NOTES` | Copilot Studio | ACTIVE | `00100094` (left 2026-10-16) |
| A07 | `dev-claude-code-00100288` | Local coding agent (preview discovery) | REGISTERED (development) | `00100288` integration developer |
| A08 | Dispute Creation Agent | SAP-delivered, planned | DEFINED | `00100241` AP accountant |
| A09 | `carrier-eta-agent` | A carrier's agent Joule calls | ACTIVE | `00100322` transport planner |
| A10 | `AGT_PO_SCREEN_BOT` | Custom screen bot | RETIRED | `00100211` buyer |

The other files hold the people (active and left), the MCP register from Unit 11 (`community-erp-tools` rejected), the Agent Gateway's consumer list, and the board's ten decisions.

#### Step 4: Review the register

1. Run:

   ```bash
   python unit23/agent_register.py
   ```

2. You should see nine failures and three warnings:

   ```text
   FAIL  A01 AGT_INV_TRIAGE             R06  verification ran out on 2026-11-21 (8 days ago)
   FAIL  A03 AGT_SUPPLY_WATCH           R06  verification ran out on 2026-09-29 (61 days ago)
   FAIL  A04 sales-quote-helper         R02  in the discovery inbox for 24 days (limit 14)
   FAIL  A04 sales-quote-helper         R03  runs in production while DISCOVERED
   FAIL  A04 sales-quote-helper         R07  tool create_sales_quotation changes SAP data without a person's approval
   FAIL  A04 sales-quote-helper         R10  runs as shared technical user TU_COPILOT_MCP
   FAIL  A06 AGT_REWORK_NOTES           R01  owner 00100094 left on 2026-10-16
   WARN  A06 AGT_REWORK_NOTES           R06  verification runs out on 2026-12-28 (29 days)
   WARN  A06 AGT_REWORK_NOTES           R11  unused for 107 days: propose retirement
   FAIL  A07 dev-claude-code-00100288   R08  uses rejected MCP server community-erp-tools
   WARN  A09 carrier-eta-agent          R13  no business capability mapped
   FAIL  A10 AGT_PO_SCREEN_BOT          R12  retired but still has credentials_active and integrations_active

   15 OK, 3 WARN, 9 FAIL on 10 agents as of 2026-11-29. Wrote unit23/agents/board_pack.md
   ```

3. The exit code is 2. Check it with `echo $LASTEXITCODE` (PowerShell) or `echo $?` (macOS/Linux).

> **Note** These counts come from synthetic Calder data and show the method, not results from a real SAP AI Agent Hub workspace.

The rules:

| Rule | Checks | Source |
| --- | --- | --- |
| R01 | Every agent past the inbox has an owner who is an active employee | SAP: every registered agent has an owner; the employment check is a course rule |
| R02 | Discovered agents are triaged within 14 days | Course rule |
| R03 | Nothing runs in production unless ACTIVE with a verification record | SAP: unverified agents stay pending; Joule Studio runs only verified agents |
| R04 | The verifier isn't the owner | Course rule |
| R05 | A verification records a risk tier and an EU AI Act class | SAP's risk assessment and EU AI Act extension; the labels are course labels |
| R06 | A verification lasts 180 days; warn 30 days before | SAP: recertification; the periods are course rules |
| R07 | A tool that changes SAP data needs a person's approval | Course rule (every course project) |
| R08 | Never a rejected MCP server; only verified ones in production | The Unit 11 MCP register |
| R09 | Third-party agents calling SAP agents go through the Agent Gateway and its consumer list | SAP Agent Gateway |
| R10 | Live agents don't run on a shared technical user | SAP: each agent has its own identity record; course rule |
| R11 | No use in 90 days: propose retirement | Course rule |
| R12 | Retired agents have credentials revoked and integrations disabled, records kept | SAP's retirement description |
| R13 | A business capability is mapped | SAP: fact sheets map capabilities |

#### Step 5: Read the board pack

1. Open `unit23/agents/board_pack.md`. It has one row per agent with its open findings, then the findings list. That is the agenda of the board meeting.

#### Step 6: Apply the board's decisions

1. Open `unit23/agents/decisions.json`. The board decided ten things: register the quote helper to inside sales rep `00100266` and suspend it until it is rebuilt with a proper route; verify and activate `AGT_ORDER_EXC`; recertify A01 and A03; retire A06 with its records transferred to production supervisor `00100314`; remove the rejected MCP server from the developer's agent; and finish A10's retirement.
2. Decision D03 is deliberate: the order agent's own owner tries to verify it.
3. Run:

   ```bash
   python unit23/agent_register.py --apply
   ```

4. You should see:

   ```text
   D01 A04 sales-quote-helper: register (DISCOVERED -> REGISTERED)
   D02 A04 sales-quote-helper: suspend (REGISTERED -> SUSPENDED)
   D03 A02 AGT_ORDER_EXC: REFUSED (the owner can't verify their own agent)
   D04 A02 AGT_ORDER_EXC: verify (REGISTERED -> VERIFIED)
   D05 A02 AGT_ORDER_EXC: activate (VERIFIED -> ACTIVE)
   D06 A01 AGT_INV_TRIAGE: recertify (ACTIVE -> ACTIVE)
   D07 A03 AGT_SUPPLY_WATCH: recertify (ACTIVE -> ACTIVE)
   D08 A06 AGT_REWORK_NOTES: retire (ACTIVE -> RETIRED)
   D09 A07 dev-claude-code-00100288: update (REGISTERED -> REGISTERED)
   D10 A10 AGT_PO_SCREEN_BOT: update (RETIRED -> RETIRED)

   WARN  A04 sales-quote-helper         R07  tool create_sales_quotation must get an approval step before it returns
   WARN  A09 carrier-eta-agent          R13  no business capability mapped

   21 OK, 2 WARN, 0 FAIL on 10 agents as of 2026-11-29. Wrote unit23/agents/board_pack.md
   ```

5. Open `unit23/agents/history.jsonl`. Ten lines, including the refused D03 with its reason. Run `--apply` again: every decision prints `already in history.jsonl, skipped`, because a decision is applied once.

The two warnings are accepted findings: the quote helper can't be verified until its write tool has an approval step (the script refuses that verification), and the carrier's agent belongs to another company, so its capability mapping is a decision for the transport planner.

#### Step 7: Try a date

1. Run the review as if it were 20 December:

   ```bash
   python unit23/agent_register.py --today 2026-12-20
   ```

2. Still `0 FAIL`: the recertifications made on 29 November run to 2027-05-28. The `last_used` dates in the file don't move, so a date more than 90 days ahead raises R11 warnings for every live agent. That is the lab file, not a finding.

#### How the script works

| Part | What it does |
| --- | --- |
| `REGISTER`, `PEOPLE`, `MCP_REGISTER`, `GATEWAY_ACL`, `DECISIONS` | The course data `--init` writes to `unit23/agents/` |
| `MOVES` | The state machine: from which states each decision is allowed, and to which state it leads |
| `review()` | Applies rules R01 to R13 to each agent and returns `(agent, name, rule, level, message)` rows |
| `unsafe_writes()` | Lists tools that change SAP data without a person's approval (R07, and a reason to refuse verification) |
| `apply()` | Checks each decision (allowed move, four eyes, Agent Manager, tier and EU class, valid verification), applies it or refuses it, and logs both |
| `write_pack()` | Writes `board_pack.md` with counts, one row per agent and the open findings |
| `main()` | Reads options, loads the files, runs apply and review, returns exit code 2 on any FAIL |

#### If something goes wrong

| What you see | What it means | What to do |
| --- | --- | --- |
| `python` is not recognized, or `command not found` | Python isn't installed or the virtual environment is off | Turn on `.venv` (Step 1); see [Set up your computer](https://erpfde.com/topics/set-up-your-computer/) |
| `can't open file ... agent_register.py` | You're in another folder, or the file has another name | Run from `orchestrate-course`; check the file is `unit23/agent_register.py` |
| `Missing register.json ... Run with --init first.` | The data files don't exist yet | Run Step 3 |
| `json.decoder.JSONDecodeError` | A JSON file was edited and has a missing comma or quote | Undo the edit, or delete `unit23/agents` and run `--init` again |
| `KeyError: 'A11'` | A decision names an agent that isn't in `register.json` | Add the agent first, or fix the ID |
| Every decision says `already in history.jsonl, skipped` | You already applied them | Expected; to start over, delete `unit23/agents` and run `--init` |
| `ModuleNotFoundError` | The script was changed to import a library | It needs built-in modules only; undo the import |
| Network, proxy or missing key errors | Not possible from this script | It makes no network calls and needs no key; check you ran the right file |

### The SAP way

As read on 29 November 2026. The steps below are a **sketch**: they need an SAP LeanIX workspace or the hub through Joule Studio, which this course doesn't provide.

> **Note** These steps need access to SAP AI Agent Hub (an SAP LeanIX workspace with Application Portfolio Management, or the hub through Joule Studio) and admin rights there. The course doesn't provide that access, and no trial for the hub was checked in this run; the lab above teaches the same rules without it.

1. **Turn it on.** An admin activates the optional AI Agent Hub feature and configures the discovery integrations; the meta model extension (the AI Agent fact sheet subtype and an MCP server interface subtype) works without discovery ([LeanIX update, November 2025](https://updates.leanix.net/announcements/ann_1GhIjDxh5q02M)). The evolved AI governance extension is on by default in workspaces created after 11 May 2026; older workspaces activate it under optional features ([update, 20 May 2026](https://updates.leanix.net/announcements/ann_NgnZHcpWeOwWH)).
2. **Connect discovery.** Joule Studio, Microsoft Entra ID, Google's Agent Registry (preferred over the older per-project Agent Engine integration since September 2026), ServiceNow, SAP AI Core for model deployments, and the A2A agent card API for your own agents ([LeanIX page](https://www.leanix.net/en/ai-agent-hub), [Google update](https://updates.leanix.net/announcements/ann_CGDVnA0FPSnhi), [May update](https://updates.leanix.net/announcements/ann_PVw7IkOyWN6ma)).
3. **Define verification.** Under *Administration > AI Governance Configuration*, set the criteria and statuses for agents, models and MCP servers, the fields reviewers must check, and turn on the badge. Map R03 to R07 of the lab here.
4. **Assign roles.** Name the Agent Managers (SAP: typically an enterprise architect or IT governance lead) and use fact sheet responsibilities for owners. Keep the owner and the verifier different by process; the pages read don't say the hub enforces that.
5. **Connect enforcement.** Joule Studio reads the badge. For the Agent Gateway, register each external client as an Agent Gateway Consumer in SAP for Me and list the allowed SAP agents in the authorization step ([Architecture Center news](https://architecture.learning.sap.com/news/2026/10/27/a2a-agent-gateway-interoperability)). For your own runtimes, read the register in your gateway.
6. **Plan the cadence.** Recertification dates, inbox triage and retirement reviews aren't scheduled by anything on the pages read. Put them in the board's calendar.

**What is outlook, not product, on the pages read:** observability with Cloud ALM session drill-down, identity and access control on Cloud Identity Services, agent mining with Signavio and org mapping with SuccessFactors are listed as next steps in the [May 2026 update](https://updates.leanix.net/announcements/ann_PVw7IkOyWN6ma). The Architecture Center describes the same pieces without status labels, and SAP's [reference architecture](https://architecture.learning.sap.com/docs/ref-arch/98efa0) says some of its components aren't GA yet. The AI governance assistant is marked "in preview".

**Licensing:** in SAP LeanIX, an optional feature of Application Portfolio Management priced by applications, five agents counting as one ([LeanIX page](https://www.leanix.net/en/ai-agent-hub)); also offered through Joule Studio and standalone ([update, 2 June 2026](https://updates.leanix.net/announcements/ann_Cfi5Rf9QFCfiJ), [reference architecture](https://architecture.learning.sap.com/docs/ref-arch/98efa0)). No price is stated on the pages read.

### Build vs. SAP

| Need | A register file in Git (this lab) | SAP AI Agent Hub | Choose |
| --- | --- | --- | --- |
| A handful of agents on one platform | Enough, and every rule is visible | More than you need | File, with a date to move |
| Agents on SAP, Microsoft, Google and ServiceNow | You find them by asking around | Discovery finds them | Hub |
| Joule Studio refusing unverified agents | Not possible | The badge does it | Hub |
| Rules the product doesn't enforce (four eyes, owner employment, expiry) | Code them | Process, or a check over an export | Both: the hub holds the record, a check reads it |
| Audit evidence | Git history and `history.jsonl` | Fact sheet history and verification records | Hub for the system of record |
| Your own gateway's allow list | Read the file | Read the hub (integration to build) | Whichever is the system of record |

### Architecture view

**Where it sits.** The register sits beside the runtimes, not in their path. Joule Studio and the Agent Gateway run in SAP's AI platform on BTP; Calder's own agents run in its BTP subaccounts and in Microsoft and Google tenants. Discovery pulls from them; enforcement points read status back (diagram in **How it works**).

**Non-functional requirements.**

| Requirement | Typical target | If missed |
| --- | --- | --- |
| Completeness | Every agent on a discoverable platform in the register within 14 days | Shadow agents act on SAP data |
| Timeliness of status | A suspension reaches every runtime the same day | A suspended agent keeps running |
| Evidence retention | Verification and retirement records kept as long as audit logs | No answer at audit |
| Separation of duties | Owner and verifier always different | Self-approval |
| Cost | Counted in the LeanIX quote (five agents per application) or the Joule Studio route | Surprise at renewal |

**Integration and identity.** Discovery uses each platform's integration (Entra ID, Google Agent Registry, ServiceNow, Joule Studio) or the agent card API. Agent identities live in SAP Cloud Identity Services; external agents reach Joule agents through the Agent Gateway's consumer formations, with tasks running within the signed-in user's authorizations. The identity mapping for external platforms is in [Joule beside other assistants](https://erpfde.com/topics/joule-and-other-assistants/) and [A2A for SAP agents](https://erpfde.com/topics/a2a-for-sap-agents/).

**The decision to record** (short ADR form from [the design-doc topic](https://erpfde.com/topics/writing-a-solution-design-doc/)):

- **Context:** Calder runs ten agents across Joule Studio, BTP, Copilot Studio, a laptop and a carrier. The [MCP register topic](https://erpfde.com/topics/registering-and-approving-mcp-servers-in-ai-agent-hub/) already chose SAP AI Agent Hub for MCP servers. Calder doesn't license the full SAP LeanIX suite (course assumption).
- **Options:** A) a register file in Git with a check in CI; B) SAP AI Agent Hub as the system of record, through the route Calder's contract covers; C) each platform's own registry (Joule Studio, Entra ID, Google Agent Registry) with no central list.
- **Decision:** B, with the lab's rules R01, R04, R06 and R11 run weekly over an export until the hub covers them. Option A stays as the fallback until the contract route is confirmed.
- **Consequences:** discovery replaces asking around; Joule Studio enforces verification; Calder's own gateway must read the hub's status, which is an integration to build; the board must own the cadence the product doesn't schedule.

**What a design review will ask.**

1. Which runtimes refuse an unverified or suspended agent, and how fast does a status change reach each?
2. How do you stop an owner verifying their own agent?
3. What happens to an agent the day its owner leaves?
4. Which agents can't be discovered, and who registers them?
5. Is the retirement record proof that the credential was revoked, or only a status?

### Production concerns

- **Security and authorizations.** A verification approves a scope, not a name. Record the tools, the roles behind the agent's identity and the data it touches, and re-verify when any of them change. Never let an agent run on a shared technical user; see [agent permissions and SAP authorizations](https://erpfde.com/topics/agent-permissions-and-sap-authorizations/).
- **Evaluation.** Renewal evidence is a fresh test run, not a signature. Link the evaluation set and its result to the verification record.
- **Cost.** Count agents in the LeanIX quote; local and test agents count too once they become fact sheets. Retiring unused agents keeps the count honest.
- **Operations.** Give the board a calendar: inbox triage weekly, recertifications from a due list, retirement proposals monthly. Running the fleet (metering, tracing, the kill switch) is covered in [operating an agent fleet](https://erpfde.com/topics/operating-an-agent-fleet/).
- **Clean core.** The register lives outside S/4HANA and needs nothing in it. Agents reach S/4HANA only through released APIs and the gateways; see [SAP API policy and third-party agents](https://erpfde.com/topics/sap-api-policy-and-third-party-agents/).

### Where AI fits

AI changes this subject in two ways. First, agents are the governed thing: each is one more consumer of SAP data with a lifecycle to manage, which is the whole topic. Second, SAP is adding AI to the governance work itself: the Architecture Center lists an AI governance assistant, in preview, to help with assessments. Use it to draft an assessment, never to approve one: the verification stays a named person's decision. The wider programme view is in [AI governance for SAP programs](https://erpfde.com/topics/ai-governance-for-sap-programs/), and LeanIX's AI features beyond the hub are in [Signavio and LeanIX AI](https://erpfde.com/topics/signavio-and-leanix-ai/).

### Pitfalls

- **A register nobody enforces.** Agents are listed; runtimes ignore the status. Name each runtime that reads it.
- **Owners who are teams or mailboxes.** A team can't recertify. Name a person and a deputy.
- **Verifications without expiry.** A badge from May proves nothing about December's prompt and tools.
- **The inbox as a graveyard.** Discovery without triage just documents shadow agents. Set a limit and report the backlog.
- **Half-retirement.** Status retired, credential alive. Retire by revoking first, then changing the status.
- **Treating SAP-delivered agents as pre-approved.** They run on your data and your users' permissions; they get an owner and a verification.
- **Planning on outlook items.** Observability, identity and access control and agent mining are listed as next steps; check their status in the run that plans on them.

### Exercise

Quality wants the inspection lot agent `AGT_QM_WATCH` live, and the board adds a rule: HIGH-tier verifications last 90 days, not 180.

1. In `unit23/agents/register.json`, add this block to the `"agents"` list after A10 (put a comma after A10's closing `}`):

   ```json
   {
     "id": "A11", "name": "AGT_QM_WATCH", "source": "joule-studio",
     "discovered_via": "joule-studio", "first_seen": "2026-11-27", "state": "DISCOVERED",
     "owner": null, "capability": null, "environment": "test", "observed_running": false,
     "identity": "agent-identity", "route": "internal",
     "tools": [
       {"name": "inspection_lot_get", "kind": "read", "target": "sap", "approval": "person"},
       {"name": "usage_decision_draft", "kind": "draft", "target": "sap", "approval": "person"}
     ],
     "mcp_servers": [], "verification": null, "last_used": "2026-11-28",
     "credentials_active": true, "integrations_active": true, "records_kept": true
   }
   ```

2. Add quality engineer `"00100326"` to the `"active"` list in `people.json`.
3. Add these three decisions to the end of the `"decisions"` list in `decisions.json`:

   ```json
   {"id": "D11", "agent": "A11", "action": "register", "by": "00100292",
    "owner": "00100326", "capability": "Quality inspection"},
   {"id": "D12", "agent": "A11", "action": "verify", "by": "00100292",
    "tier": "HIGH", "eu_ai_act": "minimal"},
   {"id": "D13", "agent": "A11", "action": "activate", "by": "00100292"}
   ```

4. In the script, add this line under `VALID_DAYS = 180`:

   ```python
   HIGH_DAYS = 90         # exercise: a HIGH-tier verification lasts 90 days
   ```

   Then, in `review()`, replace the line `ends = d(v["date"]) + timedelta(days=VALID_DAYS)` with these two lines (same indentation):

   ```python
   days = HIGH_DAYS if v["tier"] == "HIGH" else VALID_DAYS
   ends = d(v["date"]) + timedelta(days=days)
   ```
5. Run `--apply`. D01 to D10 are skipped; D11 to D13 apply.
6. Run the review with `--today 2027-02-28`.

**Done when:** step 5 ends with `24 OK, 2 WARN, 0 FAIL on 11 agents as of 2026-11-29`, and step 6 shows A11 failing R06 (`verification ran out on 2027-02-27 (1 days ago)`) as the only failure, ending `23 OK, 9 WARN, 1 FAIL on 11 agents as of 2027-02-28` (the R11 warnings are expected, since `last_used` dates don't move). Keep `unit23/agents/`: the next Unit 23 topic, on operating an agent fleet, adds metering and a kill switch to this register.

### Check yourself

1. In the lab, why is "activate" refused for an agent in the REGISTERED state?
   - A. REGISTERED agents have no owner, so activation has no approver
   - B. Only VERIFIED agents with a valid check become ACTIVE
   - C. The Agent Gateway hasn't listed the agent yet
   - D. Activation needs the EU AI Act class high-risk

   Answer: B. `MOVES` allows activate only from VERIFIED, and `apply()` also checks that the verification hasn't run out. That mirrors SAP's statement that unverified agents stay pending and Joule Studio runs only verified ones.

2. Decision D03 has the order agent's owner verify it. What does the script do, and why?
   - A. Applies it, because the owner is a manager
   - B. Applies it but marks the finding R04 as a warning
   - C. Deletes the agent from the register
   - D. Refuses it and logs the reason in history.jsonl

   Answer: D. The owner check comes first for verify and recertify, so the move is refused and recorded with its reason. A refused decision is evidence too, which is why the log is append-only.

3. A Copilot Studio agent calls Joule agents. What must be true for it to pass R09?
   - A. It goes through the Agent Gateway and its ACL names those agents
   - B. It has an API key for the S/4HANA system it reads
   - C. It is registered as an Agent Gateway Consumer in SAP for Me only
   - D. Its fact sheet lists Copilot Studio as the build type

   Answer: A. SAP's gateway checks token, tenant and an ACL on every call, and registering a consumer grants nothing by itself. The lab compares the agent's calls with `gateway_acl.json`.

4. Why does the lab flag A10, already RETIRED, as a failure?
   - A. Its owner left the company
   - B. It was retired without any decision by the board
   - C. Its credentials and integrations are still active
   - D. Retired agents must be deleted from the register

   Answer: C. SAP describes retirement as revoking credentials, disabling integrations and keeping records. A status change alone leaves a working key behind, which is the half-retirement pitfall.

5. Where does SAP say the verification status is enforced today, on the pages read?
   - A. In every runtime that has a discovery integration
   - B. In Joule Studio, which runs only verified agents in production
   - C. In S/4HANA, which checks the badge before each API call
   - D. In Microsoft Entra ID, which blocks every unverified Copilot agent

   Answer: B. The June 2026 LeanIX update states the Joule Studio rule. Other runtimes, including your own gateway, enforce only what you build or test.

6. You run the review on a date four months ahead and every live agent shows R11. What is the right reading?
   - A. All agents should be retired at the next board
   - B. The R11 rule is wrong and should be removed
   - C. The register needs a new discovery run first
   - D. The lab's last_used dates are frozen, so R11 is expected

   Answer: D. R11 compares `last_used` with `--today`, and the lab file never updates `last_used`. In a real register those dates come from usage data, so R11 would only flag agents truly idle.

7. The board adds an agent at tier HIGH. Which change does the exercise make, and why there?
   - A. A new state HIGH_RISK in MOVES
   - B. A second verifier field on the decision
   - C. A 90-day validity in rule R06 for HIGH-tier verifications
   - D. A refusal of HIGH-tier agents in apply()

   Answer: C. Expiry is R06's job, so a shorter clock for riskier agents belongs there. On 2027-02-28 the HIGH-tier agent fails while the 180-day verifications still pass.

## Sources

- [SAP AI Agent Hub (SAP Architecture Center, updated 19 October 2026)](https://architecture.learning.sap.com/docs/ref-arch/jfhsd9): read 2026-11-29; discovery of SAP agents (standard, Joule Studio, partner), third-party agents on Azure, Google Cloud, AWS, ServiceNow and Databricks, local agents incl. Claude Code (in preview), MCP servers via Integration Suite and MCP Builder, LLMs via AI Core; fact sheets with identity, ownership, capabilities, technology stack and governance status; stages Define, Verify, Enforce, Monitor, Optimize; unverified agents stay pending; registration triggers an agent identity record in SAP Cloud Identity Services; Agent Manager (typically an enterprise architect or IT governance lead) verifies, activates and decommissions; EU AI Act risk assessment extension; AI governance assistant in preview; periodic access reviews and compliance recertification; retirement revokes credentials, disables integrations, transfers ownership, keeps audit records; SAP Agent Gateway as runtime enforcement point; no GA labels for most components
- [SAP AI Agent Hub (SAP product page)](https://www.sap.com/products/artificial-intelligence/ai-agent-hub.html): read 2026-11-29, no page date; vendor-agnostic command center for agents, LLMs and MCP servers; registry discovers assets from SAP, Microsoft, Google, AWS, Databricks and ServiceNow; AI risk rating, build type, architecture decisions and compliance mappings; formal verification workflow; only verified MCP servers in production workflows, access revoked when status changes; no licensing or availability statement
- [AI agent hub in SAP LeanIX (leanix.net)](https://www.leanix.net/en/ai-agent-hub): read 2026-11-29, no page date; discovery inbox, then inventory or link to existing fact sheets; AI agents a subtype of application; AI Agent Radar tracks approval status for promotion or removal; FAQ: sources SAP (Joule Studio), Google Agent Engine, Microsoft Entra ID (Copilot Studio, Azure AI Foundry), REST API for A2A agent cards; optional feature of SAP LeanIX Application Portfolio Management, priced by applications; five AI agents equal one application; MCP servers listed as coming
- [Empower AI governance with the AI Agent Hub (SAP LeanIX product updates, 6 November 2025)](https://updates.leanix.net/announcements/ann_1GhIjDxh5q02M): read 2026-11-29; discovered agents land in an inbox and import as the AI Agent subtype of the application fact sheet; admin activates the optional AI Agent Hub feature and configures discovery integrations; meta model extension works without discovery; available in all workspaces without an additional commercial product; five AI agent fact sheets count as one application
- [Discover, verify, and govern AI assets with SAP AI Agent Hub (SAP LeanIX product updates, 12 May 2026)](https://updates.leanix.net/announcements/ann_PVw7IkOyWN6ma): read 2026-11-29; renamed SAP AI Agent Hub; offered to more SAP customers through Joule Studio; ServiceNow agent discovery (name, description, role definition, active status, owner) and SAP AI Core model deployments; items start unverified and are marked verified, rejected or unverified with an optional badge; Joule Studio runtime can use the badge; outlook: observability via Cloud ALM, identity and access control on Cloud Identity Services, agent mining via Signavio, org and skills mapping via SuccessFactors
- [Govern and verify AI assets with an evolved extension (SAP LeanIX product updates, 20 May 2026)](https://updates.leanix.net/announcements/ann_NgnZHcpWeOwWH): read 2026-11-29; verification field with custom criteria and statuses per asset replaces the static approval state; Administration > AI Governance Configuration enables the badge for agents, MCP servers and models; on by default in workspaces created after 11 May 2026; 'AI agent type' renamed autonomy level, 'AI agent nature' renamed build type
- [Product update - May 2026 (SAP LeanIX product updates, 2 June 2026)](https://updates.leanix.net/announcements/ann_Cfi5Rf9QFCfiJ): read 2026-11-29; 'only agents marked as verified are authorized to run in production environments in Joule Studio'; badge for MCP servers through Integration Suite described with 'will'; available to a broader customer base through Joule Studio; no GA wording
- [Get a complete inventory of your Google Cloud AI assets with one integration (SAP LeanIX product updates, 2 September 2026)](https://updates.leanix.net/announcements/ann_CGDVnA0FPSnhi): read 2026-11-29; Google Agent Registry integration discovers agents and MCP servers across Google Cloud projects, replacing the per-project Agent Engine integration; inbox items linked, created or rejected; fact sheets used to assign ownership and assess risk
- [Third-party agents can now interoperate with SAP Agents via the Agent Gateway (SAP Architecture Center news, 27 October 2026)](https://architecture.learning.sap.com/news/2026/10/27/a2a-agent-gateway-interoperability): read 2026-11-29; October 2026 GA of inbound A2A; external client registered in SAP for Me as an Agent Gateway Consumer, which grants no access by itself; identity, trust and authorization formations; ACL of SAP agents the consumer may invoke, changeable without onboarding again; every call checks token, tenant and ACL; tasks run within the signed-in user's authorizations; outbound A2A and MCP future
- [Agentic AI & AI Agents on SAP Business AI Platform (SAP Architecture Center, updated 26 October 2026)](https://architecture.learning.sap.com/docs/ref-arch/98efa0): read 2026-11-29; some components not yet GA; Agent Gateway handles authentication, principal propagation, policy enforcement and tenancy; AI Agent Hub available standalone for customers without SAP LeanIX; Cloud Identity Services as identity hub, agents in a user's context or with their own technical identity; effective permission is the intersection of user and agent permissions; Joule Studio agents automatically registered with Joule
