Generative AI has leapt from research papers to daily business reality— and SAP is surfing that wave at full speed. In this hands‑on series, I’ll show you how to spin up a custom AI agent on SAP AI Core in minutes, then grow it into a production‑ready asset—without drowning in theory.
Notice
日本語版はこちらです。
What You’ll Learn in This Series
How to Run a Custom AI Agent on SAP AI Core in SecondsImplementation Using LangChain, Google Search Tool, and RAGSteps to Convert the AI Agent into a REST API, Integrate It into an SAPUI5/Fiori UI, and Deploy to Cloud Foundry
Time Commitment
Each part is designed to be completed in 10–15 minutes .
️ Series Roadmap
Part 0 ProloguePart 1 Env Setup: SAP AICore & AI LaunchpadPart 2 Building a Chat Model with LangChainPart 3 Agent Tools: Integrating Google SearchPart4 RAG Basics① HANA Cloud VectorEngine & EmbeddingPart 5 RAG Basics ②: Building Retriever ToolPart 6: Converting the AI Agent into a REST APIPart 7: Building the Chat UI with SAPUI5Part 8: Deploying to Cloud Foundry [current blog]
Note
Subsequent blogs will be published soon.
If you enjoyed this post, please give it a kudos! Your support really motivates me. Also, if there’s anything you’d like to know more about, feel free to leave a comment!
Deploying to Cloud Foundry
1 | Introduction
Let’s deploy the Python API and Fiori UI, which we’ve been developing locally, to a business-oriented PaaS environment: Cloud Foundry.
One of the key benefits of Cloud Foundry is its ability to automatically detect the appropriate buildpack, prepare the necessary runtime, and simplify tasks like scaling and service integration. In this session, we’ll aim for a “lightning-fast” production deployment using a two-pronged approach:
For the UI: mta build → cf deployFor the Python API: manifest.yaml → cf push
2 | Prerequisites
BTP sub-accountSAP AI Core instanceSAP AI LaunchPad SubscriptionPython 3.13 and pipVSCode, BAS or any IDE
Note for the Trial Environment
The HANA Cloud instance in the Trial enviroment automatically shuts down every night. If your work spans past midnight, please restart the instance the following day.
3 | Deploy to Cloud Foundry
To move the locally developed UI and API to the cloud, let’s first review the project folder structure. The UI should be set up as an MTA (Multi-Target Application) project under my-ai-agent-ui/, while the backend Python API is located in my-ai-agent-api/.
# Folder Structure:
PROJECTS
├── my-ai-agent-ui/
│ ├── mta.yaml
│ └── …
└── my-ai-agent-api/
├── main.py
└── …
We’ll start by deploying the backend. Inside the my-ai-agent-api directory, create a manifest.yaml file to define the necessary settings such as memory allocation, buildpack, and startup command.
applications:
– name: my-ai-agent-api
memory: 256M
disk_quota: 2G
instances: 1
buildpack: python_buildpack
command: gunicorn -w 1 -k uvicorn.workers.UvicornWorker main:app –bind 0.0.0.0:${PORT:-8000}
random-route: true
Next, log in to your Cloud Foundry subaccount using the CLI:
cf login -a <CF_API_Endpoint>
Then, navigate to the my-ai-agent-api folder and run:
cd my-ai-agent-api
cf push
Once deployment is complete, the console will display a routes: section—this is your public URL. Open <route>/docs in your browser, and if the FastAPI Swagger UI appears, your API is successfully hosted!
Before deploying the frontend, make sure the chat screen can correctly connect to the API hosted on the cloud. Update the ENDPOINT constant near the top of my-ai-agent-ui/webapp/controller/ChatEntity.controller.js with the URL of the Python API you just deployed to Cloud Foundry. Replace it like this:
// Switch endpoint based on environment
const ENDPOINT = (
[“localhost”, “applicationstudio”].some(h => window.location.hostname.includes(h)) ||
window.location.port === “8080”
) ? “” : “https://my-ai-agent-api-relaxed-raven-ie.cfapps.us10-001.hana.ondemand.com”;
This setup uses an empty string during local development (so it routes through the UI5 middleware proxy), and switches to the full Cloud Foundry API URL when running in the deployed environment.
Next, let’s deploy the frontend to Cloud Foundry. Move to the my-ai-agent-ui folder and run mbt build. This will generate an MTAR file in the mta_archives directory. Upload the build artifact using cf deploy to deploy the UI to the cloud:
cd ../my-ai-agent-ui
mbt build
cf deploy mta_archives/my-ai-agent-ui_0.0.1.mtar -f
After deployment, open HTML5 Applications in the BTP Cockpit. You’ll see the application displayed as a tile—click it to launch the UI.
If the chat interface fails to connect to the API, double-check the ENDPOINT constant in your code or the configured Destination URL. Make sure they match the API route you noted earlier.
4 | Challenge – Deploy to Work Zone
With SAP Build Work Zone, Standard Edition, you can easily add the HTML5 app you just deployed to an internal company portal with just a few clicks. Using the guide Integrate Your Application with SAP Build Work Zone, Standard Edition, try the following steps:
Content Sync
In the BTP Cockpit, go to Channel Manager and click Fetch Updated Content.Add App via Content Explorer
Open Content Explorer, find your app, and click Add to include it.Set Groups & Roles
Assign the app to a group—e.g., assign it to Everyone to make it available to all employees.Create a Site
In Site Directory, create a new site and drag & drop the app tile into place on the layout.
5 | Conclusion
The value of building custom AI on SAP BTP is clear: by placing both your business data and AI models on the same platform, you minimize data transfer and governance overhead. Since you can embed the AI directly into familiar SAP interfaces like Fiori and Work Zone, users can interact with AI from the screens they already know.
Moreover, with tools like MTA and AI Core supporting the entire lifecycle—from development to retraining—you can move quickly from proof of concept to production. That’s the true strength of doing AI on SAP.
By turning this setup into a reusable template, you can rapidly create new AI applications—just swap out the prompt and UI to match different use cases. Feel free to expand on it to meet your company’s specific needs.
Thanks for following along, and great job making it this far!
Disclaimer
All the views and opinions in the blog are my own and is made in my personal capacity and that SAP shall not be responsible or liable for any of the contents published in this blog.
Generative AI has leapt from research papers to daily business reality— and SAP is surfing that wave at full speed. In this hands‑on series, I’ll show you how to spin up a custom AI agent on SAP AI Core in minutes, then grow it into a production‑ready asset—without drowning in theory.Notice日本語版はこちらです。 What You’ll Learn in This SeriesHow to Run a Custom AI Agent on SAP AI Core in SecondsImplementation Using LangChain, Google Search Tool, and RAGSteps to Convert the AI Agent into a REST API, Integrate It into an SAPUI5/Fiori UI, and Deploy to Cloud FoundryTime CommitmentEach part is designed to be completed in 10–15 minutes .
️ Series RoadmapPart 0 ProloguePart 1 Env Setup: SAP AICore & AI LaunchpadPart 2 Building a Chat Model with LangChainPart 3 Agent Tools: Integrating Google SearchPart4 RAG Basics① HANA Cloud VectorEngine & EmbeddingPart 5 RAG Basics ②: Building Retriever ToolPart 6: Converting the AI Agent into a REST APIPart 7: Building the Chat UI with SAPUI5Part 8: Deploying to Cloud Foundry [current blog]NoteSubsequent blogs will be published soon.If you enjoyed this post, please give it a kudos! Your support really motivates me. Also, if there’s anything you’d like to know more about, feel free to leave a comment!Deploying to Cloud Foundry1 | IntroductionLet’s deploy the Python API and Fiori UI, which we’ve been developing locally, to a business-oriented PaaS environment: Cloud Foundry.One of the key benefits of Cloud Foundry is its ability to automatically detect the appropriate buildpack, prepare the necessary runtime, and simplify tasks like scaling and service integration. In this session, we’ll aim for a “lightning-fast” production deployment using a two-pronged approach:For the UI: mta build → cf deployFor the Python API: manifest.yaml → cf push 2 | PrerequisitesBTP sub-accountSAP AI Core instanceSAP AI LaunchPad SubscriptionPython 3.13 and pipVSCode, BAS or any IDENote for the Trial EnvironmentThe HANA Cloud instance in the Trial enviroment automatically shuts down every night. If your work spans past midnight, please restart the instance the following day. 3 | Deploy to Cloud FoundryTo move the locally developed UI and API to the cloud, let’s first review the project folder structure. The UI should be set up as an MTA (Multi-Target Application) project under my-ai-agent-ui/, while the backend Python API is located in my-ai-agent-api/.# Folder Structure:
PROJECTS
├── my-ai-agent-ui/
│ ├── mta.yaml
│ └── …
└── my-ai-agent-api/
├── main.py
└── … We’ll start by deploying the backend. Inside the my-ai-agent-api directory, create a manifest.yaml file to define the necessary settings such as memory allocation, buildpack, and startup command.applications:
– name: my-ai-agent-api
memory: 256M
disk_quota: 2G
instances: 1
buildpack: python_buildpack
command: gunicorn -w 1 -k uvicorn.workers.UvicornWorker main:app –bind 0.0.0.0:${PORT:-8000}
random-route: true Next, log in to your Cloud Foundry subaccount using the CLI:cf login -a <CF_API_Endpoint>Then, navigate to the my-ai-agent-api folder and run:cd my-ai-agent-api
cf pushOnce deployment is complete, the console will display a routes: section—this is your public URL. Open <route>/docs in your browser, and if the FastAPI Swagger UI appears, your API is successfully hosted! Before deploying the frontend, make sure the chat screen can correctly connect to the API hosted on the cloud. Update the ENDPOINT constant near the top of my-ai-agent-ui/webapp/controller/ChatEntity.controller.js with the URL of the Python API you just deployed to Cloud Foundry. Replace it like this:// Switch endpoint based on environment
const ENDPOINT = (
[“localhost”, “applicationstudio”].some(h => window.location.hostname.includes(h)) ||
window.location.port === “8080”
) ? “” : “https://my-ai-agent-api-relaxed-raven-ie.cfapps.us10-001.hana.ondemand.com”;This setup uses an empty string during local development (so it routes through the UI5 middleware proxy), and switches to the full Cloud Foundry API URL when running in the deployed environment. Next, let’s deploy the frontend to Cloud Foundry. Move to the my-ai-agent-ui folder and run mbt build. This will generate an MTAR file in the mta_archives directory. Upload the build artifact using cf deploy to deploy the UI to the cloud:cd ../my-ai-agent-ui
mbt build
cf deploy mta_archives/my-ai-agent-ui_0.0.1.mtar -fAfter deployment, open HTML5 Applications in the BTP Cockpit. You’ll see the application displayed as a tile—click it to launch the UI.If the chat interface fails to connect to the API, double-check the ENDPOINT constant in your code or the configured Destination URL. Make sure they match the API route you noted earlier. 4 | Challenge – Deploy to Work ZoneWith SAP Build Work Zone, Standard Edition, you can easily add the HTML5 app you just deployed to an internal company portal with just a few clicks. Using the guide Integrate Your Application with SAP Build Work Zone, Standard Edition, try the following steps:Content SyncIn the BTP Cockpit, go to Channel Manager and click Fetch Updated Content.Add App via Content ExplorerOpen Content Explorer, find your app, and click Add to include it.Set Groups & RolesAssign the app to a group—e.g., assign it to Everyone to make it available to all employees.Create a SiteIn Site Directory, create a new site and drag & drop the app tile into place on the layout. 5 | ConclusionThe value of building custom AI on SAP BTP is clear: by placing both your business data and AI models on the same platform, you minimize data transfer and governance overhead. Since you can embed the AI directly into familiar SAP interfaces like Fiori and Work Zone, users can interact with AI from the screens they already know.Moreover, with tools like MTA and AI Core supporting the entire lifecycle—from development to retraining—you can move quickly from proof of concept to production. That’s the true strength of doing AI on SAP.By turning this setup into a reusable template, you can rapidly create new AI applications—just swap out the prompt and UI to match different use cases. Feel free to expand on it to meet your company’s specific needs. Thanks for following along, and great job making it this far! DisclaimerAll the views and opinions in the blog are my own and is made in my personal capacity and that SAP shall not be responsible or liable for any of the contents published in this blog. Read More Technology Blog Posts by SAP articles
#SAP
#SAPTechnologyblog