agentscope-runtime 1.0.4__py3-none-any.whl → 1.0.5__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 +1 -1
- agentscope_runtime/adapters/langgraph/stream.py +120 -70
- agentscope_runtime/cli/commands/deploy.py +465 -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 +1 -0
- agentscope_runtime/common/utils/deprecation.py +164 -0
- agentscope_runtime/engine/app/agent_app.py +16 -4
- agentscope_runtime/engine/deployers/__init__.py +31 -20
- agentscope_runtime/engine/deployers/adapter/__init__.py +8 -0
- agentscope_runtime/engine/deployers/adapter/a2a/a2a_protocol_adapter.py +9 -8
- agentscope_runtime/engine/deployers/adapter/a2a/nacos_a2a_registry.py +19 -1
- 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/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 +1 -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/sandbox/box/sandbox.py +4 -0
- agentscope_runtime/sandbox/manager/sandbox_manager.py +11 -25
- 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.4.dist-info → agentscope_runtime-1.0.5.dist-info}/METADATA +101 -62
- {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.5.dist-info}/RECORD +49 -34
- {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.5.dist-info}/WHEEL +0 -0
- {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.5.dist-info}/entry_points.txt +0 -0
- {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.5.dist-info}/licenses/LICENSE +0 -0
- {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.5.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"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentscope-runtime
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: A production-ready runtime framework for agent applications, providing secure sandboxed execution environments and scalable deployment solutions with multi-framework support.
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -28,6 +28,7 @@ Requires-Dist: jsonref
|
|
|
28
28
|
Requires-Dist: asgiref
|
|
29
29
|
Requires-Dist: click>=8.0.0
|
|
30
30
|
Requires-Dist: rich>=13.0.0
|
|
31
|
+
Requires-Dist: ag-ui-protocol>=0.1.10
|
|
31
32
|
Provides-Extra: dev
|
|
32
33
|
Requires-Dist: pytest>=8.3.5; extra == "dev"
|
|
33
34
|
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
|
|
@@ -67,12 +68,15 @@ Requires-Dist: alibabacloud-credentials; extra == "ext"
|
|
|
67
68
|
Requires-Dist: PyYAML; extra == "ext"
|
|
68
69
|
Requires-Dist: agno>=2.3.8; extra == "ext"
|
|
69
70
|
Requires-Dist: nacos-sdk-python>=3.0.0; extra == "ext"
|
|
70
|
-
Requires-Dist: agent-framework
|
|
71
|
+
Requires-Dist: agent-framework<1.0.0b260114,>=1.0.0b251120; extra == "ext"
|
|
72
|
+
Requires-Dist: boxlite>=0.5.2; extra == "ext"
|
|
73
|
+
Requires-Dist: alibabacloud-eas20210701<8.0.0,>=7.0.0; extra == "ext"
|
|
74
|
+
Requires-Dist: alibabacloud-aiworkspace20210204<8.0.0,>=7.0.0; extra == "ext"
|
|
71
75
|
Dynamic: license-file
|
|
72
76
|
|
|
73
77
|
<div align="center">
|
|
74
78
|
|
|
75
|
-
# AgentScope Runtime
|
|
79
|
+
# AgentScope Runtime: A Production-grade Runtime for Agent Applications
|
|
76
80
|
|
|
77
81
|
[](https://github.com/agentscope-ai/agentscope-runtime)
|
|
78
82
|
[](http://webui.runtime.agentscope.io/)
|
|
@@ -97,13 +101,53 @@ Dynamic: license-file
|
|
|
97
101
|
[[中文README]](README_zh.md)
|
|
98
102
|
[[Samples]](https://github.com/agentscope-ai/agentscope-samples)
|
|
99
103
|
|
|
100
|
-
**
|
|
104
|
+
> **Core capabilities:**
|
|
105
|
+
>
|
|
106
|
+
> **Tool Sandboxing** — tool call runs inside a **hardened sandbox**
|
|
107
|
+
>
|
|
108
|
+
> **Agent-as-a-Service (AaaS) APIs** — expose agents as **streaming, production-ready APIs**
|
|
109
|
+
>
|
|
110
|
+
> **Scalable Deployment** — deploy locally, on Kubernetes, or serverless for **elastic scale**
|
|
111
|
+
>
|
|
112
|
+
> <details>
|
|
113
|
+
> <summary><b>Plus</b></summary>
|
|
114
|
+
>
|
|
115
|
+
> <br>
|
|
116
|
+
>
|
|
117
|
+
> **Full-stack observability** (logs / traces)
|
|
118
|
+
>
|
|
119
|
+
> **Framework compatibility** with mainstream agent frameworks
|
|
120
|
+
>
|
|
121
|
+
> </details>
|
|
101
122
|
|
|
102
|
-
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
---
|
|
103
126
|
|
|
104
|
-
|
|
127
|
+
## Table of Contents
|
|
105
128
|
|
|
106
|
-
|
|
129
|
+
> [!NOTE]
|
|
130
|
+
>
|
|
131
|
+
> **Recommended reading order:**
|
|
132
|
+
>
|
|
133
|
+
> - **I want to run an agent app in 5 minutes**: Quick Start (Agent App example) → verify with curl (SSE streaming)
|
|
134
|
+
> - **I care about secure tool execution / automation**: Quick Start (Sandbox examples) → sandbox image registry/namespace/tag configuration → (optional) production-grade serverless sandbox deployment
|
|
135
|
+
> - **I want production deployment / expose APIs**: Quick Start (Agent App example) → Quick Start (Deployment example) → Guides
|
|
136
|
+
> - **I want to contribute**: Contributing → Contact
|
|
137
|
+
|
|
138
|
+
- [News](#-news)
|
|
139
|
+
- [Key Features](#-key-features)
|
|
140
|
+
- [Quick Start](#-quick-start): From installation to running a minimal Agent API service. Learn the three-stage `AgentApp` development pattern: `init` / `query` / `shutdown`.
|
|
141
|
+
- [Prerequisites](#prerequisites): Required runtime environment and dependencies
|
|
142
|
+
- [Installation](#installation): Install from PyPI or from source
|
|
143
|
+
- [Agent App Example](#agent-app-example): How to build a streaming (SSE) Agent-as-a-Service API
|
|
144
|
+
- [Sandbox Example](#sandbox-example): How to safely execute Python/Shell/GUI/Browser/Filesystem/Mobile tools in an isolated sandbox
|
|
145
|
+
- [Deployment Example](#deployment-example): Learn to deploy with `DeployManager` locally or in a serverless environment, and access the service via A2A, Response API, or the OpenAI SDK in compatible mode
|
|
146
|
+
- [Guides](#-guides): A tutorial site covering AgentScope Runtime concepts, architecture, APIs, and sample projects—helping you move from “it runs” to “scalable and maintainable”.
|
|
147
|
+
- [Contact](#-contact)
|
|
148
|
+
- [Contributing](#-contributing)
|
|
149
|
+
- [License](#-license)
|
|
150
|
+
- [Contributors](#-contributors)
|
|
107
151
|
|
|
108
152
|
---
|
|
109
153
|
|
|
@@ -116,12 +160,12 @@ Dynamic: license-file
|
|
|
116
160
|
|
|
117
161
|
## ✨ Key Features
|
|
118
162
|
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
163
|
+
- **Deployment Infrastructure**: Built-in services for agent state management, conversation history, long-term memory, and sandbox lifecycle control
|
|
164
|
+
- **Framework-Agnostic**: Not tied to any specific agent framework; seamlessly integrates with popular open-source and custom implementations
|
|
165
|
+
- **Developer-Friendly**: Offers `AgentApp` for easy deployment with powerful customization options
|
|
166
|
+
- **Observability**: Comprehensive tracking and monitoring of runtime operations
|
|
167
|
+
- **Sandboxed Tool Execution**: Isolated sandbox ensures safe tool execution without affecting the system
|
|
168
|
+
- **Out-of-the-Box Tools & One-Click Adaptation**: Rich set of ready-to-use tools, with adapters enabling quick integration into different frameworks
|
|
125
169
|
|
|
126
170
|
> [!NOTE]
|
|
127
171
|
>
|
|
@@ -137,26 +181,6 @@ Dynamic: license-file
|
|
|
137
181
|
|
|
138
182
|
---
|
|
139
183
|
|
|
140
|
-
## 💬 Contact
|
|
141
|
-
|
|
142
|
-
Welcome to join our community on
|
|
143
|
-
|
|
144
|
-
| [Discord](https://discord.gg/eYMpfnkG8h) | DingTalk |
|
|
145
|
-
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|
|
146
|
-
| <img src="https://gw.alicdn.com/imgextra/i1/O1CN01hhD1mu1Dd3BWVUvxN_!!6000000000238-2-tps-400-400.png" width="100" height="100"> | <img src="https://img.alicdn.com/imgextra/i4/O1CN014mhqFq1ZlgNuYjxrz_!!6000000003235-2-tps-400-400.png" width="100" height="100"> |
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## 📋 Table of Contents
|
|
151
|
-
|
|
152
|
-
- [🚀 Quick Start](#-quick-start)
|
|
153
|
-
- [📚 Cookbook](#-cookbook)
|
|
154
|
-
- [🏗️ Deployment](#️-deployment)
|
|
155
|
-
- [🤝 Contributing](#-contributing)
|
|
156
|
-
- [📄 License](#-license)
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
184
|
## 🚀 Quick Start
|
|
161
185
|
|
|
162
186
|
### Prerequisites
|
|
@@ -333,9 +357,9 @@ These examples demonstrate how to create sandboxed environments and execute tool
|
|
|
333
357
|
|
|
334
358
|
> [!NOTE]
|
|
335
359
|
>
|
|
336
|
-
> If you want to run the sandbox locally, the current version
|
|
360
|
+
> If you want to run the sandbox locally, the current version supports **Docker (optionally with gVisor)** or **[BoxLite](https://github.com/boxlite-ai/boxlite)** as the backend, and you can switch the backend by setting the environment variable `CONTAINER_DEPLOYMENT` (supported values include `docker` / `gvisor` / `boxlite` etc.; default: `docker`).
|
|
337
361
|
>
|
|
338
|
-
>
|
|
362
|
+
> For large-scale remote/production deployments, we recommend using **Kubernetes (K8s)**, **Function Compute (FC)**, or [**Alibaba Cloud Container Service for Kubernetes (ACK)**](https://computenest.console.aliyun.com/service/instance/create/default?ServiceName=AgentScope%20Runtime%20%E6%B2%99%E7%AE%B1%E7%8E%AF%E5%A2%83) as the backend. Please refer to [this tutorial](https://runtime.agentscope.io/en/sandbox/advanced.html) for more details.
|
|
339
363
|
|
|
340
364
|
> [!TIP]
|
|
341
365
|
> AgentScope Runtime provides **both synchronous** and **asynchronous** versions for each sandbox type
|
|
@@ -373,6 +397,7 @@ async with BaseSandboxAsync() as box:
|
|
|
373
397
|
print(await box.list_tools()) # List all available tools
|
|
374
398
|
print(await box.run_ipython_cell(code="print('hi')")) # Run Python code
|
|
375
399
|
print(await box.run_shell_command(command="echo hello")) # Run shell command
|
|
400
|
+
input("Press Enter to continue...")
|
|
376
401
|
```
|
|
377
402
|
|
|
378
403
|
#### GUI Sandbox
|
|
@@ -441,23 +466,23 @@ A GUI-based sandbox with **file system operations** such as creating, reading, a
|
|
|
441
466
|
|
|
442
467
|
```python
|
|
443
468
|
# --- Synchronous version ---
|
|
444
|
-
from agentscope_runtime.sandbox import
|
|
469
|
+
from agentscope_runtime.sandbox import FilesystemSandbox
|
|
445
470
|
|
|
446
|
-
with
|
|
447
|
-
# By default, pulls `agentscope/runtime-sandbox-
|
|
471
|
+
with FilesystemSandbox() as box:
|
|
472
|
+
# By default, pulls `agentscope/runtime-sandbox-filesystem:latest` from DockerHub
|
|
448
473
|
print(box.list_tools()) # List all available tools
|
|
449
474
|
print(box.desktop_url) # Web desktop access URL
|
|
450
|
-
box.
|
|
475
|
+
box.create_directory("test") # Create a directory
|
|
451
476
|
input("Press Enter to continue...")
|
|
452
477
|
|
|
453
478
|
# --- Asynchronous version ---
|
|
454
|
-
from agentscope_runtime.sandbox import
|
|
479
|
+
from agentscope_runtime.sandbox import FilesystemSandboxAsync
|
|
455
480
|
|
|
456
|
-
async with
|
|
457
|
-
# Default image is `agentscope/runtime-sandbox-
|
|
481
|
+
async with FilesystemSandboxAsync() as box:
|
|
482
|
+
# Default image is `agentscope/runtime-sandbox-filesystem:latest`
|
|
458
483
|
print(await box.list_tools()) # List all available tools
|
|
459
484
|
print(box.desktop_url) # Web desktop access URL
|
|
460
|
-
await box.
|
|
485
|
+
await box.create_directory("test") # Create a directory
|
|
461
486
|
input("Press Enter to continue...")
|
|
462
487
|
```
|
|
463
488
|
|
|
@@ -592,17 +617,7 @@ runtime-sandbox-server --config fc.env
|
|
|
592
617
|
```
|
|
593
618
|
After the server starts, you can access the sandbox server at baseurl `http://localhost:8000` and invoke sandbox tools described above.
|
|
594
619
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
- **[📖 Cookbook](https://runtime.agentscope.io/en/intro.html)**: Comprehensive tutorials
|
|
598
|
-
- **[💡 Concept](https://runtime.agentscope.io/en/concept.html)**: Core concepts and architecture overview
|
|
599
|
-
- **[🚀 Quick Start](https://runtime.agentscope.io/en/quickstart.html)**: Quick start tutorial
|
|
600
|
-
- **[🏠 Demo House](https://runtime.agentscope.io/en/demohouse.html)**: Rich example projects
|
|
601
|
-
- **[📋 API Reference](https://runtime.agentscope.io/en/api/index.html)**: Complete API documentation
|
|
602
|
-
|
|
603
|
-
---
|
|
604
|
-
|
|
605
|
-
## 🏗️ Deployment
|
|
620
|
+
### Deployment Example
|
|
606
621
|
|
|
607
622
|
The `AgentApp` exposes a `deploy` method that takes a `DeployManager` instance and deploys the agent.
|
|
608
623
|
|
|
@@ -611,7 +626,7 @@ The `AgentApp` exposes a `deploy` method that takes a `DeployManager` instance a
|
|
|
611
626
|
|
|
612
627
|
* The deployer will automatically add common agent protocols, such as **A2A**, **Response API**.
|
|
613
628
|
|
|
614
|
-
After deployment, users can access the service at
|
|
629
|
+
After deployment, users can access the service at http://localhost:8090/process:
|
|
615
630
|
|
|
616
631
|
```python
|
|
617
632
|
from agentscope_runtime.engine.deployers import LocalDeployManager
|
|
@@ -623,8 +638,10 @@ deployer = LocalDeployManager(
|
|
|
623
638
|
)
|
|
624
639
|
|
|
625
640
|
# Deploy the app as a streaming service
|
|
626
|
-
deploy_result = await app.deploy(
|
|
627
|
-
|
|
641
|
+
deploy_result = await app.deploy(
|
|
642
|
+
deployer=deployer,
|
|
643
|
+
endpoint_path="/process"
|
|
644
|
+
)
|
|
628
645
|
```
|
|
629
646
|
|
|
630
647
|
After deployment, users can also access this service using the Response API of the OpenAI SDK:
|
|
@@ -642,11 +659,16 @@ response = client.responses.create(
|
|
|
642
659
|
print(response)
|
|
643
660
|
```
|
|
644
661
|
|
|
645
|
-
Besides, `DeployManager` also supports serverless deployments, such as deploying your agent app
|
|
646
|
-
to [ModelStudio](https://bailian.console.aliyun.com/?admin=1&tab=doc#/doc/?type=app&url=2983030).
|
|
662
|
+
Besides, `DeployManager` also supports serverless deployments, such as deploying your agent app to [ModelStudio](https://bailian.console.aliyun.com/?admin=1&tab=doc#/doc/?type=app&url=2983030).
|
|
647
663
|
|
|
648
664
|
```python
|
|
649
|
-
|
|
665
|
+
import os
|
|
666
|
+
from agentscope_runtime.engine.deployers.modelstudio_deployer import (
|
|
667
|
+
ModelstudioDeployManager,
|
|
668
|
+
OSSConfig,
|
|
669
|
+
ModelstudioConfig,
|
|
670
|
+
)
|
|
671
|
+
|
|
650
672
|
# Create deployment manager
|
|
651
673
|
deployer = ModelstudioDeployManager(
|
|
652
674
|
oss_config=OSSConfig(
|
|
@@ -678,6 +700,22 @@ For more advanced serverless deployment guides, please refer to the [documentati
|
|
|
678
700
|
|
|
679
701
|
---
|
|
680
702
|
|
|
703
|
+
## 📚 Guides
|
|
704
|
+
|
|
705
|
+
For a more detailed tutorial, please refer to: [](https://runtime.agentscope.io)
|
|
706
|
+
|
|
707
|
+
---
|
|
708
|
+
|
|
709
|
+
## 💬 Contact
|
|
710
|
+
|
|
711
|
+
Welcome to join our community on
|
|
712
|
+
|
|
713
|
+
| [Discord](https://discord.gg/eYMpfnkG8h) | DingTalk |
|
|
714
|
+
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|
|
715
|
+
| <img src="https://gw.alicdn.com/imgextra/i1/O1CN01hhD1mu1Dd3BWVUvxN_!!6000000000238-2-tps-400-400.png" width="100" height="100"> | <img src="https://img.alicdn.com/imgextra/i4/O1CN014mhqFq1ZlgNuYjxrz_!!6000000003235-2-tps-400-400.png" width="100" height="100"> |
|
|
716
|
+
|
|
717
|
+
---
|
|
718
|
+
|
|
681
719
|
## 🤝 Contributing
|
|
682
720
|
|
|
683
721
|
We welcome contributions from the community! Here's how you can help:
|
|
@@ -723,9 +761,9 @@ See the License for the specific language governing permissions and
|
|
|
723
761
|
limitations under the License.
|
|
724
762
|
```
|
|
725
763
|
|
|
726
|
-
## Contributors
|
|
764
|
+
## ✨ Contributors
|
|
727
765
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
728
|
-
[](#contributors-)
|
|
729
767
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
730
768
|
|
|
731
769
|
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/emoji-key/)):
|
|
@@ -775,6 +813,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/e
|
|
|
775
813
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/RTsama"><img src="https://avatars.githubusercontent.com/u/100779257?v=4?s=100" width="100px;" alt="RTsama"/><br /><sub><b>RTsama</b></sub></a><br /><a href="https://github.com/agentscope-ai/agentscope-runtime/issues?q=author%3ARTsama" title="Bug reports">🐛</a> <a href="https://github.com/agentscope-ai/agentscope-runtime/commits?author=RTsama" title="Code">💻</a></td>
|
|
776
814
|
<td align="center" valign="top" width="14.28%"><a href="https://allenli178.top"><img src="https://avatars.githubusercontent.com/u/53218750?v=4?s=100" width="100px;" alt="YuYan"/><br /><sub><b>YuYan</b></sub></a><br /><a href="https://github.com/agentscope-ai/agentscope-runtime/commits?author=allenli178" title="Documentation">📖</a></td>
|
|
777
815
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rlp2006"><img src="https://avatars.githubusercontent.com/u/212365247?v=4?s=100" width="100px;" alt="Li Peng (Yuan Yi)"/><br /><sub><b>Li Peng (Yuan Yi)</b></sub></a><br /><a href="https://github.com/agentscope-ai/agentscope-runtime/commits?author=rlp2006" title="Code">💻</a> <a href="https://github.com/agentscope-ai/agentscope-runtime/commits?author=rlp2006" title="Documentation">📖</a> <a href="#example-rlp2006" title="Examples">💡</a></td>
|
|
816
|
+
<td align="center" valign="top" width="14.28%"><a href="http://dorianzheng.github.io"><img src="https://avatars.githubusercontent.com/u/8065637?v=4?s=100" width="100px;" alt="dorianzheng"/><br /><sub><b>dorianzheng</b></sub></a><br /><a href="https://github.com/agentscope-ai/agentscope-runtime/pulls?q=is%3Apr+reviewed-by%3ADorianZheng" title="Reviewed Pull Requests">👀</a> <a href="#platform-DorianZheng" title="Packaging/porting to new platform">📦</a></td>
|
|
778
817
|
</tr>
|
|
779
818
|
</tbody>
|
|
780
819
|
<tfoot>
|