Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions agentscope-distribution/agentscope-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,28 @@

<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-autocontext-memory</artifactId>
<artifactId>agentscope-extensions-chat-completions-web</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-chat-completions-web</artifactId>
<artifactId>agentscope-extensions-higress</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-higress</artifactId>
<artifactId>agentscope-extensions-training</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-training</artifactId>
<artifactId>agentscope-extensions-autocontext-memory</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Expand All @@ -104,42 +104,49 @@

<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-rag-bailian</artifactId>
<artifactId>agentscope-extensions-reme</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-rag-dify</artifactId>
<artifactId>agentscope-extensions-memory-bailian</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-rag-ragflow</artifactId>
<artifactId>agentscope-extensions-rag-bailian</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-rag-haystack</artifactId>
<artifactId>agentscope-extensions-rag-dify</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-rag-simple</artifactId>
<artifactId>agentscope-extensions-rag-ragflow</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-reme</artifactId>
<artifactId>agentscope-extensions-rag-haystack</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-rag-simple</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Expand Down
29 changes: 18 additions & 11 deletions agentscope-distribution/agentscope-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@
<version>${project.version}</version>
</dependency>

<!-- AgentScope Extensions AutoContext Memory -->
<!-- AgentScope Extensions Chat Completions Web -->
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-autocontext-memory</artifactId>
<artifactId>agentscope-extensions-chat-completions-web</artifactId>
<version>${project.version}</version>
</dependency>

<!-- AgentScope Extensions Chat Completions Web -->
<!-- AgentScope Extensions AutoContext Memory -->
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-chat-completions-web</artifactId>
<artifactId>agentscope-extensions-autocontext-memory</artifactId>
<version>${project.version}</version>
</dependency>

Expand All @@ -136,6 +136,20 @@
<version>${project.version}</version>
</dependency>

<!-- AgentScope Extensions Reme -->
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-reme</artifactId>
<version>${project.version}</version>
</dependency>

<!-- AgentScope Extensions Bailian Long Term Memory -->
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-memory-bailian</artifactId>
<version>${project.version}</version>
</dependency>

<!-- AgentScope Extensions Rag Bailian -->
<dependency>
<groupId>io.agentscope</groupId>
Expand Down Expand Up @@ -171,13 +185,6 @@
<version>${project.version}</version>
</dependency>

<!-- AgentScope Extensions Reme -->
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-reme</artifactId>
<version>${project.version}</version>
</dependency>

<!-- AgentScope Extensions Scheduler Common -->
<dependency>
<groupId>io.agentscope</groupId>
Expand Down
7 changes: 6 additions & 1 deletion agentscope-examples/advanced/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-reme</artifactId>
<version>${revision}</version>
</dependency>

<!-- AgentScope Extensions Bailian Long Term Memory -->
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions-memory-bailian</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/*
* Copyright 2024-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.agentscope.examples.advanced;

import io.agentscope.core.ReActAgent;
import io.agentscope.core.agent.user.UserAgent;
import io.agentscope.core.memory.LongTermMemoryMode;
import io.agentscope.core.memory.bailian.BailianLongTermMemory;
import io.agentscope.core.message.Msg;
import io.agentscope.core.model.DashScopeChatModel;
import java.util.Map;

/**
* BailianMemoryExample - Demonstrates <a href="https://help.aliyun.com/zh/model-studio/memory-library">Bailian Memory Library</a>
* long-term memory using Bailian backend.
*
* <p><b>Prerequisites:</b>
* <ul>
* <li>Alibaba Cloud DashScope API key</li>
* <li>Bailian Long Term Memory service access</li>
* </ul>
*
* <p><b>Environment Configuration:</b>
* <pre>
* export DASHSCOPE_API_KEY=sk-xxxx
* export BAILIAN_USER_ID=your_user_id
* </pre>
*
* <p><b>Optional Configuration:</b>
* <pre>
* export BAILIAN_MEMORY_LIBRARY_ID=your_library_id
* export BAILIAN_PROJECT_ID=your_project_id
* export BAILIAN_PROFILE_SCHEMA=your_profile_schema
* </pre>
*
* <p>This example demonstrates:
* <ul>
* <li>Creating an agent with Bailian long-term memory</li>
* <li>Using STATIC_CONTROL mode for memory operations</li>
* <li>Interactive chat with persistent memory</li>
* </ul>
*/
public class BailianMemoryExample {

public static void main(String[] args) throws Exception {
String description =
"""
This example demonstrates using Bailian long-term memory:
- Creating an agent with Bailian long-term memory
- Using STATIC_CONTROL mode for memory operations
- Interactive chat with persistent memory

Bailian Memory Prompt Example:
[User (USER)]: I am Mike, and I drink water on time at 9 a.m. every morning.
[Assistant (ASSISTANT)]: Hi Mike! That’s a great habit—staying hydrated first thing in the morning helps kickstart your metabolism, supports cognitive function, and sets a positive tone for the day.

[User (USER)]: Who am I and what I need to do at 9 a.m. every morning?
[Assistant (ASSISTANT)]: You are **Mike**, and you need to **drink water** at 9 a.m. every morning.
""";
ExampleUtils.printWelcome("Bailian Memory Example", description);

String apiKey = ExampleUtils.getDashScopeApiKey();

// Set user id
String userId = System.getenv("BAILIAN_USER_ID");
if (userId == null || userId.isBlank()) {
userId = "user-001";
}

BailianLongTermMemory.Builder memoryBuilder =
BailianLongTermMemory.builder()
.apiKey(apiKey)
.userId(userId)
.metadata(Map.of("location_name", "Beijing"));

// Set memory library id
String memoryLibraryId = System.getenv("BAILIAN_MEMORY_LIBRARY_ID");
if (memoryLibraryId != null && !memoryLibraryId.isBlank()) {
memoryBuilder.memoryLibraryId(memoryLibraryId);
}

// Set project id
String projectId = System.getenv("BAILIAN_PROJECT_ID");
if (projectId != null && !projectId.isBlank()) {
memoryBuilder.projectId(projectId);
}

// Set profile schema
String profileSchema = System.getenv("BAILIAN_PROFILE_SCHEMA");
if (profileSchema != null && !profileSchema.isBlank()) {
memoryBuilder.profileSchema(profileSchema);
}

BailianLongTermMemory longTermMemory = memoryBuilder.build();

ReActAgent agent =
ReActAgent.builder()
.name("Assistant")
.model(
DashScopeChatModel.builder()
.apiKey(apiKey)
.modelName("qwen-plus")
.build())
.longTermMemory(longTermMemory)
.longTermMemoryMode(LongTermMemoryMode.STATIC_CONTROL)
.build();

UserAgent userAgent = UserAgent.builder().name("User").build();

Msg msg = null;
while (true) {
msg = userAgent.call(msg).block();
if (msg.getTextContent().equals("exit")) {
break;
}
msg = agent.call(msg).block();
}
}
}
48 changes: 48 additions & 0 deletions agentscope-extensions/agentscope-extensions-memory-bailian/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2024-2026 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>

<name>AgentScope Java - Extensions - Bailian Long Term Memory</name>
<description>AgentScope Extensions - Bailian Long Term Memory</description>
<artifactId>agentscope-extensions-memory-bailian</artifactId>

<dependencies>
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-core</artifactId>
<optional>true</optional>
<scope>provided</scope>
</dependency>

<!-- Mock Web Server -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver3</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Loading
Loading