Custom Agentic Chatbot with SAP AI Core and Joule Studio — Part 2 (1)

🚀 Series Overview: Custom Agentic Chatbot with SAP AI Core and Joule Studio

Part 1 — Building the Custom AI Agent BackendPart 2 (1) — Deploying the Agent on AI Core (Environment & Containerization)Part 2 (2) — Deploying the Agent on AI Core (Deployment & Testing)Part 3 (1) — Setting Up Joule Studio Connection (Destination & Environment)Part 3 (2) — Creating a Joule Skill (Design & Release)Part 3 (3) — Testing and Sharing on Work Zone

 

Part 2 (1) — Deploying the Agent on AI Core (Environment & Containerization)

 
Now that we have our custom agentic chatbot backend code (Part 1), the next step is to make it enterprise-ready by deploying it to SAP AI Core. This ensures the agent runs in a scalable, secure, and managed environment, and provides a REST inference endpoint that can be consumed by Joule Studio.

By the end of this section, you will:

Have an AI Core workspace, resource group, and secrets set upBuild and push your chatbot backends as a Docker imageDefine a ServingTemplate YAML file for deployment

 

What is AI Core?

SAP AI Core is a managed service that lets you deploy and operate AI workloads at scale. Instead of running your model on a single machine, AI Core provides containerized deployments, auto-scaling, and secure integration with the rest of SAP BTP. This is what transforms a local prototype into a service that enterprises can reliably consume.

 

How to Deploy in AI Core?

Before jumping into the detailed setup, note that all configuration for AI Core, including workspace, resource group, Git repositories, and secrets, can be conveniently managed through the SAP AI Launchpad. In this guide, we’ll demonstrate the Launchpad-based setup since it’s the most intuitive starting point. 

 

1. Preparing AI Core Environment

Before deploying, we first configure the AI Core environment. Think of this step as laying the foundation before placing your container on top.

Step 1. Create a Workspace

A workspace is a logical container to organize your AI projects.

Step 2. Create a Resource Group

Resource groups help organize deployments and credentials. They also provide isolation so you can manage access by project or environment.

 

Step 3. Add Git Repositories

Connect your GitHub repository so AI Core can fetch deployment configuration (e.g., ServingTemplate YAML)

 

Step 4. Create an Application

Define the application that will consume AI Core resources.

 

Step 5. Create Generic Secrets

Store sensitive credentials (API keys, DB credentials, OAuth tokens) securely instead of hardcoding or push to shared repository. These secrets will later be referenced inside the YAML envFrom section.

 ⚠️ Secrets must be in JSON format and Base64 encoded

Example:

{
“LANGCHAIN_API_KEY”: “YOUR_LANGCHAIN_API_KEY_ENCODED”,
“WEATHER_API_KEY”: “YOUR_WEATHER_API_KEY_ENCODED”,
“GOOGLE_CLIENT_ID”: “YOUR_GOOGLE_CLIENT_ID_ENCODED”,
“GOOGLE_CLIENT_SECRET”:”YOUR_GOOGLE_CLIENT_SECRET_ENCODED”
}

 

2. Containerization

Next, package your Flask backend into a Docker image. This step ensures your code runs the same way across environments.

Step 1. Create a Docker file

FROM python:3.11

# Copies file from your Local system to path in Docker image
COPY AgentBuilder.py .
COPY Utils.py .
COPY app.py .
COPY requirements.txt .
COPY prompt_lib.py .

# Installs dependencies
pip install -r requirements.txt

CMD [“gunicorn”,”–worker-class”, “eventlet”, “-w”, “1”, “–bind”, “0.0.0.0:5000”, “–timeout”, “1200”, “–keep-alive”, “2”,”–max-requests”, “1000”, “–preload-app”, “app:app”]

Step 2. Build & Push the Image

docker build -t <registry>/<repo>/agentic-chatbot:<version> .
docker push <registry>/<repo>/agentic-chatbot:<version>

 

3. Define the Serving Template

In SAP AI Core, deployments are defined by a ServingTemplate YAML file. This tells AI Core how to run your container, which port to expose, and how to allocate resources.
Example:

At this stage, your environment and container are ready for deployment.

👉In the next section, we’ll actually deploy the container, test the live endpoint, and confirm that it’s ready to connect with Joule Studio.

 

 

​ 🚀 Series Overview: Custom Agentic Chatbot with SAP AI Core and Joule StudioPart 1 — Building the Custom AI Agent BackendPart 2 (1) — Deploying the Agent on AI Core (Environment & Containerization)Part 2 (2) — Deploying the Agent on AI Core (Deployment & Testing)Part 3 (1) — Setting Up Joule Studio Connection (Destination & Environment)Part 3 (2) — Creating a Joule Skill (Design & Release)Part 3 (3) — Testing and Sharing on Work Zone Part 2 (1) — Deploying the Agent on AI Core (Environment & Containerization) Now that we have our custom agentic chatbot backend code (Part 1), the next step is to make it enterprise-ready by deploying it to SAP AI Core. This ensures the agent runs in a scalable, secure, and managed environment, and provides a REST inference endpoint that can be consumed by Joule Studio. By the end of this section, you will:Have an AI Core workspace, resource group, and secrets set upBuild and push your chatbot backends as a Docker imageDefine a ServingTemplate YAML file for deployment What is AI Core?SAP AI Core is a managed service that lets you deploy and operate AI workloads at scale. Instead of running your model on a single machine, AI Core provides containerized deployments, auto-scaling, and secure integration with the rest of SAP BTP. This is what transforms a local prototype into a service that enterprises can reliably consume. How to Deploy in AI Core?Before jumping into the detailed setup, note that all configuration for AI Core, including workspace, resource group, Git repositories, and secrets, can be conveniently managed through the SAP AI Launchpad. In this guide, we’ll demonstrate the Launchpad-based setup since it’s the most intuitive starting point.  1. Preparing AI Core EnvironmentBefore deploying, we first configure the AI Core environment. Think of this step as laying the foundation before placing your container on top.Step 1. Create a WorkspaceA workspace is a logical container to organize your AI projects.Step 2. Create a Resource GroupResource groups help organize deployments and credentials. They also provide isolation so you can manage access by project or environment. Step 3. Add Git RepositoriesConnect your GitHub repository so AI Core can fetch deployment configuration (e.g., ServingTemplate YAML) Step 4. Create an ApplicationDefine the application that will consume AI Core resources. Step 5. Create Generic SecretsStore sensitive credentials (API keys, DB credentials, OAuth tokens) securely instead of hardcoding or push to shared repository. These secrets will later be referenced inside the YAML envFrom section. ⚠️ Secrets must be in JSON format and Base64 encodedExample:{
“LANGCHAIN_API_KEY”: “YOUR_LANGCHAIN_API_KEY_ENCODED”,
“WEATHER_API_KEY”: “YOUR_WEATHER_API_KEY_ENCODED”,
“GOOGLE_CLIENT_ID”: “YOUR_GOOGLE_CLIENT_ID_ENCODED”,
“GOOGLE_CLIENT_SECRET”:”YOUR_GOOGLE_CLIENT_SECRET_ENCODED”
}  2. ContainerizationNext, package your Flask backend into a Docker image. This step ensures your code runs the same way across environments.Step 1. Create a Docker fileFROM python:3.11

# Copies file from your Local system to path in Docker image
COPY AgentBuilder.py .
COPY Utils.py .
COPY app.py .
COPY requirements.txt .
COPY prompt_lib.py .

# Installs dependencies
pip install -r requirements.txt

CMD [“gunicorn”,”–worker-class”, “eventlet”, “-w”, “1”, “–bind”, “0.0.0.0:5000”, “–timeout”, “1200”, “–keep-alive”, “2”,”–max-requests”, “1000”, “–preload-app”, “app:app”] Step 2. Build & Push the Imagedocker build -t <registry>/<repo>/agentic-chatbot:<version> .
docker push <registry>/<repo>/agentic-chatbot:<version> 3. Define the Serving TemplateIn SAP AI Core, deployments are defined by a ServingTemplate YAML file. This tells AI Core how to run your container, which port to expose, and how to allocate resources.Example:At this stage, your environment and container are ready for deployment.👉In the next section, we’ll actually deploy the container, test the live endpoint, and confirm that it’s ready to connect with Joule Studio.    Read More Technology Blog Posts by SAP articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author