Skip to content

Latest commit

 

History

History
157 lines (99 loc) · 6.37 KB

File metadata and controls

157 lines (99 loc) · 6.37 KB

Setup SAP Business Application Studio and your personal development space

SAP Business Application Studio is based on Code-OSS, an open-source project used for building Visual Studio Code. Available as a cloud service, SAP Business Application Studio (BAS) provides a desktop-like experience similar to leading IDEs, with command line and optimized editors.

At the heart of SAP Business Application Studio are the dev spaces. The dev spaces are comparable to isolated virtual machines in the cloud containing tailored tools and pre-installed runtimes per business scenario, such as SAP Fiori, SAP S/4HANA extensions, Workflow, HANA native development and more. This simplifies and speeds up the setup of your development environment, enabling you to efficiently develop, test, build, and run your solutions locally or in the cloud.

Open SAP Business Application Studio

👉 Go back to the BTP cockpit.

👉 Navigate to Instances and Subscriptions and open SAP Business Application Studio.

Open BAS

Create a new Dev Space for CodeJam exercises

👉 Create a new Dev Space.

Create a Dev Space 1

👉 Enter the name of the dev space GenAICodeJam_XX, select the Basic kind of application and Python Tools from Additional SAP Extensions.

Replace the XX with your initials.

👉 Click Create Dev Space.

Create a Dev Space 2

You should see the dev space STARTING.

Dev Space is Starting

👉 Wait for the dev space to get into the RUNNING state and then open it.

Dev Space is Running

Clone the exercises from the Git repository

👉 Once you opened your dev space in BAS, use one of the available options to clone this Git repository with exercises using the URL below:

https://github.com/SAP-samples/codejam-code-based-agents.git

Clone the repo

👉 Click Open to open a project in the Explorer view.

Open a project

Configure the connection details to Generative AI Hub

👉 Create a new file .env in the /project/Python/starter-project/.env directory (click on the link to create the file).

👉 Add the following variables to your .env file:

LITELLM_PROVIDER="sap"
AICORE_AUTH_URL="https://#####.authentication.eu10.hana.ondemand.com/oauth/token"
AICORE_CLIENT_ID="sb-3c636fc2-d352-496a-851d-7a7d6005dcd4!b505946|aicore!b540"
AICORE_CLIENT_SECRET="#####"
AICORE_RESOURCE_GROUP="ai-agents-codejam"
AICORE_BASE_URL="https://api.ai.prod.eu-central-1.aws.ml.hana.ondemand.com"
RPT1_DEPLOYMENT_URL="https://api.ai.prod.eu-central-1.aws.ml.hana.ondemand.com/v2/inference/deployments/###/predict"

👉 You will need to UPDATE these variables but keep the given structure. The correct information you can find in the SAP AI Core service-key in your BTP cockpit.

👉 Go back to the Subaccount in the BTP cockpit.

👉 Navigate to Instances and Subscriptions and open the SAP AI Core instance's service binding.

Service Binding in the BTP Cockpit

👉 Make sure the correct resource group AICORE_RESOURCE_GROUP is assigned, we will use ai-agents-codejam for this CodeJam.

☝️ You will update the RPT-1_DEPLOYMENT_URL in a later exercise.

Create a Python virtual environment and install the LiteLLM and CrewAI

👉 Start a new Terminal.

Start terminal

👉 Verify your Python version is compatible with CrewAI (requires Python 3.10, 3.11, 3.12, or 3.13):

python3 --version

⚠️ Important: CrewAI requires Python 3.10 or newer (up to 3.13). If your Python version is 3.9 or older, install a compatible version first.

  • macOS: Use Homebrew to install Python 3.11: brew install python@3.11, then use python3.11 in the commands below.
  • Linux: Install Python 3.11 with your distro package manager, for example:
    • Ubuntu/Debian: sudo apt update && sudo apt install python3.11 python3.11-venv
    • Fedora/RHEL: sudo dnf install python3.11 Then use python3.11 in the commands below.
  • Windows: Install Python 3.11 from the official Python downloads page and make sure Add python.exe to PATH is enabled during installation. Then use python (or py -3.11) in the commands below.

👉 Create a virtual environment using the following command:

python3 -m venv ~/projects/codejam-code-based-agents/env --upgrade-deps

Or use the variant that matches your OS/shell if not in BAS:

# macOS / Linux
python3 -m venv ~/projects/codejam-code-based-agents/env --upgrade-deps
# Windows (PowerShell)
python -m venv .\env --upgrade-deps

👉 Activate the env virtual environment like this and make sure it is activated:

source ~/projects/codejam-code-based-agents/env/bin/activate

Use the activation command for your environment:

# macOS / Linux
source ~/projects/codejam-code-based-agents/env/bin/activate
# Windows (PowerShell)
.\env\Scripts\Activate.ps1
:: Windows (Command Prompt)
.\env\Scripts\activate.bat

ℹ️ If PowerShell blocks script execution, run Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass and then run ./env/Scripts/Activate.ps1 again.

venv

👉 Install LiteLLM, CrewAI, and python-dotenv using the following pip install commands.

pip install litellm==1.82.6 crewai python-dotenv

In case you see a message in BAS asking you to create an isolated environment, click on Don't show again.

bas-message

Let's start coding

Next exercise