From 90ebf7babbc4c9a98ccbe696c9a7519031c35d2d Mon Sep 17 00:00:00 2001 From: Matthias Schur <107557548+MattSchur@users.noreply.github.com> Date: Tue, 20 Oct 2026 10:26:43 +0200 Subject: [PATCH 1/2] Java: Persistent Agent Memory --- java/ai.md | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/java/ai.md b/java/ai.md index 867df248d3..dc3f48e212 100644 --- a/java/ai.md +++ b/java/ai.md @@ -27,10 +27,8 @@ client can talk to them. For compatibility reasons with Joule and Agent Gateway, version 0.3.0 of the A2A protocol is used by default. ::: - -::: warning In-Memory Chat History Only -CAP Java doesn't yet have a persistent chat history. Instead, it stores conversation history in volatile memory. Hence, you need to send all follow-up prompts to the same server instance. -::: +> [!warning] Alpha — Not for Production +> CAP Java agents are under active development. The data model and APIs may change. ### Adding the Dependency @@ -43,6 +41,23 @@ Add the agent adapter to your `srv/pom.xml`: ``` +Add the `agent-memory` model to your project's `package.json`: + +```json +{ + "cds": { + "requires": { + "agent-memory": { + "model": "com.sap.cds/ai/agent-memory" + } + } + } +} +``` + +> [!warning] Persistent Agent Memory +> There is no automatic cleanup yet. Clear the session table periodically. + ### Defining an Agent Annotate a service with `@agent` to expose it as an agent: From 743ac55772b66e6e1b540f6f8bf15a75ee0fed07 Mon Sep 17 00:00:00 2001 From: Matthias Schur <107557548+MattSchur@users.noreply.github.com> Date: Wed, 21 Oct 2026 12:05:56 +0200 Subject: [PATCH 2/2] Import model and use resolve --- java/ai.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/java/ai.md b/java/ai.md index dc3f48e212..e4fd06d3af 100644 --- a/java/ai.md +++ b/java/ai.md @@ -41,20 +41,14 @@ Add the agent adapter to your `srv/pom.xml`: ``` -Add the `agent-memory` model to your project's `package.json`: - -```json -{ - "cds": { - "requires": { - "agent-memory": { - "model": "com.sap.cds/ai/agent-memory" - } - } - } -} +Import the `agent-memory` model into your project's CDS model: + +```cds +using from 'com.sap.cds/ai/agent-memory'; ``` +and use the [resolve](./building-plugins#reference-the-new-cds-model-in-an-existing-cap-java-project) goal of the CDS Maven Plugin. + > [!warning] Persistent Agent Memory > There is no automatic cleanup yet. Clear the session table periodically.