|
| 1 | +--- |
| 2 | +title: "SAP AI Core" |
| 3 | +description: "Learn how to configure SAP AI Core models for kagent." |
| 4 | +--- |
| 5 | + |
| 6 | +export const metadata = { |
| 7 | + title: "Configuring SAP AI Core models in kagent", |
| 8 | + description: "Learn how to configure SAP AI Core models for kagent.", |
| 9 | + author: "kagent.dev" |
| 10 | +}; |
| 11 | + |
| 12 | +## Configuring SAP AI Core |
| 13 | + |
| 14 | +kagent connects to SAP AI Core through its [Orchestration Service](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/orchestration), which provides a unified endpoint for models from multiple families, including Anthropic, OpenAI, Gemini, Amazon, Meta, and Mistral. Authentication uses OAuth2 client credentials from your SAP AI Core service key. |
| 15 | + |
| 16 | +1. Create a Kubernetes Secret that stores the OAuth2 client credentials. The Secret must contain two keys, `client_id` and `client_secret`. Replace the placeholder values with the credentials from your SAP AI Core service key. |
| 17 | + |
| 18 | + ```shell |
| 19 | + export SAP_AI_CORE_CLIENT_ID=<your_client_id> |
| 20 | + export SAP_AI_CORE_CLIENT_SECRET=<your_client_secret> |
| 21 | + kubectl create secret generic kagent-sapaicore -n kagent \ |
| 22 | + --from-literal client_id=$SAP_AI_CORE_CLIENT_ID \ |
| 23 | + --from-literal client_secret=$SAP_AI_CORE_CLIENT_SECRET |
| 24 | + ``` |
| 25 | + |
| 26 | + Unlike other providers, the `apiKeySecretKey` field on the `ModelConfig` is not used for SAP AI Core. The keys `client_id` and `client_secret` are read directly from the Secret. |
| 27 | + |
| 28 | +2. Create a `ModelConfig` resource that references the Secret and specifies the SAP AI Core endpoint, resource group, and OAuth2 token endpoint. You can find these values in your SAP AI Core service key. |
| 29 | + |
| 30 | + ```yaml |
| 31 | + kubectl apply -f - <<EOF |
| 32 | + apiVersion: kagent.dev/v1alpha2 |
| 33 | + kind: ModelConfig |
| 34 | + metadata: |
| 35 | + name: sapaicore-model-config |
| 36 | + namespace: kagent |
| 37 | + spec: |
| 38 | + apiKeySecret: kagent-sapaicore |
| 39 | + model: anthropic--claude-4.5-sonnet |
| 40 | + provider: SAPAICore |
| 41 | + sapAICore: |
| 42 | + baseUrl: "https://api.ai.prod.eu-central-1.aws.ml.hana.ondemand.com" |
| 43 | + authUrl: "https://<your-tenant>.authentication.eu10.hana.ondemand.com" |
| 44 | + resourceGroup: "default" |
| 45 | + EOF |
| 46 | + ``` |
| 47 | + |
| 48 | + | Field | Required | Description | |
| 49 | + | --- | --- | --- | |
| 50 | + | `apiKeySecret` | Yes | Name of the secret that contains the OAuth2 client credentials. | |
| 51 | + | `model` | Yes | Model names follow the Orchestration Service naming convention, such as `anthropic--claude-4.6-sonnet`, `gpt-5-mini`, or `gemini-3-pro-preview`. For the full list of supported models, see the [SAP AI Core Orchestration Service documentation](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/models-and-scenarios-in-generative-ai-hub). | |
| 52 | + | `provider` | Yes | Provider name. Must be `SAPAICore`. | |
| 53 | + | `sapAICore.baseUrl` | Yes | Base URL for the SAP AI Core API. | |
| 54 | + | `sapAICore.authUrl` | No | OAuth2 token endpoint URL. | |
| 55 | + | `sapAICore.resourceGroup` | No | Resource group in SAP AI Core. Defaults to `default`. | |
| 56 | + |
| 57 | +After the resource is applied, you can select the model from the **Model** dropdown in the UI when creating or updating agents. |
0 commit comments