Orchestrate

Report an issue

Something wrong, out of date or unclear? Tell us. Corrections are prioritized over new topics. You don't need to sign in.

0 / 2000

Don't include personal or confidential company details. Reports are reviewed with AI assistance.

SAP AI Core and AI Launchpad for architects: tenancy, isolation and what you operate

Decide how many SAP AI Core instances you need, how to split workloads into resource groups, which region each uses, and who may change production.

Updated Nov 29, 2026
Foundational layer · 8 min read

The 60-second version

SAP AI Core is the service on SAP BTP that runs AI for you: it gives your apps access to the large language models in the generative AI hub, and it trains and serves models you bring yourself. SAP AI Launchpad is the web application people use to manage it: connect to AI Core, look at deployments, try prompts.

When a company buys AI Core, it creates one or more instances. Each instance is a tenant: its own sign-in, its own limits, its own bill lines. Inside a tenant, resource groups keep one workload's deployments and settings apart from another's.

The architect's decisions are few but lasting: how many instances, which workload gets which resource group, which region each runs in, and who may change production. Get them wrong and the result is one agent starving another of capacity, a developer key that reaches production, or EU data processed in the US.

Why it matters to the business

  • Capacity is shared until you split it. SAP limits requests per minute per model for the whole tenant, and every resource group shares that limit unless you request one per group (Rate Limit Management). At month end one busy agent can block the others.
  • A key opens the whole tenant. Access to AI Core is granted per tenant, through the instance's service key; the resource group is only a header in each request (Multitenancy). A developer resource group inside the production tenant means developers hold a production key.
  • Region decides where data goes. SAP's model table marks some models "Yes*" in a region: available, but possibly served from a data center elsewhere (Model Availability by Region). For data that must stay in the EU, that is a compliance question, not a technical detail.
  • Cost is easier to see when split. SAP's consumption report shows generative AI use per resource group (Metering and Pricing for SAP AI Core). One group per agent gives the finance team cost per agent without extra tooling.

At the fictional Calder Pumpworks, three agents and a nightly batch job all ran in one resource group of one production instance. On the last working day of October the order exceptions agent used the whole per-minute limit and the invoice triage agent got errors. The same design put Augsburg's invoices, from the German company CP20, through a US instance.

How SAP does it

As read in SAP's documentation on 29 November 2026:

  • SAP AI Core service plans. Standard for production without generative AI, Extended for production with the generative AI hub. Both need an enterprise account and come with SAP support and an SLA. You can upgrade from Standard to Extended but not back (Service Plans). The free plan was discontinued on 22 May 2026; a 30-day trial remains for trying the generative AI hub (What's New).
  • Tenants and resource groups. Each instance is a tenant with a default resource group that can't be deleted, and up to 50 resource groups unless you ask for more. Deployments, configurations and executions belong to one group; templates and Docker registry secrets are shared across the tenant (Manage Resource Groups).
  • Regions. Which BTP regions offer AI Core is listed in SAP Discovery Center. Which models and generative AI features each region has is in SAP's model and feature tables, which SAP maintains "on a best-effort basis"; the model list of your own tenant is the authority.
  • SAP AI Launchpad. A multitenant SaaS application on BTP, subscribed per subaccount, that connects to one or more AI runtimes such as AI Core. Its Standard plan charges a fixed price each month for every subaccount and includes the generative AI hub (Launchpad Service Plans). SAP's tutorial calls it optional but recommended.
  • Pricing. Generative AI is billed by tokens converted into capacity units; your own models by node hours, storage and an hourly baseline of up to 730 hours a month (Metering and Pricing for Custom AI). Commercial models across SAP's AI offerings are the subject of Unit 23's topic on AI Units.

Who runs what

SAP operates the service; you operate everything you create in it. This split is the one to agree with your operations team before go-live.

Area SAP Your team
Clusters, hosting, model access, platform patching Runs them, under the service SLA Nothing
Instances, subaccounts and region Offers them per region Chooses how many, where, on which plan
Resource groups and deployments Provides the API and limits Creates, names, owns and deletes them
Model versions Publishes versions and retirement dates Pins or follows "latest", tests before switching
Rate limits Sets defaults, approves increases Measures peaks, requests limits per group
Credentials Issues service keys Stores and rotates them
Your own models and data Runs the containers it is given Builds the images, owns the object store and deletes the data
Who may use AI Launchpad Supplies role collections Assigns them, reviews them

The operational side of the "your team" column (deployments, retirement dates, keys) is in Running AI on BTP. This topic is about the structure those operations run inside.

Questions to ask

  • How many SAP AI Core instances do we have, in which subaccounts and regions, and which stage is each for?
  • Does any development or test work run inside the production instance?
  • Which resource group does each production workload use, and who owns it?
  • What is our per-minute limit for each model we use, and what is our measured peak?
  • Which of our workloads handle data that must stay in one region, and are their models marked "Yes" or "Yes*" there?
  • Who holds the production service keys, and where are they stored?
  • Who can edit production in AI Launchpad? Show us the role collections.
  • Are any of our apps still calling the first orchestration API, which SAP retires after 31 December 2026?

Common misconceptions

  • "Resource groups are a security boundary between teams." They separate workloads, but anyone with the instance's service key can name any group in the header. Separate stages and teams that must not see each other with separate instances.
  • "AI Launchpad controls who can use AI Core." It controls what people see in the Launchpad. Apps and scripts call AI Core directly with the service key.
  • "If a model is listed in our region, data stays there." Only when the table says "Yes". "Yes*" means it may be served from another data center.
  • "One big rate limit is simpler." It is simpler until one workload uses all of it. Limits per resource group keep the others running.
  • "We can start on the free plan." SAP discontinued it in May 2026. Plan on Extended for generative AI, with the 30-day trial for learning.

Key terms

All course terms, A to Z, in the glossary

  • SAP AI Core: the BTP service that runs AI workloads and gives access to the generative AI hub.
  • SAP AI Launchpad: the SaaS application for managing AI Core and using the generative AI hub in a browser.
  • Instance (tenant): one subscription of AI Core in a subaccount, with its own service key, limits and resource groups.
  • Resource group: a workspace inside a tenant that holds one workload's deployments, configurations and secrets.
  • Service key: the credentials an app uses to call one AI Core instance.
  • Rate limit: the most requests per minute a tenant or resource group may send to one model.
  • Resource plan: a predefined machine size (CPU, memory, GPU) for running your own models.
  • Yes* (in SAP's model table): a model available in a region that may be served from another data center.

Check yourself

Pick one answer for each question. The explanation appears after you choose.

1Calder's invoice agent gets errors at month end while the order agent is busy. What design change addresses it?

Answer: A. Rate limits are per model per tenant and shared by all resource groups unless a group has its own. A limit per group keeps one agent's peak from blocking the other.

2The partner proposes a developer resource group inside the production instance. What is the risk?

Answer: B. Access is granted per tenant through the service key; the resource group is only a request header. Separate stages need separate instances.

3Augsburg's invoices must be processed in the EU. Which check matters most for the model?

Answer: A. "Yes*" means the model may be served from a data center outside the region for load balancing and failover. For data with a residency rule, that needs a decision, not an assumption.

4Who is responsible for deleting training files your own model used in SAP AI Core?

Answer: B. SAP's documentation says deleting an artifact removes only its metadata, and customers as data controllers delete the data in their object store.

5A developer says AI Launchpad hides production from them, so production is safe. What do you answer?

Answer: C. Launchpad's custom access limits which connections and resource groups a user sees in the Launchpad. Apps and scripts call AI Core with the service key, so control the keys too.

6What should an architect confirm before choosing a region for a new AI workload?

Answer: D. Models and generative AI features differ by region in SAP's tables. A design that names a model the region lacks has to change later.
Deep layer · 35 min read

Mental model

Think of SAP AI Core as three boxes, each with a different job:

  1. The instance (tenant) is the trust and billing boundary. One service key, one set of rate limits, one line in the bill. Whoever holds the key can act anywhere inside.
  2. The resource group is the workload boundary. It keeps one workload's deployments, configurations, secrets and object store apart, can carry its own rate limit, and shows up separately in consumption reports. It doesn't stop a key holder.
  3. The region is the data boundary. It decides which models and features exist and where requests are processed.

AI Launchpad sits outside the boxes. It is a window onto them, with its own roles, not a gate in front of them.

Every design question in this topic is one of three: which box draws this line, is the line drawn at the right box, and who holds the key to each box.

The generative AI hub and orchestration taught you to call models through AI Core, and Running AI on BTP how to keep deployments healthy. This topic doesn't repeat them: it covers the structure that both run inside.

How it works

Tenants, namespaces and what is shared

SAP describes AI Core as a "tenant-aware" BTP reuse service (Multitenancy). Each tenant and each resource group is mapped to its own namespace. The tenant namespace holds only templates; the running objects live in the resource group namespaces and point back to those templates.

flowchart TB
  SK[Service key<br/>one per instance] --> T
  subgraph T[Tenant: one AI Core instance]
    direction TB
    TL[Tenant level<br/>workflow and serving templates<br/>Docker registry secrets<br/>authentication]
    RG0[Resource group: default<br/>cannot be deleted]
    RG1[Resource group: agt-order-exc<br/>deployments, configurations,<br/>secrets, object store, own limit]
    RG2[Resource group: notif-coding]
    TL -.templates.-> RG1
    TL -.templates.-> RG2
  end
  App[App sends header<br/>AI-Resource-Group] --> RG1

What lives where, as SAP's Scope of Resources page lists it:

Level Holds Consequence for design
Tenant Workflow templates, serving templates, Docker registry secrets, authentication A template change affects every group; registry access is tenant-wide
Resource group Executions, deployments, configurations, artifacts, generic secrets, object store registration A configuration made in one group is invisible in another; set up each group on its own
Request The AI-Resource-Group header If the header is missing, the default group is used

Two things follow. First, the key is per tenant: "authentication and authorization are based on the SAP AI Core tenant", obtained with the service key. Second, workloads are sandboxed: SAP says a workload can't reach those of other tenants or resource groups, and only TCP traffic is supported.

Instances: how many and where

SAP's service plan page allows one or more instances per subaccount. The usual landscape, and the one the BTP account model gives Calder, is one subaccount per stage with one AI Core instance in each. Because the key is per tenant, that is what keeps development away from production.

Add an instance, not a resource group, when the line you are drawing is about trust or region:

Line to draw Box Why
Development vs. test vs. production Instance Keys and limits must not cross stages
US data vs. EU data Instance in another region The region decides where requests are processed
Two business units that must not see each other's prompts or data Instance A shared key sees everything
Agent A vs. agent B in production Resource group Same trust, separate capacity and cost
Batch job vs. interactive agent Resource group Separate limits; the batch can't starve the agent
Two models for one agent Same resource group One workload, one owner

The plan is per instance. Extended includes the generative AI hub and Standard doesn't. You can move from Standard to Extended keeping data and models, but not back (Update a Service Plan). That page adds a restriction worth reading before anyone deletes an instance: once a standard or extended instance is deleted, it says, a new standard instance can't be created.

Resource groups as the unit of workload

A resource group is created with POST {AI_API_URL}/v2/admin/resourceGroups and a body with resourceGroupId (3 to 253 characters). The API answers 202: creation is accepted, then provisioned. Labels can be attached, and AI Launchpad offers subaccount_id, zone_id and instance_id as standard labels. Some features ask for a label: a group used for document grounding carries ext.ai.sap.com/document-grounding: true (Create a Resource Group for Grounding).

Four consequences for design:

  1. Each group needs its own setup. SAP's Launchpad tutorial notes that an orchestration deployment is created automatically in the default group. A new group needs its own deployment, configurations, secrets and object store registration. Automate that with a script or Terraform-style pipeline rather than by hand.
  2. Object stores are per group, and SAP recommends not sharing one bucket and IAM user between groups. Give each group its own credentials, even when the bucket is shared.
  3. The group is the unit of cost. The BTP cockpit's usage export shows generative AI consumption per model under Applications and per resource group under instance (Metering and Pricing for SAP AI Core).
  4. Leave default empty in production. Anything that forgets the header lands there. If default holds nothing, a missing header fails loudly instead of quietly running as another workload.

Rate limits: tenant, group and provider

SAP limits requests per minute (RPM) per model per tenant. All versions of a model share the allocation, limits reset every minute, and over the limit you get HTTP 429 (Rate Limit Management).

flowchart LR
  subgraph Tenant[Tenant limit per model]
    G1[agt-order-exc<br/>own limit 45]
    G2[agt-inv-triage<br/>own limit 30]
    G3[notif-coding<br/>shares tenant limit]
  end
  G1 --> P[Model provider<br/>may also answer 429]
  G2 --> P
  G3 --> P

Three rules from SAP's page shape the design:

  • By default all groups share the tenant limit. You can configure a limit per group; requests from that group then use "its dedicated limit instead of the shared tenant quota".
  • The tenant limit must be at least the largest group limit. SAP's example: groups with 12k and 6k need a tenant limit of at least 12k.
  • A 429 isn't always yours. It can also mean the model provider's capacity is full. Read Retry-After, back off with jitter, and have a fallback model.

You read limits with GET /v2/admin/quota/model (add the AI-Resource-Group header for a group's own limit) and request changes with POST /v2/admin/quota/requests, which returns a requestId and goes through SAP's approval. Plan the request weeks ahead of the peak. This course plans to stay under 70% of a limit, the headroom line used in Running AI on BTP.

Deployment and replica counts have a separate tenant quota, raised by a ticket on component CA-ML-AIC, and a tenant may hold at most five tenant-wide generic secrets (Service Plans).

Regions, models and features

Three tables decide what a region can run, all maintained by SAP "on a best-effort basis":

  • Model availability by region: Yes, Yes* or No per model version and region. Yes* means the model may be accessed "from a cross-regional location" so SAP can balance load and fail over. SAP's own example: mistralai--mistral-small is Yes* in US10 and Yes in EU10. It also names three access types: SAP-hosted, SAP-managed and remote (such as AWS Bedrock).
  • Feature availability by region: orchestration, prompt registry, document grounding, batch, evaluation and others per region. As read on 29 November 2026, the batch service is listed for US10 and EU10 but for no region in the Asia Pacific table.
  • Hardware instance types by region: machine types for your own models. SAP notes that resource plans aren't supported in newly introduced data centers, where you use instance types instead.

For Calder's two regions, the model table read on 29 November 2026 gives:

Model US10 EU10
gpt-5.4 Yes Yes
gpt-5.4-nano Yes No
gpt-4.1 Yes Yes
anthropic--claude-4.5-sonnet Yes Yes
text-embedding-3-small Yes Yes*
mistralai--mistral-small (2603) Yes* Yes

The table is a planning aid. SAP calls the model discovery endpoint (GET /v2/lm/scenarios/foundation-models/models) in your own tenant the authoritative list, and SAP Note 3437766 for prices, retirement and limits.

Your own models: resource plans and baseline

For models you train or serve yourself, AI Core runs your Docker image on a chosen machine size. SAP's custom AI metering page lists the resource plans: Starter (at least 2.5 GB, 1 CPU core), Basic, Basic.8x, and the GPU plans Infer-S, Infer-M, Infer-L and Train-L. Compute is metered in node hours, storage in gigabyte hours, and a baseline in tenant hours, up to 730 hours a month, once you use compute or storage. Foundation models and grounding waive those three and charge by tokens instead.

Two sizing rules follow. A small CPU model on a GPU plan pays for a GPU it never uses. And the baseline applies to the tenant once any custom workload runs, so putting a rarely used custom model in its own instance adds a second baseline.

SAP also enforces pod security settings on your templates, such as running as non-root user 65534 with all capabilities dropped; a pod that sets them wrongly is rejected (Kubernetes Security).

AI Launchpad: connections, workspaces and roles

AI Launchpad is subscribed in a subaccount from the BTP cockpit (SAP's tutorial offers a booster). An administrator with the connections_editor role adds a connection per AI Core instance by uploading its service key, with a client secret or an X.509 certificate. Users pick a connection and a resource group as their workspace context (Workspaces).

flowchart LR
  U[User with role collections] --> L[AI Launchpad subscription<br/>in one subaccount and region]
  L -->|connection = stored service key| C1[AI Core dev]
  L --> C2[AI Core test]
  L --> C3[AI Core prod]
  L -.custom access.-> F[allow_connections<br/>allowed resource groups]

SAP ships default role collections (Launchpad Security), among them:

Role collection Lets a user
ailaunchpad_connections_editor Create, edit and delete connections
ailaunchpad_allow_all_resourcegroups See all resource groups
ailaunchpad_mloperations_viewer / _editor View, or also change, deployments and executions
ailaunchpad_aicore_admin_editor Edit AI Core administration (secrets, repositories, resource groups)
ailaunchpad_genai_experimenter / _manager / _administrator Experiment with prompts, also manage them, or administer the hub's user data

Each has a _without_genai variant. By default users see every connection and every resource group. Custom access narrows that: a role from the allow_connections template lists the connections a role collection sees, and a role from the allow_all_resourcegroups template lists the resource groups (users must not also hold ailaunchpad_allow_all_resourcegroups).

Three facts change the design:

  • Launchpad roles limit the Launchpad, not the API. They don't affect an app or script holding the service key.
  • A connection stores a service key. Rotating the key means updating the connection too.
  • Launchpad user data stays in its region. SAP says user data "is saved in one region only" and can only be read or deleted from a Launchpad in that region. Prompt experiments for EU data belong in an EU Launchpad.

SAP also states that data stored in AI Launchpad isn't used to train LLMs, that audit log data is kept for 30 days, and that SAP Support reaches production only through time-limited, approved Cloud Access Manager profiles.

Build it yourself

You will review the AI Core and AI Launchpad design a partner drafted for Calder, find what breaks against 14 rules, and compare it with the reviewed design. The script also writes the register an operations team keeps: every instance, resource group, owner, limit and Launchpad role on one page. An optional last step reads the real resource groups and limits of your own trial tenant.

Before you start: complete Set up your computer for this course and Set up for Unit 23. The main path needs only Python. The optional live step also needs the SAP AI Core trial and the AICORE_ lines in .env from Set up for Unit 3.

flowchart LR
  I[--init] --> D[tenancy_draft.json]
  I --> R[tenancy_reviewed.json]
  D --> C[aicore_tenancy.py<br/>rules A01-A14]
  R --> C
  C --> G[aicore_register.md]
  E[.env: AICORE_ lines] -. optional live step .-> T[Your trial tenant:<br/>resource groups, limits]

What you need

  • Your course folder orchestrate-course with .venv.
  • About 30 minutes, plus 10 for the optional live step.
  • Cost: free. The main path has no account, no network and no model calls. The live step makes two read requests to your trial and no model calls, so it uses no tokens.

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):

      .venv\Scripts\Activate.ps1
    • macOS / Linux:

      source .venv/bin/activate
  4. Make sure the unit23 folder exists. The command does nothing if it is already there.

    • Windows (PowerShell):

      New-Item -ItemType Directory -Force unit23
    • macOS / Linux:

      mkdir -p unit23

Step 2: Create the script

  1. In VS Code, create the file unit23/aicore_tenancy.py, paste the code below, and save.
"""Review an SAP AI Core and SAP AI Launchpad tenancy design for Calder Pumpworks.

Course lab for Unit 23 (Orchestrate). Built-in modules only, no randomness.

  python unit23/aicore_tenancy.py --init                 write the draft and reviewed designs
  python unit23/aicore_tenancy.py                        review the reviewed design
  python unit23/aicore_tenancy.py --file unit23/aicore/tenancy_draft.json
  python unit23/aicore_tenancy.py --register             also write unit23/aicore/aicore_register.md
  python unit23/aicore_tenancy.py --live                 read your own tenant (optional, needs .env)

Exit code 2 when any rule fails. All names, limits and peaks are course values.
"""
import argparse
import json
import os
import sys
from datetime import date
from pathlib import Path

HERE = Path(__file__).resolve().parent / "aicore"
AS_OF = date(2026, 11, 29)
V1_END = date(2026, 12, 31)      # SAP extended the orchestration v1 decommissioning to this date
HEADROOM = 0.70                  # course rule: plan to stay below 70% of a limit
RG_LIMIT = 50                    # SAP: resource groups per tenant
GPU_PLANS = {"Infer-S", "Infer-M", "Infer-L", "Train-L"}

# Snapshot of SAP's "Model Availability by Region" page, read 2026-11-29.
# "Yes*" = available, may be served from a data center outside the region.
AVAILABILITY = {
    "gpt-5.4":                    {"us10": "Yes", "eu10": "Yes"},
    "gpt-5.4-nano":               {"us10": "Yes", "eu10": "No"},
    "gpt-4.1":                    {"us10": "Yes", "eu10": "Yes"},
    "anthropic--claude-4.5-sonnet": {"us10": "Yes", "eu10": "Yes"},
    "mistralai--mistral-small":   {"us10": "Yes*", "eu10": "Yes"},
    "text-embedding-3-small":     {"us10": "Yes", "eu10": "Yes*"},
}
REGION_DATA = {"us10": "us", "eu10": "eu"}


def instance(id_, sub, region, plan, stage):
    return {"id": id_, "subaccount": sub, "region": region, "plan": plan, "stage": stage}


def group(id_, inst, stage, owner, workloads, models=(), gen_ai=True, rg_rpm=None,
          data="us", strict=False, custom=None, store=None, api="v2", cost=None):
    return {"id": id_, "instance": inst, "stage": stage, "owner": owner,
            "labels": {"ext.ai.sap.com/cost-object": cost} if cost else {},
            "workloads": list(workloads), "generative_ai": gen_ai, "data": data,
            "residency_strict": strict, "models": [dict(m) for m in models],
            "rg_rpm_limit": rg_rpm or {}, "custom_model": custom, "object_store": store,
            "orchestration_api": api}


def draft():
    return {
        "name": "Calder AI Core tenancy (partner draft)",
        "instances": [
            instance("calder-aicore-dev", "calder-ai-dev", "us10", "free", "dev"),
            instance("calder-aicore-qa", "calder-ai-test", "us10", "extended", "test"),
            instance("calder-aicore", "calder-ai-prod", "us10", "extended", "prod"),
        ],
        "tenant_rpm_limit": {"calder-aicore": {"gpt-5.4": 60}},
        "resource_groups": [
            group("default", "calder-aicore", "prod", "00100292",
                  ["W03 calder-ai-gw: AGT_ORDER_EXC", "W03 calder-ai-gw: AGT_INV_TRIAGE",
                   "AGT_SUPPLY_WATCH"],
                  [{"model": "gpt-5.4", "peak_rpm": 30}, {"model": "gpt-5.4", "peak_rpm": 18},
                   {"model": "gpt-5.4", "peak_rpm": 12}], api="v1"),
            group("calder-dev", "calder-aicore", "dev", "00100288", ["developer experiments"],
                  [{"model": "gpt-4.1", "peak_rpm": 0}]),
            group("notif-coding", "calder-aicore", "prod", "", ["W07 nightly notification coding (batch)"],
                  [{"model": "gpt-4.1", "peak_rpm": 0}],
                  store={"bucket": "calder-ai-artifacts", "iam_user": "aicore-writer"}),
            group("late-delivery", "calder-aicore", "prod", "00100288", ["late-delivery predictor"],
                  gen_ai=False, custom={"resource_plan": "Infer-S", "cpu_only": True},
                  store={"bucket": "calder-ai-artifacts", "iam_user": "aicore-writer"}),
            group("cp20-invoices", "calder-aicore", "prod", "00100244", ["E01 CP20 invoice extraction"],
                  [{"model": "gpt-5.4-nano", "peak_rpm": 6}], data="eu", strict=True),
        ],
        "launchpad": {
            "subscriptions": [{"subaccount": "calder-ai-dev", "region": "us10"},
                              {"subaccount": "calder-ai-test", "region": "us10"},
                              {"subaccount": "calder-ai-prod", "region": "us10"}],
            "connections": [{"name": "calder-aicore-dev", "launchpad": "calder-ai-prod"},
                            {"name": "calder-aicore-qa", "launchpad": "calder-ai-prod"},
                            {"name": "calder-aicore", "launchpad": "calder-ai-prod"}],
            "access": [
                {"collection": "AIL-AI-OPS", "members": ["00100288", "00100290"],
                 "connections": ["all"], "resource_groups": ["all"], "edits": True},
                {"collection": "AIL-DEVELOPERS", "members": ["00100321"],
                 "connections": ["all"], "resource_groups": ["all"], "edits": True},
            ],
        },
    }


def reviewed():
    d = draft()
    d["name"] = "Calder AI Core tenancy (reviewed)"
    d["instances"] = [
        instance("calder-aicore-dev", "calder-ai-dev", "us10", "extended", "dev"),
        instance("calder-aicore-qa", "calder-ai-test", "us10", "extended", "test"),
        instance("calder-aicore", "calder-ai-prod", "us10", "extended", "prod"),
        instance("calder-aicore-eu", "calder-aug-prod", "eu10", "extended", "prod"),
    ]
    d["tenant_rpm_limit"] = {"calder-aicore": {"gpt-5.4": 60},
                             "calder-aicore-eu": {"gpt-5.4": 30, "text-embedding-3-small": 30}}
    d["resource_groups"] = [
        group("default", "calder-aicore", "prod", "00100292", [], gen_ai=False),
        group("agt-order-exc", "calder-aicore", "prod", "00100296", ["W03 calder-ai-gw: AGT_ORDER_EXC"],
              [{"model": "gpt-5.4", "peak_rpm": 30}], rg_rpm={"gpt-5.4": 45}, cost="CP10-920"),
        group("agt-inv-triage", "calder-aicore", "prod", "00100244", ["W03 calder-ai-gw: AGT_INV_TRIAGE"],
              [{"model": "gpt-5.4", "peak_rpm": 18}], rg_rpm={"gpt-5.4": 30}, cost="CP10-920"),
        group("agt-supply-watch", "calder-aicore", "prod", "00100153", ["AGT_SUPPLY_WATCH"],
              [{"model": "gpt-5.4", "peak_rpm": 12}], rg_rpm={"gpt-5.4": 20}, cost="CP10-920"),
        group("notif-coding", "calder-aicore", "prod", "00100288", ["W07 nightly notification coding (batch)"],
              [{"model": "gpt-4.1", "peak_rpm": 0}],
              store={"bucket": "calder-ai-artifacts", "iam_user": "aicore-notif-coding"}, cost="CP10-920"),
        group("late-delivery", "calder-aicore", "prod", "00100288", ["late-delivery predictor"],
              gen_ai=False, custom={"resource_plan": "Starter", "cpu_only": True},
              store={"bucket": "calder-ai-artifacts", "iam_user": "aicore-late-delivery"}, cost="CP10-920"),
        group("dev-experiments", "calder-aicore-dev", "dev", "00100288", ["developer experiments"],
              [{"model": "gpt-4.1", "peak_rpm": 0}]),
        group("cp20-invoices", "calder-aicore-eu", "prod", "00100244", ["E01 CP20 invoice extraction"],
              [{"model": "gpt-5.4", "peak_rpm": 6}, {"model": "text-embedding-3-small", "peak_rpm": 6}],
              data="eu", strict=True, cost="CP20-910"),
    ]
    d["launchpad"] = {
        "subscriptions": [{"subaccount": "calder-ai-prod", "region": "us10"},
                          {"subaccount": "calder-aug-prod", "region": "eu10"}],
        "connections": [{"name": "calder-aicore-dev", "launchpad": "calder-ai-prod"},
                        {"name": "calder-aicore-qa", "launchpad": "calder-ai-prod"},
                        {"name": "calder-aicore", "launchpad": "calder-ai-prod"},
                        {"name": "calder-aicore-eu", "launchpad": "calder-aug-prod"}],
        "access": [
            {"collection": "AIL-AI-OPS", "members": ["00100288", "00100290"],
             "connections": ["all"], "resource_groups": ["all"], "edits": True},
            {"collection": "AIL-DEVELOPERS", "members": ["00100321"],
             "connections": ["calder-aicore-dev", "calder-aicore-qa"], "resource_groups": ["all"],
             "edits": True},
            {"collection": "AIL-PROMPT-EDITORS", "members": ["00100244", "00100296"],
             "connections": ["calder-aicore-qa"], "resource_groups": ["agt-inv-triage", "agt-order-exc"],
             "edits": False},
        ],
    }
    return d


def review(d):
    out = []

    def add(level, rule, text):
        out.append((level, rule, text))

    inst = {i["id"]: i for i in d["instances"]}
    groups = d["resource_groups"]

    # A01 service plan
    for i in d["instances"]:
        if i["plan"] == "free":
            add("FAIL", "A01", f"{i['id']}: plan free was discontinued on 2026-05-22; use extended")
        elif i["plan"] not in ("standard", "extended"):
            add("FAIL", "A01", f"{i['id']}: unknown plan {i['plan']}")
        else:
            add("OK", "A01", f"{i['id']}: plan {i['plan']}")
    for g in groups:
        i = inst.get(g["instance"])
        if i and g["generative_ai"] and i["plan"] == "standard":
            add("FAIL", "A01", f"{g['id']}: generative AI needs the extended plan on {i['id']}")

    # A02 one stage per instance
    for g in groups:
        i = inst.get(g["instance"])
        if not i:
            add("FAIL", "A02", f"{g['id']}: instance {g['instance']} not in the design")
        elif g["stage"] != i["stage"]:
            add("FAIL", "A02", f"{g['id']}: stage {g['stage']} on {i['stage']} instance {i['id']}; "
                               "a service key reaches every group in its tenant")
    if not any(r[1] == "A02" for r in out):
        add("OK", "A02", "every resource group sits on an instance of its own stage")

    # A03 one workload per group, nothing in default in production
    for g in groups:
        i = inst.get(g["instance"], {})
        if g["id"] == "default" and i.get("stage") == "prod" and g["workloads"]:
            add("FAIL", "A03", f"{i['id']}/default: {len(g['workloads'])} production workloads; "
                               "give each its own resource group")
        elif len(g["workloads"]) > 1:
            add("WARN", "A03", f"{g['id']}: {len(g['workloads'])} workloads share one group")
    if not any(r[1] == "A03" for r in out):
        add("OK", "A03", "one workload per resource group; default holds no production workload")

    # A04 resource group quota
    for i in d["instances"]:
        n = 1 + sum(1 for g in groups if g["instance"] == i["id"] and g["id"] != "default")
        level = "FAIL" if n > RG_LIMIT else "WARN" if n > 0.8 * RG_LIMIT else "OK"
        add(level, "A04", f"{i['id']}: {n} of {RG_LIMIT} resource groups")

    # A05 data residency
    for g in groups:
        i = inst.get(g["instance"])
        if i and g["data"] != REGION_DATA.get(i["region"]):
            add("FAIL", "A05", f"{g['id']}: {g['data'].upper()} data on {i['id']} in {i['region']}")
        elif i and g["residency_strict"]:
            add("OK", "A05", f"{g['id']}: {g['data'].upper()} data on {i['id']} in {i['region']}")

    # A06 model availability in the instance's region
    for g in groups:
        i = inst.get(g["instance"])
        if not i:
            continue
        for m in g["models"]:
            avail = AVAILABILITY.get(m["model"], {}).get(i["region"])
            where = f"{g['id']}: {m['model']} in {i['region']}"
            if avail is None:
                add("WARN", "A06", f"{where} not in the snapshot; check SAP's matrix")
            elif avail == "No":
                add("FAIL", "A06", f"{where} is not available")
            elif avail == "Yes*" and g["residency_strict"]:
                add("WARN", "A06", f"{where} is Yes*: may be served outside the region")
            else:
                add("OK", "A06", f"{where}: {avail}")

    # A07 and A08 rate limits against peaks
    tenant = d.get("tenant_rpm_limit", {})
    for i in d["instances"]:
        shared = {}
        for g in groups:
            if g["instance"] != i["id"]:
                continue
            for m in g["models"]:
                if not m["peak_rpm"]:
                    continue
                own = g["rg_rpm_limit"].get(m["model"])
                if own:
                    pct = m["peak_rpm"] / own
                    level = "FAIL" if pct >= 1 else "WARN" if pct > HEADROOM else "OK"
                    add(level, "A07", f"{g['id']}: {m['model']} peak {m['peak_rpm']} of group limit "
                                      f"{own} ({pct:.0%})")
                    t = tenant.get(i["id"], {}).get(m["model"])
                    if t is None:
                        add("FAIL", "A08", f"{g['id']}: group limit {own} but no tenant limit for {m['model']}")
                    elif own > t:
                        add("FAIL", "A08", f"{g['id']}: group limit {own} above tenant limit {t}")
                else:
                    shared[m["model"]] = shared.get(m["model"], 0) + m["peak_rpm"]
        for model, peak in shared.items():
            t = tenant.get(i["id"], {}).get(model)
            if not t:
                add("WARN", "A07", f"{i['id']}: {model} peak {peak} with no recorded tenant limit")
                continue
            pct = peak / t
            level = "FAIL" if pct >= 1 else "WARN" if pct > HEADROOM else "OK"
            add(level, "A07", f"{i['id']}: {model} shared peak {peak} of tenant limit {t} ({pct:.0%})")

    # A09 object stores
    seen = {}
    for g in groups:
        s = g["object_store"]
        if s:
            key = (g["instance"], s["bucket"], s["iam_user"])
            seen.setdefault(key, []).append(g["id"])
    for (inst_id, bucket, user), ids in seen.items():
        if len(ids) > 1:
            add("FAIL", "A09", f"{inst_id}: bucket {bucket} with IAM user {user} in {', '.join(ids)}")
        else:
            add("OK", "A09", f"{ids[0]}: bucket {bucket}, IAM user {user}")

    # A10 custom model sizing
    for g in groups:
        c = g["custom_model"]
        if c:
            if c["cpu_only"] and c["resource_plan"] in GPU_PLANS:
                add("WARN", "A10", f"{g['id']}: GPU plan {c['resource_plan']} for a CPU-only model")
            else:
                add("OK", "A10", f"{g['id']}: resource plan {c['resource_plan']}")

    # A11 AI Launchpad access to production
    lp = d["launchpad"]
    prod = {i["id"] for i in d["instances"] if i["stage"] == "prod"}
    for a in lp["access"]:
        sees = set(inst) if "all" in a["connections"] else set(a["connections"])
        if a["collection"] == "AIL-AI-OPS":
            add("OK", "A11", f"{a['collection']}: operates all connections")
            continue
        if a["edits"] and sees & prod:
            add("FAIL", "A11", f"{a['collection']}: edit rights on production connection(s) "
                               f"{', '.join(sorted(sees & prod))}")
        elif "all" in a["resource_groups"] and sees & prod:
            add("FAIL", "A11", f"{a['collection']}: all resource groups on production")
        else:
            add("OK", "A11", f"{a['collection']}: sees {', '.join(sorted(sees))}")

    # A12 Launchpad subscriptions and regions
    regions = {s["subaccount"]: s["region"] for s in lp["subscriptions"]}
    needed = {i["region"] for i in d["instances"]}
    if len(lp["subscriptions"]) > len(needed):
        add("WARN", "A12", f"{len(lp['subscriptions'])} Launchpad subscriptions for {len(needed)} "
                           "region(s); each is charged per subaccount per month")
    for c in lp["connections"]:
        i = inst.get(c["name"])
        r = regions.get(c["launchpad"])
        if i and r and i["region"] != r:
            add("WARN", "A12", f"{c['name']} ({i['region']}) connected from a Launchpad in {r}; "
                               "generative AI hub user data stays in the Launchpad's region")
    for i in d["instances"]:
        if not any(c["name"] == i["id"] for c in lp["connections"]):
            add("WARN", "A12", f"{i['id']}: no Launchpad connection")
    if not any(r[1] == "A12" for r in out):
        add("OK", "A12", f"{len(lp['subscriptions'])} Launchpad subscription(s), one per region")

    # A13 orchestration API version
    for g in groups:
        if g["generative_ai"] and g["models"] and g["orchestration_api"] == "v1":
            level = "FAIL" if AS_OF > V1_END else "WARN"
            add(level, "A13", f"{g['id']}: orchestration v1, decommissioned after {V1_END}")

    # A14 owners
    for g in groups:
        if not g["owner"]:
            add("FAIL", "A14", f"{g['id']}: no owner")
    if not any(r[1] == "A14" for r in out):
        add("OK", "A14", "every resource group has an owner")
    return out


def print_review(d, results):
    order = {"FAIL": 0, "WARN": 1, "OK": 2}
    print(f"Review of {d['name']} as of {AS_OF}")
    for level, rule, text in sorted(results, key=lambda r: (order[r[0]], r[1])):
        print(f"  {level:<5}{rule}  {text}")
    counts = {k: sum(1 for r in results if r[0] == k) for k in ("OK", "WARN", "FAIL")}
    print(f"Result: {counts['OK']} OK, {counts['WARN']} WARN, {counts['FAIL']} FAIL")
    return counts


def write_register(d, path):
    inst = {i["id"]: i for i in d["instances"]}
    lines = [f"# SAP AI Core register: {d['name']}", "", f"As of {AS_OF}. Course values.", "",
             "| Instance | Subaccount | Region | Plan | Stage |", "| --- | --- | --- | --- | --- |"]
    for i in d["instances"]:
        lines.append(f"| {i['id']} | {i['subaccount']} | {i['region']} | {i['plan']} | {i['stage']} |")
    lines += ["", "| Resource group | Instance | Owner | Workloads | Models | Group limit | Cost object |",
              "| --- | --- | --- | --- | --- | --- | --- |"]
    for g in d["resource_groups"]:
        models = ", ".join(sorted({m["model"] for m in g["models"]})) or "-"
        lim = ", ".join(f"{k} {v}" for k, v in g["rg_rpm_limit"].items()) or "tenant"
        lines.append(f"| {g['id']} | {g['instance']} | {g['owner'] or '-'} | "
                     f"{'; '.join(g['workloads']) or '-'} | {models} | {lim} | "
                     f"{g.get('labels', {}).get('ext.ai.sap.com/cost-object', '-')} |")
    lines += ["", "| Launchpad role collection | Members | Connections | Resource groups | Edits |",
              "| --- | --- | --- | --- | --- |"]
    for a in d["launchpad"]["access"]:
        lines.append(f"| {a['collection']} | {', '.join(a['members'])} | {', '.join(a['connections'])} | "
                     f"{', '.join(a['resource_groups'])} | {'yes' if a['edits'] else 'no'} |")
    path.write_text("\n".join(lines) + "\n", encoding="utf-8")
    print(f"Wrote unit23/aicore/{path.name}")


def live():
    try:
        import requests
        from dotenv import load_dotenv
    except ImportError as e:
        sys.exit(f"Missing library: {e.name}. Run: pip install -r requirements.txt")
    load_dotenv()
    names = ["AICORE_CLIENT_ID", "AICORE_CLIENT_SECRET", "AICORE_AUTH_URL", "AICORE_BASE_URL"]
    missing = [n for n in names if not os.environ.get(n)]
    if missing:
        sys.exit(f"Missing in .env: {', '.join(missing)}")
    try:
        tok = requests.post(os.environ["AICORE_AUTH_URL"],
                            data={"grant_type": "client_credentials"},
                            auth=(os.environ["AICORE_CLIENT_ID"], os.environ["AICORE_CLIENT_SECRET"]),
                            timeout=20)
    except requests.RequestException:
        sys.exit("Could not reach the sign-in URL. Check your network or proxy.")
    if tok.status_code != 200:
        sys.exit(f"Sign-in failed with HTTP {tok.status_code}. Check the AICORE_ lines in .env.")
    head = {"Authorization": "Bearer " + tok.json()["access_token"]}
    base = os.environ["AICORE_BASE_URL"].rstrip("/")
    for path, label in (("/admin/resourceGroups", "Resource groups"), ("/admin/quota/model", "Rate limits")):
        try:
            r = requests.get(base + path, headers=head, timeout=20)
        except requests.RequestException:
            print(f"({label}: could not reach SAP AI Core; skipped)")
            continue
        if r.status_code != 200:
            print(f"({label}: GET {path} returned HTTP {r.status_code}; skipped)")
            continue
        body = r.json()
        if label == "Resource groups":
            items = body.get("resources", []) if isinstance(body, dict) else []
            print(f"{label}: {len(items)}")
            for g in items:
                print(f"  {g.get('resourceGroupId', '?')}  {g.get('status', '')}")
        else:
            rows = [q for block in (body if isinstance(body, list) else []) for q in block.get("quotaDetails", [])]
            print(f"{label}: {len(rows)} model entries")
            for q in rows[:15]:
                dsc = q.get("descriptors", {})
                print(f"  {dsc.get('modelName', '?'):<34}{q.get('limit', '?'):>8} {q.get('unit', '')}")
    print("Read only: nothing was changed in your tenant.")


def main():
    p = argparse.ArgumentParser(description="Review an SAP AI Core tenancy design (course lab).")
    p.add_argument("--init", action="store_true", help="write the draft and reviewed design files")
    p.add_argument("--file", help="design file to review (default: the reviewed design)")
    p.add_argument("--register", action="store_true", help="write aicore_register.md")
    p.add_argument("--live", action="store_true", help="read resource groups and limits from your tenant")
    a = p.parse_args()
    if a.live:
        live()
        return 0
    HERE.mkdir(parents=True, exist_ok=True)
    if a.init:
        for name, d in (("tenancy_draft.json", draft()), ("tenancy_reviewed.json", reviewed())):
            (HERE / name).write_text(json.dumps(d, indent=2) + "\n", encoding="utf-8")
            print(f"Wrote unit23/aicore/{name}")
        return 0
    path = Path(a.file) if a.file else HERE / "tenancy_reviewed.json"
    if not path.exists():
        sys.exit(f"{path} not found. Run: python unit23/aicore_tenancy.py --init")
    try:
        d = json.loads(path.read_text(encoding="utf-8"))
    except json.JSONDecodeError as e:
        sys.exit(f"{path.name} is not valid JSON (line {e.lineno}). Undo your last edit or run --init.")
    counts = print_review(d, review(d))
    if a.register:
        write_register(d, HERE / "aicore_register.md")
    return 2 if counts["FAIL"] else 0


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

Step 3: Write the two designs

  1. Run:

    python unit23/aicore_tenancy.py --init
  2. You should see:

    Wrote unit23/aicore/tenancy_draft.json
    Wrote unit23/aicore/tenancy_reviewed.json
  3. Open unit23/aicore/tenancy_draft.json in VS Code and skim it. It has four parts: instances (one per stage), tenant_rpm_limit (the per-minute limits recorded for each tenant), resource_groups (each with its owner, workloads, models and peak requests per minute) and launchpad (subscriptions, connections and who sees what).

Step 4: Review the partner's draft

  1. Run:

    python unit23/aicore_tenancy.py --file unit23/aicore/tenancy_draft.json
  2. You should see this (failures first):

    Review of Calder AI Core tenancy (partner draft) as of 2026-11-29
      FAIL A01  calder-aicore-dev: plan free was discontinued on 2026-05-22; use extended
      FAIL A02  calder-dev: stage dev on prod instance calder-aicore; a service key reaches every group in its tenant
      FAIL A03  calder-aicore/default: 3 production workloads; give each its own resource group
      FAIL A05  cp20-invoices: EU data on calder-aicore in us10
      FAIL A07  calder-aicore: gpt-5.4 shared peak 60 of tenant limit 60 (100%)
      FAIL A09  calder-aicore: bucket calder-ai-artifacts with IAM user aicore-writer in notif-coding, late-delivery
      FAIL A11  AIL-DEVELOPERS: edit rights on production connection(s) calder-aicore
      FAIL A14  notif-coding: no owner
      WARN A07  calder-aicore: gpt-5.4-nano peak 6 with no recorded tenant limit
      WARN A10  late-delivery: GPU plan Infer-S for a CPU-only model
      WARN A12  3 Launchpad subscriptions for 1 region(s); each is charged per subaccount per month
      WARN A13  default: orchestration v1, decommissioned after 2026-12-31
      OK   A01  calder-aicore-qa: plan extended
      ...
    Result: 12 OK, 4 WARN, 8 FAIL
  3. Read the failures as a design review would:

    Rule What the draft did Why it fails
    A01 Development instance on the free plan SAP discontinued it on 22 May 2026
    A02 Developer group calder-dev inside the production tenant The key developers need opens production
    A03 Three agents in default No separate limits, no cost per agent, and a missing header lands there
    A05 Augsburg's invoices on the US instance Calder's rule: CP20 data is processed in the EU
    A07 Three agents sharing 60 requests a minute at a combined peak of 60 Any spike gives 429 to all three
    A09 Two groups writing one bucket with one IAM user SAP recommends against it; one group can read the other's files
    A11 Developers can edit the production connection Production changes need the AI operations team
    A14 The batch group has no owner Nobody answers for its cost or its failures

    The warnings are decisions to make: a limit nobody recorded, a GPU paid for a small CPU model, three Launchpad fees where one does, and a call to the first orchestration API, which SAP retires after 31 December 2026.

  4. The exit code is 2 because something failed. A pipeline that runs this check on every change to the design stops there.

Step 5: Review the reviewed design and write the register

  1. Run:

    python unit23/aicore_tenancy.py --register
  2. You should see:

    Review of Calder AI Core tenancy (reviewed) as of 2026-11-29
      WARN A06  cp20-invoices: text-embedding-3-small in eu10 is Yes*: may be served outside the region
      OK   A01  calder-aicore-dev: plan extended
      ...
      OK   A07  agt-order-exc: gpt-5.4 peak 30 of group limit 45 (67%)
      ...
    Result: 30 OK, 1 WARN, 0 FAIL
    Wrote unit23/aicore/aicore_register.md
  3. What changed: an Extended development instance; a fourth instance, calder-aicore-eu, in EU10 for Augsburg; one resource group per agent with its own limit; the batch job owned; separate IAM users per group; Starter instead of Infer-S; one Launchpad per region; developers limited to development and test; business owners as prompt experimenters on test only, without edit rights.

  4. The one warning is a real open item. Augsburg's invoice matching uses an embedding model that SAP marks Yes* in EU10. Calder must either confirm with SAP where it is served or pick an embedding model marked Yes. The ADR in Architecture view records it.

  5. Open unit23/aicore/aicore_register.md with VS Code's preview (Ctrl+Shift+V, or Cmd+Shift+V on macOS). That is the page operations keep current.

Step 6: Break a rule on purpose

  1. In unit23/aicore/tenancy_reviewed.json, find "iam_user": "aicore-late-delivery" and change it to "iam_user": "aicore-notif-coding". Save.

  2. Run the review again:

    python unit23/aicore_tenancy.py
  3. You should see one new failure and the count drop:

      FAIL A09  calder-aicore: bucket calder-ai-artifacts with IAM user aicore-notif-coding in notif-coding, late-delivery
    ...
    Result: 28 OK, 1 WARN, 1 FAIL
  4. Put it back: run python unit23/aicore_tenancy.py --init to rewrite both files.

Step 7 (optional): Read your own trial tenant

This step reads two lists from your trial and changes nothing.

  1. Check that .env has the four lines AICORE_CLIENT_ID, AICORE_CLIENT_SECRET, AICORE_AUTH_URL and AICORE_BASE_URL (ending in /v2) from Set up for Unit 3.

  2. Run:

    python unit23/aicore_tenancy.py --live
  3. What success looks like (names and numbers depend on your tenant):

    Resource groups: 1
      default  PROVISIONED
    Rate limits: 12 model entries
      gpt-5.4                                    <limit> requestPerMinute
      ...
    Read only: nothing was changed in your tenant.
  4. A trial usually shows only default. If the rate-limit list isn't allowed for your tenant, you see (Rate limits: GET /admin/quota/model returned HTTP 403; skipped): a valid result. Ask your administrator for the limits instead.

Step 8: Save your work

  1. Commit the script and both designs:

    git add unit23/aicore_tenancy.py unit23/aicore/
    git commit -m "Unit 23: SAP AI Core tenancy review"

How the code works

Part of the script What it does
AVAILABILITY Six rows of SAP's model availability table for US10 and EU10, as read on 29 November 2026
instance(), group() Build the records of the design files, so both designs share one shape
draft(), reviewed() The partner's draft and the reviewed design, written by --init
review() A01-A04 Plan, stage per instance, one workload per group, resource group quota
review() A05-A06 Data region against instance region; each model against the snapshot (No fails, Yes* warns for residency-bound groups)
review() A07-A08 Peaks against group limits, or summed against the tenant limit when a group has none; group limits never above the tenant's
review() A09-A10 Shared bucket and IAM user; GPU plan for a CPU-only model
review() A11-A12 Launchpad edit rights on production; subscriptions per region; connections across regions
review() A13-A14 First orchestration API; an owner on every group
write_register() Writes the one-page register as markdown tables
live() Signs in with client credentials, then reads /admin/resourceGroups and /admin/quota/model; any error is a skip, not a crash

If something goes wrong

What you see What it means What to do
python: command not found or 'python' is not recognized Python isn't on your path, or the environment is off Turn on .venv (Step 1); on macOS/Linux try python3
can't open file ... aicore_tenancy.py You're in another folder, or the file has another name Run from orchestrate-course; check the file is unit23/aicore_tenancy.py
... tenancy_reviewed.json not found The design files don't exist yet Run Step 3
... is not valid JSON (line N) An edit left a missing comma or quote Undo the edit, or run --init again
Missing library: requests (live step) The Unit 2 libraries aren't installed in .venv Check for (.venv), then pip install -r requirements.txt
Missing in .env: AICORE_... (live step) The trial details aren't in .env Follow Set up for Unit 3, or skip Step 7
Sign-in failed with HTTP 401 The client ID, secret or sign-in URL is wrong, or the key was deleted Create a new service key and update .env
Could not reach the sign-in URL Network or company proxy blocks the call Try another network, or set HTTPS_PROXY as IT tells you; the main path still works
GET /admin/resourceGroups returned HTTP 404 AICORE_BASE_URL doesn't end in /v2 Fix the line in .env

The SAP way

As read on 29 November 2026. These steps are a sketch: they need an enterprise BTP global account with SAP AI Core and SAP AI Launchpad entitlements, which this course doesn't provide.

  1. Entitle and create instances. In each stage's subaccount, add the SAP AI Core extended plan to the entitlements, then create an instance from the Service Marketplace (Create a Service Instance). AI Core can be enabled from Cloud Foundry or Kyma.
  2. Create a service key or binding per consumer. Prefer an X.509 certificate key or a binding over a copied secret; rotation is yours (Running AI on BTP).
  3. Create resource groups with POST /v2/admin/resourceGroups, one per workload, labeled as your standard says. In each, create the orchestration deployment, configurations, secrets and object store registration.
  4. Request rate limits per group with POST /v2/admin/quota/requests, keeping the tenant limit at least as high as the largest group limit. Track the requestId until approved.
  5. Subscribe to AI Launchpad (Standard plan) in one subaccount per region, add a connection per AI Core instance in the Workspaces app, and set custom access with allow_connections and resource group roles (Launchpad Security).
  6. Optionally, bring your own root key. Since September 2026, AI Core can protect its tenant encryption keys with a customer-managed root key in SAP Data Custodian Key Management Service. SAP warns that disabling the root key makes the encrypted data inaccessible (Encryption of Data).
  7. Watch consumption in the global account's Usage view, filtered by AI Core, with the export split by model and resource group.

What is GA, and what to check. The pages read describe all of the above as generally available. Region coverage, model availability and feature availability vary and change often; read SAP's tables and your tenant's model list in the run that plans on them.

Licensing. AI Core is consumed per instance under your BTP commercial model; AI Launchpad at a fixed monthly price per subaccount. BTP commercial models and cost covers credits and budgets; Unit 23's topic on AI Units covers SAP's AI-specific metrics.

Build vs. SAP

Need Do it yourself SAP's built-in way Choose
Separate agents' capacity A queue or gateway that rations calls Resource group rate limits SAP, plus a gateway for budgets per user
Cost per agent Token counting in your own logs Consumption export per resource group SAP for the bill, your logs for detail
Who sees what in the UI Nothing to build Launchpad custom access SAP
Who can call the API Key management and per-stage instances Service keys per instance SAP's boundary, your discipline
Design review A rules check like this lab, in CI No built-in check of your design Yours
Region choice for a model Read SAP's tables Tables plus the discovery endpoint SAP's data, your decision

Architecture view

Where it sits. AI Core instances live in Calder's AI subaccounts (calder-ai-dev, calder-ai-test, calder-ai-prod in US10, and calder-aug-prod in EU10). Agents and apps reach them from BTP runtimes, through the gateway calder-ai-gw for the order exceptions and invoice triage agents, with the AI-Resource-Group header naming their group. S/4HANA data reaches the agents through their tools, not through AI Core.

flowchart LR
  subgraph US10
    GW[calder-ai-gw] -->|agt-order-exc / agt-inv-triage| P[calder-aicore<br/>prod]
    SW[AGT_SUPPLY_WATCH] -->|agt-supply-watch| P
    B[W07 batch] -->|notif-coding| P
    LP1[AI Launchpad US] -.-> P
  end
  subgraph EU10
    E01[CP20 invoice extraction] -->|cp20-invoices| EU[calder-aicore-eu]
    LP2[AI Launchpad EU] -.-> EU
  end

Non-functional requirements.

Requirement Typical target If missed
Capacity Planned peak under 70% of each group's limit 429 at month end, agents fail together
Isolation No key crosses a stage; one workload per group A test reaches production; noisy neighbors
Data residency EU data on an EU instance, models marked Yes Compliance finding; redesign late
Cost visibility Every production group owned and labeled Nobody can explain the bill
Availability Fallback model per agent; retry on 429 One provider's outage stops the agent

Integration and identity. Apps authenticate to AI Core with OAuth client credentials from the instance's service key or binding; AI Core doesn't see the end user. The user's identity and SAP authorizations stay at the tool layer, as in agent permissions and SAP authorizations. People reach AI Launchpad through the subaccount's identity provider and role collections.

The decision to record (short ADR form from the design-doc topic):

  • Context: Calder runs three agents and a batch job on generative AI in US10 and will extract Augsburg's invoices from January 2027. CP20 data is processed in the EU (course rule). Developers held production keys in the draft.
  • Options: A) one production instance in US10 with resource groups per workload; B) A plus a second production instance in EU10 for CP20 data; C) one instance per agent.
  • Decision: B. One instance per stage in US10, an EU10 instance for CP20, a resource group with its own limit per agent, default left empty, AI Launchpad once per region.
  • Consequences: two production keys to rotate; two Launchpad fees instead of three; group setup is automated; the embedding model for cp20-invoices stays open until SAP confirms where Yes* traffic is served, due before the January go-live.

What a design review will ask.

  1. Which keys can reach production, and where are they stored?
  2. What happens to the other agents when one hits its limit at month end?
  3. Which models are Yes* in the regions with residency rules, and who accepted that?
  4. Who owns each production resource group, and who reviews its cost?
  5. Which Launchpad users can change production, and is that list reviewed?

Production concerns

  • Security and authorizations. Treat a production service key like a database password: one per consumer, in a secret store or a binding, rotated on a schedule. Keep Launchpad edit rights on production with the operations team, and review ailaunchpad_allow_all_resourcegroups holders.
  • Evaluation. Each workload's evaluation set runs in the test tenant before a model version changes in production; see Running AI on BTP.
  • Cost. Split by resource group from day one. Watch the baseline on custom models and avoid GPU plans for CPU workloads.
  • Operations. Keep the register current; automate group creation; track rate-limit requests; plan for the first orchestration API ending after 31 December 2026.
  • Clean core. AI Core runs entirely on BTP and needs nothing in S/4HANA. Agents reach S/4HANA through released APIs; see SAP API policy and third-party agents.
  • Data protection. SAP acts as data processor; you remain controller for the data you send and store, including files in your object store (Data Storage and Processing).

Where AI fits

AI Core is the AI platform, so the question here is what agents change about it. Mainly, they multiply consumers: each agent is one more workload calling models at its own rhythm, which is why resource groups per agent and limits per group become the default instead of an optimization. SAP's Learning lesson on data sharing states that AI Core resources can't be shared across tenants or resource groups and that customer data isn't used for cross-customer improvements. An AI assistant can help draft the register or a quota request, but the split itself is an architecture decision. For running many agents, see Operating an agent fleet; for traffic control per agent and user, see AI gateways.

Pitfalls

  • Stages as resource groups. A developer group in the production tenant hands developers a production key.
  • Everything in default. No separate limits, no cost per agent, and a forgotten header lands silently in someone else's group.
  • Assuming region means residency. Check for Yes* on every model a residency-bound workload uses.
  • Group limits above the tenant limit. SAP requires the tenant limit to be at least the largest group limit; request both.
  • Late quota requests. Requests go through approval. Ask before the peak, not during it.
  • One bucket, one IAM user, many groups. SAP recommends against it; give each group its own credentials.
  • Launchpad as the gate. It filters the view. Control the keys.
  • Deleting an instance casually. SAP's update page says a new standard instance can't be created after a standard or extended one is deleted, and deleting a group removes everything in it.

Exercise

Quality wants the inspection lot agent AGT_QM_WATCH (owner quality engineer 00100326) in production on anthropic--claude-4.5-sonnet, with a peak of 10 requests a minute. Finance adds a rule: every production resource group carries a cost object label.

  1. Run python unit23/aicore_tenancy.py --init so you start from the reviewed design.

  2. Open unit23/aicore/tenancy_reviewed.json. Directly under the line "resource_groups": [, paste this block (it ends with a comma), and save:

        {
          "id": "agt-qm-watch", "instance": "calder-aicore", "stage": "prod",
          "owner": "00100326", "labels": {"ext.ai.sap.com/cost-object": "CP10-920"},
          "workloads": ["AGT_QM_WATCH"], "generative_ai": true, "data": "us",
          "residency_strict": false,
          "models": [{"model": "anthropic--claude-4.5-sonnet", "peak_rpm": 10}],
          "rg_rpm_limit": {"anthropic--claude-4.5-sonnet": 15},
          "custom_model": null, "object_store": null, "orchestration_api": "v2"
        },
  3. Run python unit23/aicore_tenancy.py. You see FAIL A08 agt-qm-watch: group limit 15 but no tenant limit for anthropic--claude-4.5-sonnet and Result: 32 OK, 1 WARN, 1 FAIL. The group limit needs a tenant limit at least as high.

  4. In the same file, find the line "gpt-5.4": 60 and change it to "gpt-5.4": 60, "anthropic--claude-4.5-sonnet": 40. Save.

  5. In the script, add this rule directly above the line # A14 owners (same indentation):

        # A15 cost object on every production group (exercise)
        for g in groups:
            if inst.get(g["instance"], {}).get("stage") == "prod" and g["id"] != "default":
                cost = g.get("labels", {}).get("ext.ai.sap.com/cost-object")
                add("OK" if cost else "FAIL", "A15", f"{g['id']}: cost object {cost or 'missing'}")
  6. Run python unit23/aicore_tenancy.py --register again and open the register.

Done when: step 6 ends with Result: 39 OK, 1 WARN, 0 FAIL, shows seven A15 lines (including cp20-invoices: cost object CP20-910), and the register lists agt-qm-watch with owner 00100326 and group limit 15. Keep unit23/aicore/: Unit 23's topics on the generative AI hub and on AI Units build on this register.

Check yourself

Pick one answer for each question. The explanation appears after you choose.

1In SAP AI Core, which box should separate Calder's development work from production?

Answer: A. Authorization is based on the tenant's token from the service key, and the resource group is only a header. A developer holding a key to the production tenant can name any production group.

2Three groups share a tenant limit of 60 requests a minute for gpt-5.4, with peaks of 30, 18 and 12. What does the review flag?

Answer: C. Groups without their own limit share the tenant's, so their peaks add up to 60 of 60. Any spike returns 429 to all three; limits per group fix it.

3You request a group limit of 45 for gpt-5.4 while the tenant limit is 30. What happens in the lab, and why?

Answer: C. SAP's rate limit page says the tenant limit must be at least the largest group limit. Request both together.

4Augsburg's invoice job uses text-embedding-3-small on the EU10 instance. Why does the reviewed design still warn?

Answer: B. Yes* means available but possibly accessed from a cross-regional location for load balancing and failover. For data with a residency rule, Calder must confirm with SAP or choose a model marked Yes.

5Why does the lab fail two resource groups that use one bucket with one IAM user?

Answer: A. Object stores are registered per resource group, and SAP recommends not using the same bucket and IAM user for several groups. Separate credentials keep the workloads apart.

6A small CPU model for late-delivery prediction runs on Infer-S. What does the review suggest?

Answer: A. Custom models pay for the machine size in node hours. Starter fits a small CPU model; a separate instance would add another baseline rather than remove one.

7A developer argues that hiding the production connection in AI Launchpad is enough control. What else must you control?

Answer: C. Launchpad's custom access limits what a user sees in the Launchpad. The API accepts any caller with the tenant's key, so key custody is the real control.

8Why does the reviewed design subscribe to AI Launchpad in an EU subaccount for the EU instance?

Answer: B. SAP says Launchpad user data is saved in one region only. Prompt experiments on Augsburg's data belong in a Launchpad in the EU.
NextThe generative AI hub for architects: model catalogue, lifecycle and a model policyDecide which hub models each use case may call, in which region, under which data terms and version rules, and enforce it with an allow list.

Sources

  • Service Plans (SAP AI Core documentation, SAP-docs on GitHub) — read 2026-11-29 (repository as of 5 November 2026); Standard for production without generative AI, Extended with the generative AI hub; enterprise account, SLA; 1+ instances per subaccount; upgrade from standard to extended, no downgrade; deployment and replica quota per tenant, increase by ticket on CA-ML-AIC; 50 resource groups per tenant; five tenant-wide generic secrets; regions in SAP Discovery Center; 30-day trial for the generative AI hub
  • Multitenancy (SAP AI Core documentation, SAP-docs on GitHub) — read 2026-11-29; tenant-aware BTP reuse service; each tenant and resource group mapped to a namespace; tenant level holds workflow and serving templates, Docker registries and authentication; authorization is based on the tenant's token from the service key, the resource group is set in a request header; generic secrets and object stores per resource group; don't share one bucket and IAM user across groups; workloads sandboxed, TCP only
  • Manage Resource Groups (SAP AI Core documentation, SAP-docs on GitHub) — read 2026-11-29; resource groups isolate workloads physically and resources logically; default group created at onboarding and cannot be deleted; configurations, deployments, executions and artifacts belong to one group; scenarios, executables and Docker registry secrets shared in the tenant; a global account can hold several accounts, each associated with a tenant; 50 groups per tenant
  • Rate Limit Management (SAP AI Core documentation, SAP-docs on GitHub) — read 2026-11-29; requests per minute per model per tenant, shared by all resource groups unless configured per group; all versions share a limit; a group limit is used instead of the shared tenant quota, and the tenant limit must be at least the largest group limit; 429 can mean hyperscaler capacity; isolate workloads in separate resource groups; GET /v2/admin/quota/model; POST /v2/admin/quota/requests returns a requestId and goes through approval
  • Model Availability by Region (SAP AI Core documentation, SAP-docs on GitHub) — read 2026-11-29; Yes, Yes* (available but may be accessed from a cross-regional location for load balancing and failover) and No per region; SAP-hosted, SAP-managed and remote access types; best-effort, the model discovery endpoint is authoritative; gpt-5.4 Yes in US10 and EU10; gpt-5.4-nano Yes in US10, No in EU10; text-embedding-3-small Yes in US10, Yes* in EU10; mistralai--mistral-small Yes* in US10, Yes in EU10
  • Metering and Pricing for Custom AI (SAP AI Core documentation, SAP-docs on GitHub) — read 2026-11-29; compute in node hours, storage in gigabyte hours, baseline in tenant hours up to 730 a month once compute or storage is used; resource plans Starter, Basic, Basic.8x, Infer-S, Infer-M, Infer-L, Train-L with minimum memory and cores; instance types in SAP Note 3660109; the parent page says foundation models and grounding waive compute, storage and baseline and charge by tokens
  • What's New for SAP AI Core (SAP-docs on GitHub, read 29 November 2026) — free service plan discontinued on 2026-05-22 (SAP Note 3735945); orchestration V1 workflow API decommissioning extended from 31 October to 31 December 2026 (entry of 2026-11-03); customer-managed root keys through SAP Data Custodian KMS (2026-09-07); entries tagged Not for sovereign cloud offerings
  • Deletion (SAP AI Core documentation, SAP-docs on GitHub) — read 2026-11-29; bring your own object store; deleting an artifact deletes metadata, not the files; customers as data controllers delete data from the registered object store; SAP cleans cached data at offboarding
  • Security (SAP AI Launchpad documentation, SAP-docs on GitHub) — read 2026-11-29; default role collections such as ailaunchpad_connections_editor, ailaunchpad_allow_all_resourcegroups, ailaunchpad_mloperations_viewer and _editor, ailaunchpad_aicore_admin_editor, ailaunchpad_genai_experimenter, _manager and _administrator, and _without_genai variants; custom access per connection (allow_connections) and per resource group; user data saved in one region only; audit log data kept 30 days; data not used to train LLMs; SAP Support access through Cloud Access Manager
  • Service Plans (SAP AI Launchpad documentation, SAP-docs on GitHub) — read 2026-11-29; Standard plan for productive use, a fixed price each month for every subaccount (tenant), includes the generative AI hub; regions in SAP Discovery Center; the What Is page describes a multitenant SaaS application on BTP that connects to several AI runtime instances, which are not included in the subscription

Sign in to track your progress

We'll email you a one-time sign-in link. No password needed.

or

Tell us a little about you

Optional, every field. It helps us pitch answers to your questions at the right level and decide which topics to write next. It is never shown publicly, and you can change or clear it anytime from the account menu.

SAP areas you work in