Spartacus library to use CXII Assistant and Ask Product API.
- CXAI Assistant library for use with CXAI assistant API.
- CXAI Ask Product library for use with CXAI Ask Product API.
This instruction is for Composable Storefront library. If you use Accelerator see Accelerator Addon
To use with JDK17 SAP Commerce Cloud, use jdk17 branch.
Note: jdk17 branch is no longer receiving updates, last version for it is 2211.47.1
You need Commerce instance integrated with CX AI Toolkit
This guide allows you to quickly connect the component with your Spartacus application using default backend extensions.
-
Add https://github.com/SAP-samples/cxii-commerce-extn as a git submodule to your codebase (jdk21 branch)
git submodule add -b jdk21 https://github.com/SAP-samples/cxii-commerce-extn(usually insidecore-customize) -
Add https://github.com/SAP-samples/cxii-shopping-assistant-ui-component as a git submodule to your codebase (jdk21 branch)
git submodule add -b jdk21 https://github.com/SAP-samples/cxii-shopping-assistant-ui-component -
Add
cxaiocc,cxaibackoffice,cxaiaskproductocctomanifest.jsonorlocalextensions.xml -
Deploy with migrate data (update system)
Run impex with toolkit configuration. Enable code execution toggle in hac to respect if directives.
Adjust values in <braces> to your local environment.
# Site for which the configuration is applied
$siteUid = <site-uid>
# VS / assistant
$toolkitProdUrl = https://<usea-prod>.cxai.cloud.sap
$visualSearchProdUrl = $toolkitProdUrl/vision/api/v2
$assistantProdUrl = $toolkitProdUrl/shopping-assistant/api/v1
# Ask about product (you can leave it as-is if not used)
$askProductProdUrl = https://ai-assistant-<usea-prod>-api.cxai.cloud.sap
# Created by toolkit integration - <org-id> is your toolkit organisation id.
# You can also find this in Backoffice ConsumedOauthCredentials
$toolkitCredentialId = CXAICredentials_<org-id>
$askProductCredentialId = CXAIToolkitCredentials_<org-id>
# Assistant Config ID if already created by the API, otherwise ignore it for now
$assistantConfigIdProd = <CONFIG_67658b0c...>
INSERT_UPDATE ConsumedDestination; id[unique = true] ; url ; destinationTarget(id); credential(id) ; active[default = true]
; visual-search-prod ; $visualSearchProdUrl ; Default_Template ; $toolkitCredentialId ;
; ask-product-prod ; $askProductProdUrl ; Default_Template ; $askProductCredentialId ;
# empty values are taken from spartacus provideConfig, concrete values overwrite spartacus config
INSERT_UPDATE CxaiConfig; code[unique = true]; baseSites(uid); consumedDestination(id); askProductDestination(id); active[default = false];
; prod-$siteUid ; $siteUid ; visual-search-prod ; ask-product-prod ;
#% if: "$assistantConfigIdProd".startsWith("CONFIG_")
INSERT_UPDATE CxaiAssistantConfig; cxaiConfig(code) ; configId[unique = true];
; prod-$siteUid ; $assistantConfigIdProd
UPDATE CxaiConfig; code[unique = true]; assistantConfig(configId)
; prod-$siteUid ; $assistantConfigIdProd
#% endif:
UPDATE CxaiConfig; code[unique = true]; active
; prod-$siteUid ; true- Open Backoffice / CX AI Configuration and select configuration that you've just created.
If you can't see this section press F4 - reset everything - F4. If still can't see make sure
cxaibackofficeextension is loaded inhac - Open Assistant tab.
- If there is no Assistant configuration, open the dropdown and select Create CX AI Assistant Config.

- Paste the following json into Config definition (JSON), adjust
site_idandcatalog_idto your environment, and press Save.
{
//this will be displayed only in toolkit UI "Agents"
"agent_name": "CX AI Assistant",
"agent_description": "Shopping Assistant",
"is_active": true,
//can be overwritten by Spartacus translations
"initial_message": "Hello! How can I help you today?",
"catalog_id": "{site}ProductCatalog",
"catalog_version": "Online",
"site_id": "{site}",
//can be empty - what kind of products are available in catalog (e.g. fashion, electronics ...)
"classification": "",
"sub_agents": [
{
"name": "PriceRecommendationAgent",
"is_active": true
},
{
"name": "SelfServiceAgent",
"is_active": true
},
{
"name": "OrderStatusAgent",
"is_active": true
},
{
"name": "AddToCartAgent",
"is_active": true
},
{
"name": "StockAgent",
"is_active": true,
"features": {
"show_out_of_stock_recommendations": true,
"allow_specific_quantity_stock_queries": false
}
}
],
"global_settings": {
"default_language": "en-us",
// formal, casual ...
"tone": "formal"
}
}Save should be successful if CX AI credentials are correct. If there is an error, verify credentials and URL on Basic tab Consumed Destination.
- Save CX AI Config with Assistant configuration filled in.
Hint: You can also see your newly created Configuration in CX AI Toolkit AI Agents section
Run the following impex to add components to CMS slots. You can adjust slot names (ProductSummarySlot, FooterSlot). If you use only one component then use only relevant half of this impex. Run the impex in Online $version, or synchronize components from Backoffice after they are created in Staged.
$contentCatalog = <site>ContentCatalog
$version = Staged
$contentCV = catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalog]), CatalogVersion.version[default=$version])[default=$contentCatalog:$version]
##### Ask the Product ########
INSERT_UPDATE CMSFlexComponent; $contentCV[unique = true]; uid[unique = true] ; name ; flexType
; ; CxaiAskProductChatComponent ; CxaiAskProductChatComponent ; CxaiAskProductChatComponent
INSERT_UPDATE AskProductRestriction; $contentCV[unique = true]; uid[unique = true] ; name ; components(uid, $contentCV)
; ; AskProductRestriction ; Ask Product Restriction ; CxaiAskProductChatComponent
# (+?) = append if not already appended
INSERT_UPDATE ContentSlot; $contentCV[unique = true]; uid[unique = true] ; cmsComponents(uid, $contentCV)
; ; ProductSummarySlot ; (+?)CxaiAskProductChatComponent
##### Assistant ########
INSERT_UPDATE CMSFlexComponent; $contentCV[unique = true]; uid[unique = true] ; name ; flexType
; ; AssistantChatFloatComponent ; AssistantChatFloatComponent ; AssistantChatFloatComponent
INSERT_UPDATE AssistantRestriction; $contentCV[unique = true]; uid[unique = true] ; name ; components(uid, $contentCV)
; ; AssistantRestriction ; Assistant Restriction ; AssistantChatFloatComponent
INSERT_UPDATE ContentSlot; $contentCV[unique = true]; uid[unique = true]; cmsComponents(uid, $contentCV)
; ; FooterSlot ; (+?)AssistantChatFloatComponent- Open latest release and add libraries to your
package.json npm install- Import
CxaiAskProductFeatureModuleandCxaiAssistantFeatureModuleinto yourapp.moduleimports[] array.
import { CxaiAskProductFeatureModule } from '@cx-spartacus/cxai-ask-product/feature';
import { CxaiAssistantFeatureModule } from '@cx-spartacus/cxai-assistant/feature';
//then add to imports[]ng serve- By default you need to log in to use the components (OCC API is restricted)
- If you want to allow anonymous user access set
cxai.anonymous.api.access.enabled=truein hac / properties - If you don't want to allow anonymous access add
loggedInUserrestriction toCMSFlexComponents
UPDATE AbstractCMSComponent; uid[unique = true] ; onlyOneRestrictionMustApply; restrictions(uid,$contentCV); $contentCV[unique = true]; ; AssistantChatFloatComponent ; false ; (-)loggedInUser,(+)loggedInUser ; CxaiAskProductChatComponent ; false ; (-)loggedInUser,(+)loggedInUser
- If you want to allow anonymous user access set
If successful, you should be able to see chat component on every page (bottom right) and ask product component on product pages.

- If you can't see the components, try logging in or adjust
cxai.anonymous.api.access.enabledproperty in hac - If you get
401response from ask-product (despite correct credentials) make sure you configured IAS client id in toolkit Organization Management - it should be the same as inCXAIToolkitCredentials_<org-id>ConsumedOauthCredentialscreated in Commerce after integrating with Toolkit. - Make sure you use proper URL formats in
ConsumedDestination, exactly as specified in the sample impexhttps://{usea-prod}.cxai.cloud.sap/vision/api/v2(in Basic tab)- Example of wrong URL: https://api-{usea-prod}.cxai.cloud.sap /cxai/...
- https://ai-assistant-{usea-prod}.cxai.cloud.sap/ for ask product API (Ask product tab)
- Make sure CX AI Config is
Activein backoffice, and connected with a valid base site./occ/v2/{siteUid}/cxai/configOCC endpoint should return an object includingassistantConfigId(as assigned in Assisant tab) - Error
Content type 'application/json;charset=UTF-8' is not supported:MappingJackson2HttpMessageConverterandStringHttpMessageConvertermust be registered in OCC converters chain- Default configuration registers them:
WebConfig.configureMessageConverters→super.addDefaultHttpMessageConverters(converters)- if this was disabled you have to add above converters to the end ofmessageConvertersV2explicitly
After finishing this quick start guide you can check detailed documentation:
- Spartacus Workspace README (how to customize, develop and debug the components)
- Backend README Libraries require backend layer to communicate with toolkit API
- For production it is advised to fork / mirror original repositories (then add forks / mirrors as a submodules)
Create an issue in this repository if you find a bug or have questions about the content.
For additional support, ask a question in SAP Community.
For CX AI Toolkit backend support see https://help.sap.com/docs/cx-ai-toolkit/onboarding/getting-support
If you wish to contribute code, offer fixes or improvements, please send a pull request. Due to legal reasons, contributors will be asked to accept a DCO when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses the standard DCO text of the Linux Foundation.
Copyright (c) 2026 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

