Configure
Essential Environment Variables (.env file)
# SAP AI Core
SAP_CLIENT_ID=your_client_id
SAP_CLIENT_SECRET=your_client_secret
SAP_AUTH_URL=https://your-auth-url
SAP_AI_API_URL=https://your-ai-api-url
SAP_IDENTITY_ZONE=your_identity_zone
# Database
DB_CONFIG_DISCOVERY_URL_BASE=https://your-config-server
# Application Settings
DEFAULT_MODEL=gpt-4o
DEFAULT_TEMPERATURE=0.3
DEFAULT_MAX_TOKENS=1500
# Optional Integrations
MICROSOFT_CLIENT_ID=your_ms_client_id
SHAREPOINT_SITE_URL=https://your-sharepoint-site
Configuration File Reference
| File | Purpose |
|---|---|
.env | Environment variables and secrets |
config.py | Application configuration classes |
manifest.yaml | Deployment configuration (CF push settings) |
config/ | Environment-specific settings and prompts |
Key Configuration Classes
| Class | Purpose |
|---|---|
SAPAICoreConfig | SAP integration settings and model defaults |
ConfigCache | Performance-optimized configuration caching |
ConfigLoader | Dynamic configuration loading per request |
Multi-Tenant Configuration
Each tenant environment (DEV, SBX, PROD) can have its own:
- HANA database connection
- FAISS vector store
- Prompt templates and model settings
- SharePoint and integration credentials Tenant resolution is automatic — driven by the JWT token presented at runtime.
Tenant Configuration Files (Config Server)
All per-environment configuration is stored on the CherryWork Config Server and loaded dynamically at runtime. The folder structure on the config server mirrors the tenant layout shown below.
Folder Structure:
cherry-bot/
├── apa_dev/
├── itm/
├── scp_dev/
│ ├── db_configs.json
│ └── prompt_template.txt
├── soa_dev/
└── soa_qa/
application_properties.json
applications.json
applications.json — Tenant Registry
This is the master registry that maps each tenant key to its config URLs (DB config, MCP server, queries, etc.). The app reads this file at startup to discover all tenant environments.
{
"itm": [
"https://cherryworkproducts-config-server.../cherry-bot/itm/queries.txt",
"https://cw-mcp-server.cfapps.eu10-004.hana.ondemand.com/mcp/nwf",
"...similar_queries.yaml"
],
"scp_dev": [
"https://cherryworkproducts-config-server.../cherry-bot/scp_dev/db_configs.json",
"https://cw-mcp-server.cfapps.eu10-004.hana.ondemand.com/mcp/scp",
""
],
"scp_qa": [
"https://cherryworkproducts-config-server.../cherry-bot_qa/scp_qa/db_configs.json",
"https://cw-mcp-server-qa.cfapps.eu10-004.hana.ondemand.com/mcp/scp",
""
],
"soa_qa": [
"https://cherryworkproducts-config-server.../cherry-bot_qa/soa_qa/db_configs.json",
"https://cw-mcp-server.cfapps.eu10-004.hana.ondemand.com/mcp/soa",
"...queries.txt",
"...similar_queries.yaml"
],
"CHERRY_BOT_APP_KEY": "itm"
}
Array index meaning per tenant entry:
| Index | Content |
|---|---|
[0] | db_configs.json URL — HANA database connection for that tenant |
[1] | MCP server URL — external tool/service integration endpoint |
[2] | queries.txt URL — sample/similar queries for that tenant (if applicable) |
[3] | similar_queries.yaml URL — semantic query matching config (if applicable) |
CHERRY_BOT_APP_KEYsets the default active tenant when no tenant is specified in the JWT. Currently set to"itm".
To add a new tenant environment, add a new key to this file with its corresponding config URLs and redeploy (or trigger a config refresh).
db_configs.json — HANA Database Connection (Per Tenant)
Each tenant folder contains its own db_configs.json with isolated HANA credentials and table definitions.
{
"database": "hana",
"hana": {
"hana_address": "<tenant-hana-host>.hanacloud.ondemand.com",
"hana_port": 443,
"hana_encrypt": "true",
"hana_user": "CW-SCP-DEV",
"hana_sslValidateCertificate": "True",
"hana_password": "<password>"
},
"TABLES_TO_EXTRACT": [
"CW_SCP_PO_HEADER_TXN",
"CW_SCP_PO_LINE_ITEM_TXN"
]
}
Field reference:
| Field | Description |
|---|---|
database | Database type — always "hana" |
hana_address | HANA Cloud instance hostname |
hana_port | Always 443 for HANA Cloud |
hana_encrypt | Must be "true" for cloud connections |
hana_user | DB user for this tenant environment |
hana_sslValidateCertificate | SSL validation — set "True" in production |
hana_password | DB user password (store securely; never commit to Git) |
TABLES_TO_EXTRACT | List of HANA tables the SQL Generator is allowed to query for this tenant |
Each tenant environment (DEV, QA, PROD) has its own
db_configs.jsonwith separate credentials and table lists.
prompt_template.txt — Environment Prompt (Per Tenant)
Each tenant folder optionally contains a prompt_template.txt which defines the system prompt and behavior instructions for the LLM in that environment. This allows per-tenant customization of tone, domain focus, and response style without any code changes.
To update the prompt for a tenant: edit the prompt_template.txt in the corresponding folder on the Config Server and trigger a config reload (or restart the app).
MCP Server Configuration
Environment Variables
All configuration is provided via environment variables — no code changes are needed across environments.
| Variable | What It Controls | Example |
|---|---|---|
FAISS_INDEX_PATH | Location of the FAISS vector index file | faiss_index/soa_dev/index.faiss |
DB_CONN | Database connection string | jdbc:sap://... |
| API Keys | Authentication for model and service backends | Set per environment |
| Model Endpoints | Which LLM backend to call | AI Core service URL |
Environment-Based Service Routing (config.yaml)
Controls which backend URLs are used per environment. Change current_environment to switch routing without touching any tool definitions.
service_name: "soa"
display_name: "Sales Order Management"
environments:
dev:
destinations:
soa:
base_url: "https://dev-service-url"
qa:
destinations:
soa:
base_url: "https://qa-service-url"
current_environment: "dev" # Change this to switch environments
Defining Tools (tools.yaml)
Each tool is declared with its name, description, HTTP method, endpoint, and parameters:
version: "1.0"
tools:
- name: get_top_item_quantity
description: Fetch top-selling items within a date range
destination: soa
method: GET
endpoint: /api/dashboard/getTopItemQuantity
parameters:
- name: startDate
type: string
required: true
description: Start date (MMDDYYYY)
location: query
- name: endDate
type: string
required: true
description: End date (MMDDYYYY)
location: query
- name: limit
type: integer
required: false
default: 10
location: query
response:
type: json
Configuration File Reference
| File | Purpose |
|---|---|
config.yaml | Environment-based service routing |
tools.yaml | Tool definitions (name, endpoint, parameters) |
manifest.yaml | Service and tool metadata registry |
db_config.py | Database configuration |