Analytics Legends The knowledge platform for SAP Analytics
Academy module

CAP and the SAP Cloud SDK for AI — Building an AI Extension

CAP and the SAP Cloud SDK for AI — Building an AI Extension — Analytics Legends section illustration for the SAP Analytics knowledge base (concepts, studies, Academy)

As of 2026-09-25

A pro-code module for CAP developers and architects adding generative AI to a shipped CAP service. It covers the SAP Cloud SDK for AI's six JavaScript packages (orchestration, foundation-models, langchain, document-grounding, prompt-registry, ai-api), CAP's native Vector CDS type and vector_embedding()/cosine_similarity() functions that close a RAG loop without a separate database, why the CAP LLM plugin (archived 16 June 2026) is no longer a supported path, and the @cap-js/mcp adapter that turns an @mcp-annotated CAP service into an MCP server with describe/query/call tools — paired with SAP's own warning that this is not an endorsed architecture for exposing SAP application APIs without checking SAP API Policy section 2.2.2.

What you will learn

  • Name the two supported SAP-specific building blocks for generative AI in a CAP project and explain why the CAP LLM plugin (archived 16 June 2026) is no longer one of them
  • Choose the correct SAP Cloud SDK for AI package (orchestration, foundation-models, langchain, document-grounding, prompt-registry, ai-api) for a given CAP requirement
  • Write a CDS `Vector` column declaration with `vector_embedding()` and a CQL similarity query using `cosine_similarity()`
  • Sketch an orchestration-service call from a CAP action handler using the SDK's real package and method names
  • Expose a CAP service as MCP tools with `@cap-js/mcp`, explain what `describe`, `query` and `call` do, and use doc comments and `@mcp.instructions` correctly
  • Apply SAP API Policy section 2.2.2 as a governance gate before any MCP-exposed CAP service touches production SAP data

Who this is for. You can read and write CDS models, you have shipped at least one CAP service, and you now need to add a generative-AI feature to it — a RAG endpoint, a summarisation action, or a tool an agent can call. This module is pro-code: it assumes M333's concepts (tokens, embeddings, grounding, tool calling) and M330's HANA Cloud vector mechanics, and adds the two SAP-specific building blocks that turn those concepts into a shipped CAP extension — the SAP Cloud SDK for AI and CAP's own native AI features — plus a governance trap you must not walk into.

1. Two building blocks, one archived shortcut

As of September 2026, SAP gives you exactly two supported ways to put generative AI into a CAP application:

Prerequisites

  • Completion of M333 (AI & LLM Fundamentals) and M330 (HANA Cloud Vector Engine & Knowledge Graph Engine for RAG), or equivalent
  • Working knowledge of CAP (Core Data Services, CDS models, a shipped CAP service in Node.js or Java)
  • Comfort with JavaScript/TypeScript or Java at a level sufficient to read SDK sample code

Outcomes

  • Select the correct SAP Cloud SDK for AI package for a given CAP AI requirement, without reaching for the archived CAP LLM plugin.
  • Model and query embeddings natively inside a CDS model, closing a RAG loop without a separate vector database.
  • Wire an orchestration-service call into a CAP action, keeping model and pipeline configuration out of business logic.
  • Expose a CAP service as governed MCP tools, with an explicit SAP API Policy check before production data is touched.

Full module available to members. The full module adds: the decision framework · the end-to-end scenario walkthrough · the KPI scorecard · the anti-patterns · the code blocks · the knowledge check · the diagrams.

Open in the app →