Skip to content

Commit 09c7f5e

Browse files
committed
Merge branch 'main' into release/1.0.4
2 parents 5f21394 + 635067e commit 09c7f5e

File tree

63 files changed

+7792
-458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+7792
-458
lines changed

agentscope-distribution/agentscope-bom/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@
206206
<version>${project.version}</version>
207207
</dependency>
208208

209+
<!-- AgentScope Higress Extension -->
210+
<dependency>
211+
<groupId>io.agentscope</groupId>
212+
<artifactId>agentscope-extensions-higress</artifactId>
213+
<version>${project.version}</version>
214+
</dependency>
215+
209216
<!-- AgentScope Micronaut Extension -->
210217
<dependency>
211218
<groupId>io.agentscope</groupId>

agentscope-examples/advanced/src/main/java/io/agentscope/examples/advanced/AutoMemoryExample.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import io.agentscope.core.ReActAgent;
2020
import io.agentscope.core.formatter.dashscope.DashScopeChatFormatter;
2121
import io.agentscope.core.memory.autocontext.AutoContextConfig;
22+
import io.agentscope.core.memory.autocontext.AutoContextHook;
2223
import io.agentscope.core.memory.autocontext.AutoContextMemory;
23-
import io.agentscope.core.memory.autocontext.ContextOffloadTool;
2424
import io.agentscope.core.memory.mem0.Mem0LongTermMemory;
2525
import io.agentscope.core.message.Msg;
2626
import io.agentscope.core.message.MsgRole;
@@ -29,6 +29,7 @@
2929
import io.agentscope.core.model.GenerateOptions;
3030
import io.agentscope.core.session.JsonSession;
3131
import io.agentscope.core.session.SessionManager;
32+
import io.agentscope.core.studio.StudioManager;
3233
import io.agentscope.core.tool.Toolkit;
3334
import io.agentscope.core.tool.file.ReadFileTool;
3435
import io.agentscope.core.tool.file.WriteFileTool;
@@ -43,6 +44,16 @@ public class AutoMemoryExample {
4344

4445
public static void main(String[] args) {
4546

47+
// Initialize Studio
48+
System.out.println("Connecting to Studio at http://localhost:3000...");
49+
StudioManager.init()
50+
.studioUrl("http://localhost:3000")
51+
.project("JavaExamples")
52+
.runName("studio_demo_" + System.currentTimeMillis())
53+
.initialize()
54+
.block();
55+
System.out.println("Connected to Studio\n");
56+
4657
String apiKey = ExampleUtils.getDashScopeApiKey();
4758

4859
DashScopeChatModel chatModel =
@@ -61,15 +72,13 @@ public static void main(String[] args) {
6172
.apiBaseUrl("https://api.mem0.ai");
6273
Mem0LongTermMemory longTermMemory = builder.build();
6374
AutoContextConfig autoContextConfig =
64-
AutoContextConfig.builder().tokenRatio(0.4).lastKeep(10).build();
75+
AutoContextConfig.builder().tokenRatio(0.4).lastKeep(20).build();
6576
AutoContextMemory memory = new AutoContextMemory(autoContextConfig, chatModel);
6677

6778
Toolkit toolkit = new Toolkit();
6879
toolkit.registerTool(new ReadFileTool());
6980
toolkit.registerTool(new WriteFileTool());
70-
// AutoContextMemory implements ContextOffLoader interface, can be used directly
71-
toolkit.registerTool(new ContextOffloadTool(memory));
72-
// Create Agent with minimal configuration
81+
7382
ReActAgent agent =
7483
ReActAgent.builder()
7584
.name("Assistant")
@@ -82,16 +91,16 @@ public static void main(String[] args) {
8291
.longTermMemory(longTermMemory)
8392
.enablePlan()
8493
.toolkit(toolkit)
94+
.hook(new AutoContextHook()) // Register the hook for automatic setup
8595
.build();
86-
String sessionId = "session000005";
96+
String sessionId = "session111111111111";
8797
// Set up session path
8898
Path sessionPath =
8999
Paths.get(System.getProperty("user.home"), ".agentscope", "examples", "sessions");
90100
SessionManager sessionManager =
91101
SessionManager.forSessionId(sessionId)
92102
.withSession(new JsonSession(sessionPath))
93-
.addComponent(agent) // Automatically named "agent"
94-
.addComponent(memory); // Automatically named "memory"
103+
.addComponent(agent); // Automatically named "agent"
95104
if (sessionManager.sessionExists()) {
96105
// Load existing session
97106
sessionManager.loadIfExists();
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# HiMarket Deployment and Usage Guide
2+
3+
## Overview
4+
5+
HiMarket is an AI capability marketplace for publishing and distributing various Agents in the AgentScope multi-agent system.
6+
7+
### HiMarket Features
8+
9+
- **Agent Marketplace**: One-click listing of Agents registered in Nacos, developers can browse and subscribe to various Agent services
10+
- **Admin Console**: Unified management of Agent products, permission configuration, and subscription approval
11+
- **Developer Portal**: Developers can discover, subscribe to, and use Agent capabilities in the portal
12+
- **Observability**: Monitor Agent invocation success rate, latency, and other runtime metrics
13+
14+
HiMarket shares the same Nacos instance with the AgentScope multi-agent system, enabling unified management and exposure of Agents.
15+
16+
---
17+
18+
## Configure Helm Values
19+
20+
Edit `himarket-helm/values.yaml` to configure HiMarket:
21+
22+
```yaml
23+
# HiMarket image configuration
24+
server:
25+
image:
26+
hub: registry.cn-hangzhou.aliyuncs.com/agentscope
27+
repository: himarket-server-auto-init
28+
tag: "latest"
29+
30+
# MySQL configuration (optional: use built-in or external)
31+
mysql:
32+
enabled: true # Use built-in MySQL
33+
34+
# Nacos configuration (import AgentScope's Nacos)
35+
nacos:
36+
enabled: true # Enable Nacos import
37+
name: agentscope-nacos
38+
serverUrl: http://agentscope-nacos:8848 # Keep consistent with the Nacos address configured earlier
39+
username: nacos
40+
password: nacos
41+
```
42+
43+
For more configuration options, please refer to [himarket-helm/README.md](himarket-helm/README.md)
44+
45+
---
46+
47+
## Deploy to K8s
48+
49+
```bash
50+
# Create namespace (if not already created)
51+
kubectl create namespace mse
52+
53+
# Deploy AgentScope multi-agent system (must be deployed first)
54+
helm install agentscope helm/ --namespace mse
55+
56+
# Deploy HiMarket AI capability marketplace
57+
# Import AgentScope's Nacos into HiMarket for unified Agent management
58+
helm install himarket himarket-helm/ --namespace mse
59+
60+
# Check deployment status
61+
kubectl get pods -n mse
62+
kubectl get services -n mse
63+
```
64+
65+
---
66+
67+
## Using HiMarket
68+
69+
### 1. Access HiMarket Admin Console
70+
71+
Access the HiMarket admin console via `kubectl port-forward`:
72+
73+
```bash
74+
# Forward admin console service
75+
kubectl port-forward svc/himarket-admin 5174:80 -n mse
76+
77+
# Browser access
78+
# http://localhost:5174
79+
```
80+
81+
If using LoadBalancer or NodePort:
82+
83+
```bash
84+
# Get HiMarket service address
85+
kubectl get svc -n mse | grep himarket
86+
87+
# LoadBalancer: http://<external-ip>:80
88+
# NodePort: http://<node-ip>:<node-port>
89+
```
90+
91+
### 2. Login with Admin Account
92+
93+
HiMarket automatically creates an admin account during deployment:
94+
95+
**Default Admin Account**:
96+
- Username: `admin`
97+
- Password: `admin`
98+
99+
**Custom Admin Account**:
100+
101+
To modify the default admin account, configure it in `himarket-helm/values.yaml`:
102+
103+
```yaml
104+
autoInit:
105+
# Admin account configuration
106+
admin:
107+
username: your-admin # Custom username
108+
password: your-password # Custom password
109+
```
110+
111+
### 3. View Imported Nacos
112+
113+
1. Login to admin console
114+
2. Navigate to "Service Management" → "Nacos Instances"
115+
3. Confirm that AgentScope's Nacos instance has been automatically imported (configured during deployment)
116+
4. Click on the Nacos instance to view all registered Agent services
117+
118+
### 4. List an Agent
119+
120+
1. In the admin console, go to "API Products"
121+
2. Click "Create Product" and select an Agent service from Nacos (e.g., `supervisor-agent`, `business-sub-agent`, etc.)
122+
3. Configure product information, documentation, permissions, etc.
123+
4. Save and publish to the developer portal
124+
125+
### 5. List an MCP Server
126+
127+
In addition to MCP Servers automatically imported during deployment, users can also list their own MCP Servers registered in Nacos.
128+
129+
**Listing Process** (similar to Agent listing):
130+
131+
1. **Register MCP Server to Nacos**
132+
- Register your MCP Server to the Nacos instance shared with HiMarket
133+
- Ensure the MCP Server is running properly and can be discovered by Nacos
134+
135+
2. **List in Admin Console**
136+
- Go to HiMarket admin console
137+
- Navigate to "API Products" → "Create Product"
138+
- Select your MCP Server service from the service list
139+
- Configure product information:
140+
- Product name and description
141+
- Description of tools provided by the MCP Server
142+
- API documentation and usage examples
143+
- Access permission configuration
144+
- Save and publish to developer portal
145+
146+
3. **Developer Usage**
147+
- Developers browse MCP Server products in the portal
148+
- After subscription, integrate into AgentScope applications
149+
- Call MCP Server tools via MCP protocol
150+
151+
**Notes**:
152+
- HiMarket automatically discovers all MCP Servers registered in Nacos
153+
- Supports listing services with standard MCP protocol
154+
- Different access permissions and subscription policies can be configured for different MCP Servers
155+
156+
### 6. Developer Subscription
157+
158+
HiMarket automatically creates a demo developer account during deployment, which can be used directly:
159+
160+
**Default Developer Account**:
161+
- Username: `demo`
162+
- Password: `demo123`
163+
164+
**Usage Flow**:
165+
1. Login to HiMarket developer portal with the default account
166+
2. Browse published Agent products
167+
3. Create an application and subscribe to Agents
168+
4. Obtain credentials and integrate into your own applications
169+
170+
**Custom Developer Account**:
171+
172+
To modify the default developer account, configure it in `himarket-helm/values.yaml`:
173+
174+
```yaml
175+
autoInit:
176+
# Developer account configuration
177+
developer:
178+
username: your-developer # Custom username
179+
password: your-password # Custom password
180+
```
181+
182+
Or set via Helm command line:
183+
184+
```bash
185+
helm install himarket himarket-helm/ \
186+
--set autoInit.developer.username=mydev \
187+
--set autoInit.developer.password=mypassword123
188+
```
189+
190+
**Notes**:
191+
- HiMarket shares the same Nacos instance with AgentScope
192+
- All Agents registered in Nacos will be automatically discovered by HiMarket
193+
- HiMarket enables unified management and exposure of these Agent capabilities
194+
195+
---
196+

0 commit comments

Comments
 (0)