Skip to main content
Version: 2.0.0

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

FilePurpose
.envEnvironment variables and secrets
config.pyApplication configuration classes
manifest.yamlDeployment configuration (CF push settings)
config/Environment-specific settings and prompts

Key Configuration Classes

ClassPurpose
SAPAICoreConfigSAP integration settings and model defaults
ConfigCachePerformance-optimized configuration caching
ConfigLoaderDynamic 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:

IndexContent
[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_KEY sets 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:

FieldDescription
databaseDatabase type — always "hana"
hana_addressHANA Cloud instance hostname
hana_portAlways 443 for HANA Cloud
hana_encryptMust be "true" for cloud connections
hana_userDB user for this tenant environment
hana_sslValidateCertificateSSL validation — set "True" in production
hana_passwordDB user password (store securely; never commit to Git)
TABLES_TO_EXTRACTList of HANA tables the SQL Generator is allowed to query for this tenant

Each tenant environment (DEV, QA, PROD) has its own db_configs.json with 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.

VariableWhat It ControlsExample
FAISS_INDEX_PATHLocation of the FAISS vector index filefaiss_index/soa_dev/index.faiss
DB_CONNDatabase connection stringjdbc:sap://...
API KeysAuthentication for model and service backendsSet per environment
Model EndpointsWhich LLM backend to callAI 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

FilePurpose
config.yamlEnvironment-based service routing
tools.yamlTool definitions (name, endpoint, parameters)
manifest.yamlService and tool metadata registry
db_config.pyDatabase configuration