agentscope-runtime 1.0.4a1__py3-none-any.whl → 1.0.5.post1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentscope_runtime/adapters/agentscope/stream.py +2 -8
- agentscope_runtime/adapters/langgraph/stream.py +120 -70
- agentscope_runtime/adapters/ms_agent_framework/__init__.py +0 -0
- agentscope_runtime/adapters/ms_agent_framework/message.py +205 -0
- agentscope_runtime/adapters/ms_agent_framework/stream.py +418 -0
- agentscope_runtime/adapters/utils.py +6 -0
- agentscope_runtime/cli/commands/deploy.py +836 -1
- agentscope_runtime/cli/commands/stop.py +16 -0
- agentscope_runtime/common/container_clients/__init__.py +52 -0
- agentscope_runtime/common/container_clients/agentrun_client.py +6 -4
- agentscope_runtime/common/container_clients/boxlite_client.py +442 -0
- agentscope_runtime/common/container_clients/docker_client.py +0 -20
- agentscope_runtime/common/container_clients/fc_client.py +6 -4
- agentscope_runtime/common/container_clients/gvisor_client.py +38 -0
- agentscope_runtime/common/container_clients/knative_client.py +467 -0
- agentscope_runtime/common/utils/deprecation.py +164 -0
- agentscope_runtime/engine/__init__.py +4 -0
- agentscope_runtime/engine/app/agent_app.py +16 -4
- agentscope_runtime/engine/constant.py +1 -0
- agentscope_runtime/engine/deployers/__init__.py +34 -11
- agentscope_runtime/engine/deployers/adapter/__init__.py +8 -0
- agentscope_runtime/engine/deployers/adapter/a2a/__init__.py +26 -51
- agentscope_runtime/engine/deployers/adapter/a2a/a2a_protocol_adapter.py +23 -13
- agentscope_runtime/engine/deployers/adapter/a2a/a2a_registry.py +4 -201
- agentscope_runtime/engine/deployers/adapter/a2a/nacos_a2a_registry.py +152 -25
- agentscope_runtime/engine/deployers/adapter/agui/__init__.py +8 -0
- agentscope_runtime/engine/deployers/adapter/agui/agui_adapter_utils.py +652 -0
- agentscope_runtime/engine/deployers/adapter/agui/agui_protocol_adapter.py +225 -0
- agentscope_runtime/engine/deployers/agentrun_deployer.py +2 -2
- agentscope_runtime/engine/deployers/fc_deployer.py +1506 -0
- agentscope_runtime/engine/deployers/knative_deployer.py +290 -0
- agentscope_runtime/engine/deployers/pai_deployer.py +2335 -0
- agentscope_runtime/engine/deployers/utils/net_utils.py +37 -0
- agentscope_runtime/engine/deployers/utils/oss_utils.py +38 -0
- agentscope_runtime/engine/deployers/utils/package.py +46 -42
- agentscope_runtime/engine/helpers/agent_api_client.py +372 -0
- agentscope_runtime/engine/runner.py +13 -0
- agentscope_runtime/engine/schemas/agent_schemas.py +9 -3
- agentscope_runtime/engine/services/agent_state/__init__.py +7 -0
- agentscope_runtime/engine/services/memory/__init__.py +7 -0
- agentscope_runtime/engine/services/memory/redis_memory_service.py +15 -16
- agentscope_runtime/engine/services/session_history/__init__.py +7 -0
- agentscope_runtime/engine/tracing/local_logging_handler.py +2 -3
- agentscope_runtime/engine/tracing/wrapper.py +18 -4
- agentscope_runtime/sandbox/__init__.py +14 -6
- agentscope_runtime/sandbox/box/base/__init__.py +2 -2
- agentscope_runtime/sandbox/box/base/base_sandbox.py +51 -1
- agentscope_runtime/sandbox/box/browser/__init__.py +2 -2
- agentscope_runtime/sandbox/box/browser/browser_sandbox.py +198 -2
- agentscope_runtime/sandbox/box/filesystem/__init__.py +2 -2
- agentscope_runtime/sandbox/box/filesystem/filesystem_sandbox.py +99 -2
- agentscope_runtime/sandbox/box/gui/__init__.py +2 -2
- agentscope_runtime/sandbox/box/gui/gui_sandbox.py +117 -1
- agentscope_runtime/sandbox/box/mobile/__init__.py +2 -2
- agentscope_runtime/sandbox/box/mobile/mobile_sandbox.py +247 -100
- agentscope_runtime/sandbox/box/sandbox.py +102 -65
- agentscope_runtime/sandbox/box/shared/routers/generic.py +36 -29
- agentscope_runtime/sandbox/client/__init__.py +6 -1
- agentscope_runtime/sandbox/client/async_http_client.py +339 -0
- agentscope_runtime/sandbox/client/base.py +74 -0
- agentscope_runtime/sandbox/client/http_client.py +108 -329
- agentscope_runtime/sandbox/enums.py +7 -0
- agentscope_runtime/sandbox/manager/sandbox_manager.py +275 -29
- agentscope_runtime/sandbox/manager/server/app.py +7 -1
- agentscope_runtime/sandbox/manager/server/config.py +3 -1
- agentscope_runtime/sandbox/model/manager_config.py +11 -9
- agentscope_runtime/tools/modelstudio_memory/__init__.py +106 -0
- agentscope_runtime/tools/modelstudio_memory/base.py +220 -0
- agentscope_runtime/tools/modelstudio_memory/config.py +86 -0
- agentscope_runtime/tools/modelstudio_memory/core.py +594 -0
- agentscope_runtime/tools/modelstudio_memory/exceptions.py +60 -0
- agentscope_runtime/tools/modelstudio_memory/schemas.py +253 -0
- agentscope_runtime/version.py +1 -1
- {agentscope_runtime-1.0.4a1.dist-info → agentscope_runtime-1.0.5.post1.dist-info}/METADATA +187 -74
- {agentscope_runtime-1.0.4a1.dist-info → agentscope_runtime-1.0.5.post1.dist-info}/RECORD +79 -55
- {agentscope_runtime-1.0.4a1.dist-info → agentscope_runtime-1.0.5.post1.dist-info}/WHEEL +1 -1
- {agentscope_runtime-1.0.4a1.dist-info → agentscope_runtime-1.0.5.post1.dist-info}/entry_points.txt +0 -0
- {agentscope_runtime-1.0.4a1.dist-info → agentscope_runtime-1.0.5.post1.dist-info}/licenses/LICENSE +0 -0
- {agentscope_runtime-1.0.4a1.dist-info → agentscope_runtime-1.0.5.post1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Pydantic models for ModelStudio Memory API.
|
|
4
|
+
"""
|
|
5
|
+
from typing import Any, Dict, List, Optional
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel, Field, model_validator
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# ==================== Message ====================
|
|
11
|
+
class Message(BaseModel):
|
|
12
|
+
"""Message in a conversation."""
|
|
13
|
+
|
|
14
|
+
role: str = Field(..., description="Role of the message sender")
|
|
15
|
+
content: Any = Field(..., description="Content of the message")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# ==================== Memory Node ====================
|
|
19
|
+
class MemoryNode(BaseModel):
|
|
20
|
+
"""A memory node stored in the system."""
|
|
21
|
+
|
|
22
|
+
memory_node_id: Optional[str] = Field(
|
|
23
|
+
None,
|
|
24
|
+
description="Unique identifier for the memory node",
|
|
25
|
+
)
|
|
26
|
+
content: str = Field(..., description="Content of the memory node")
|
|
27
|
+
event: Optional[str] = Field(
|
|
28
|
+
None,
|
|
29
|
+
description="Events associated with the memory node. "
|
|
30
|
+
"e.g. ADD, DELETE, UPDATE",
|
|
31
|
+
)
|
|
32
|
+
old_content: Optional[str] = Field(
|
|
33
|
+
None,
|
|
34
|
+
description="Old content of the memory node",
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# ==================== Add Memory ====================
|
|
39
|
+
class AddMemoryInput(BaseModel):
|
|
40
|
+
"""Input for adding memory."""
|
|
41
|
+
|
|
42
|
+
user_id: str = Field(..., description="End user id")
|
|
43
|
+
messages: List[Message] = Field(
|
|
44
|
+
...,
|
|
45
|
+
description="Conversation messages to be stored as memory",
|
|
46
|
+
)
|
|
47
|
+
meta_data: Optional[Dict[str, Any]] = Field(
|
|
48
|
+
None,
|
|
49
|
+
description="Optional metadata",
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
class Config:
|
|
53
|
+
extra = "allow" # Allow extra fields
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class AddMemoryOutput(BaseModel):
|
|
57
|
+
"""Output from adding memory."""
|
|
58
|
+
|
|
59
|
+
memory_nodes: List[MemoryNode] = Field(
|
|
60
|
+
...,
|
|
61
|
+
description="Generated memory nodes",
|
|
62
|
+
)
|
|
63
|
+
request_id: str = Field(..., description="Request id")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# ==================== Search Memory ====================
|
|
67
|
+
class SearchFilters(BaseModel):
|
|
68
|
+
"""Filters for memory search."""
|
|
69
|
+
|
|
70
|
+
tags: Optional[List[str]] = Field(
|
|
71
|
+
None,
|
|
72
|
+
description="Filter results by tags",
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class SearchMemoryInput(BaseModel):
|
|
77
|
+
"""Input for searching memory."""
|
|
78
|
+
|
|
79
|
+
user_id: str = Field(..., description="End user id")
|
|
80
|
+
messages: List[Message] = Field(
|
|
81
|
+
...,
|
|
82
|
+
description="Conversation messages for context",
|
|
83
|
+
)
|
|
84
|
+
top_k: Optional[int] = Field(
|
|
85
|
+
100,
|
|
86
|
+
description="Maximum number of results to return",
|
|
87
|
+
)
|
|
88
|
+
min_score: Optional[float] = Field(
|
|
89
|
+
0.0,
|
|
90
|
+
description="Minimum similarity score threshold",
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
class Config:
|
|
94
|
+
extra = "allow" # Allow extra fields
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class SearchMemoryOutput(BaseModel):
|
|
98
|
+
"""Output from searching memory."""
|
|
99
|
+
|
|
100
|
+
memory_nodes: List[MemoryNode] = Field(
|
|
101
|
+
...,
|
|
102
|
+
description="Retrieved memory nodes",
|
|
103
|
+
)
|
|
104
|
+
request_id: str = Field(..., description="Request id")
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
# ==================== List Memory ====================
|
|
108
|
+
class ListMemoryInput(BaseModel):
|
|
109
|
+
"""Input for listing memory nodes."""
|
|
110
|
+
|
|
111
|
+
user_id: str = Field(..., description="End user id")
|
|
112
|
+
page_num: Optional[int] = Field(1, description="Page number (1-based)")
|
|
113
|
+
page_size: Optional[int] = Field(
|
|
114
|
+
10,
|
|
115
|
+
description="Number of items per page",
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
class Config:
|
|
119
|
+
extra = "allow" # Allow extra fields
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class ListMemoryOutput(BaseModel):
|
|
123
|
+
"""Output from listing memory nodes."""
|
|
124
|
+
|
|
125
|
+
memory_nodes: List[MemoryNode] = Field(
|
|
126
|
+
...,
|
|
127
|
+
description="Retrieved memory nodes",
|
|
128
|
+
)
|
|
129
|
+
page_size: int = Field(..., description="Number of items per page")
|
|
130
|
+
page_num: int = Field(..., description="Current page number")
|
|
131
|
+
total: int = Field(..., description="Total number of memory nodes")
|
|
132
|
+
request_id: str = Field(..., description="Request id")
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
# ==================== Delete Memory ====================
|
|
136
|
+
class DeleteMemoryInput(BaseModel):
|
|
137
|
+
"""Input for deleting a memory node."""
|
|
138
|
+
|
|
139
|
+
user_id: str = Field(..., description="End user id")
|
|
140
|
+
memory_node_id: str = Field(
|
|
141
|
+
...,
|
|
142
|
+
description="Memory node id to delete",
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
class Config:
|
|
146
|
+
extra = "allow" # Allow extra fields
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
class DeleteMemoryOutput(BaseModel):
|
|
150
|
+
"""Output from deleting a memory node."""
|
|
151
|
+
|
|
152
|
+
request_id: str = Field(..., description="Request id")
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
# ==================== Profile Schema ====================
|
|
156
|
+
class ProfileAttribute(BaseModel):
|
|
157
|
+
"""Attribute definition in a profile schema."""
|
|
158
|
+
|
|
159
|
+
name: str = Field(..., description="Attribute name")
|
|
160
|
+
description: Optional[str] = Field(
|
|
161
|
+
None,
|
|
162
|
+
description="Attribute description",
|
|
163
|
+
)
|
|
164
|
+
immutable: Optional[bool] = Field(
|
|
165
|
+
False,
|
|
166
|
+
description="Whether the attribute is immutable",
|
|
167
|
+
)
|
|
168
|
+
default_value: Optional[Any] = Field(
|
|
169
|
+
None,
|
|
170
|
+
description="Default value for the attribute",
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class CreateProfileSchemaInput(BaseModel):
|
|
175
|
+
"""Input for creating a profile schema."""
|
|
176
|
+
|
|
177
|
+
name: str = Field(..., description="Profile schema name")
|
|
178
|
+
description: Optional[str] = Field(
|
|
179
|
+
None,
|
|
180
|
+
description="Profile schema description",
|
|
181
|
+
)
|
|
182
|
+
attributes: List[ProfileAttribute] = Field(
|
|
183
|
+
...,
|
|
184
|
+
description="List of attribute definitions (must have at least 1)",
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
@model_validator(mode="after")
|
|
188
|
+
def validate_attributes(self) -> "CreateProfileSchemaInput":
|
|
189
|
+
"""Validate that at least one attribute is provided."""
|
|
190
|
+
if not self.attributes:
|
|
191
|
+
raise ValueError("attributes must contain at least one item")
|
|
192
|
+
return self
|
|
193
|
+
|
|
194
|
+
class Config:
|
|
195
|
+
extra = "allow"
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class CreateProfileSchemaOutput(BaseModel):
|
|
199
|
+
"""Output from creating a profile schema."""
|
|
200
|
+
|
|
201
|
+
profile_schema_id: str = Field(
|
|
202
|
+
...,
|
|
203
|
+
description="Created profile schema id",
|
|
204
|
+
)
|
|
205
|
+
request_id: str = Field(..., description="Request id")
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
# ==================== User Profile ====================
|
|
209
|
+
class UserProfileAttribute(BaseModel):
|
|
210
|
+
"""Attribute in a user profile."""
|
|
211
|
+
|
|
212
|
+
name: str = Field(..., description="Attribute name")
|
|
213
|
+
id: str = Field(..., description="Attribute id")
|
|
214
|
+
value: Optional[Any] = Field(None, description="Attribute value")
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class UserProfile(BaseModel):
|
|
218
|
+
"""User profile with attributes."""
|
|
219
|
+
|
|
220
|
+
schema_description: Optional[str] = Field(
|
|
221
|
+
None,
|
|
222
|
+
alias="schemaDescription",
|
|
223
|
+
description="Schema description",
|
|
224
|
+
)
|
|
225
|
+
schema_name: Optional[str] = Field(
|
|
226
|
+
None,
|
|
227
|
+
alias="schemaName",
|
|
228
|
+
description="Schema name",
|
|
229
|
+
)
|
|
230
|
+
attributes: List[UserProfileAttribute] = Field(
|
|
231
|
+
default_factory=list,
|
|
232
|
+
description="User attributes",
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
class Config:
|
|
236
|
+
populate_by_name = True # Allow both field names and aliases
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
class GetUserProfileInput(BaseModel):
|
|
240
|
+
"""Input for getting a user profile."""
|
|
241
|
+
|
|
242
|
+
schema_id: str = Field(..., description="Profile schema id")
|
|
243
|
+
user_id: str = Field(..., description="End user id")
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
class GetUserProfileOutput(BaseModel):
|
|
247
|
+
"""Output from getting a user profile."""
|
|
248
|
+
|
|
249
|
+
request_id: str = Field(..., description="Request id", alias="requestId")
|
|
250
|
+
profile: UserProfile = Field(..., description="User profile")
|
|
251
|
+
|
|
252
|
+
class Config:
|
|
253
|
+
populate_by_name = True # Allow both field names and aliases
|
agentscope_runtime/version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
-
__version__ = "v1.0.
|
|
2
|
+
__version__ = "v1.0.5.post1"
|