agentscope-runtime 0.1.5b2__py3-none-any.whl → 0.1.6__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.
Files changed (90) hide show
  1. agentscope_runtime/engine/agents/agentscope_agent.py +447 -0
  2. agentscope_runtime/engine/agents/agno_agent.py +19 -18
  3. agentscope_runtime/engine/agents/autogen_agent.py +13 -8
  4. agentscope_runtime/engine/agents/utils.py +53 -0
  5. agentscope_runtime/engine/deployers/__init__.py +0 -13
  6. agentscope_runtime/engine/deployers/local_deployer.py +501 -356
  7. agentscope_runtime/engine/helpers/helper.py +60 -41
  8. agentscope_runtime/engine/runner.py +11 -36
  9. agentscope_runtime/engine/schemas/agent_schemas.py +2 -70
  10. agentscope_runtime/engine/services/sandbox_service.py +62 -70
  11. agentscope_runtime/engine/services/tablestore_memory_service.py +304 -0
  12. agentscope_runtime/engine/services/tablestore_rag_service.py +143 -0
  13. agentscope_runtime/engine/services/tablestore_session_history_service.py +293 -0
  14. agentscope_runtime/engine/services/utils/tablestore_service_utils.py +352 -0
  15. agentscope_runtime/sandbox/__init__.py +2 -0
  16. agentscope_runtime/sandbox/box/base/__init__.py +4 -0
  17. agentscope_runtime/sandbox/box/base/base_sandbox.py +4 -3
  18. agentscope_runtime/sandbox/box/browser/__init__.py +4 -0
  19. agentscope_runtime/sandbox/box/browser/browser_sandbox.py +8 -13
  20. agentscope_runtime/sandbox/box/dummy/__init__.py +4 -0
  21. agentscope_runtime/sandbox/box/filesystem/__init__.py +4 -0
  22. agentscope_runtime/sandbox/box/filesystem/filesystem_sandbox.py +8 -6
  23. agentscope_runtime/sandbox/box/gui/__init__.py +4 -0
  24. agentscope_runtime/sandbox/box/gui/gui_sandbox.py +80 -0
  25. agentscope_runtime/sandbox/box/sandbox.py +5 -2
  26. agentscope_runtime/sandbox/box/shared/routers/generic.py +20 -1
  27. agentscope_runtime/sandbox/box/training_box/__init__.py +4 -0
  28. agentscope_runtime/sandbox/box/training_box/training_box.py +10 -15
  29. agentscope_runtime/sandbox/build.py +143 -58
  30. agentscope_runtime/sandbox/client/http_client.py +43 -49
  31. agentscope_runtime/sandbox/client/training_client.py +0 -1
  32. agentscope_runtime/sandbox/constant.py +24 -1
  33. agentscope_runtime/sandbox/custom/custom_sandbox.py +5 -5
  34. agentscope_runtime/sandbox/custom/example.py +2 -2
  35. agentscope_runtime/sandbox/enums.py +1 -0
  36. agentscope_runtime/sandbox/manager/collections/in_memory_mapping.py +11 -6
  37. agentscope_runtime/sandbox/manager/collections/redis_mapping.py +25 -9
  38. agentscope_runtime/sandbox/manager/container_clients/__init__.py +0 -10
  39. agentscope_runtime/sandbox/manager/container_clients/agentrun_client.py +1098 -0
  40. agentscope_runtime/sandbox/manager/container_clients/docker_client.py +33 -205
  41. agentscope_runtime/sandbox/manager/container_clients/kubernetes_client.py +8 -555
  42. agentscope_runtime/sandbox/manager/sandbox_manager.py +187 -88
  43. agentscope_runtime/sandbox/manager/server/app.py +82 -14
  44. agentscope_runtime/sandbox/manager/server/config.py +50 -3
  45. agentscope_runtime/sandbox/model/container.py +6 -23
  46. agentscope_runtime/sandbox/model/manager_config.py +93 -5
  47. agentscope_runtime/sandbox/tools/gui/__init__.py +7 -0
  48. agentscope_runtime/sandbox/tools/gui/tool.py +77 -0
  49. agentscope_runtime/sandbox/tools/mcp_tool.py +6 -2
  50. agentscope_runtime/sandbox/utils.py +124 -0
  51. agentscope_runtime/version.py +1 -1
  52. {agentscope_runtime-0.1.5b2.dist-info → agentscope_runtime-0.1.6.dist-info}/METADATA +168 -77
  53. {agentscope_runtime-0.1.5b2.dist-info → agentscope_runtime-0.1.6.dist-info}/RECORD +59 -78
  54. {agentscope_runtime-0.1.5b2.dist-info → agentscope_runtime-0.1.6.dist-info}/entry_points.txt +0 -1
  55. agentscope_runtime/engine/agents/agentscope_agent/__init__.py +0 -6
  56. agentscope_runtime/engine/agents/agentscope_agent/agent.py +0 -401
  57. agentscope_runtime/engine/agents/agentscope_agent/hooks.py +0 -169
  58. agentscope_runtime/engine/agents/llm_agent.py +0 -51
  59. agentscope_runtime/engine/deployers/adapter/responses/response_api_adapter_utils.py +0 -2886
  60. agentscope_runtime/engine/deployers/adapter/responses/response_api_agent_adapter.py +0 -51
  61. agentscope_runtime/engine/deployers/adapter/responses/response_api_protocol_adapter.py +0 -314
  62. agentscope_runtime/engine/deployers/cli_fc_deploy.py +0 -184
  63. agentscope_runtime/engine/deployers/kubernetes_deployer.py +0 -265
  64. agentscope_runtime/engine/deployers/modelstudio_deployer.py +0 -677
  65. agentscope_runtime/engine/deployers/utils/deployment_modes.py +0 -14
  66. agentscope_runtime/engine/deployers/utils/docker_image_utils/__init__.py +0 -8
  67. agentscope_runtime/engine/deployers/utils/docker_image_utils/docker_image_builder.py +0 -429
  68. agentscope_runtime/engine/deployers/utils/docker_image_utils/dockerfile_generator.py +0 -240
  69. agentscope_runtime/engine/deployers/utils/docker_image_utils/runner_image_factory.py +0 -297
  70. agentscope_runtime/engine/deployers/utils/package_project_utils.py +0 -932
  71. agentscope_runtime/engine/deployers/utils/service_utils/__init__.py +0 -9
  72. agentscope_runtime/engine/deployers/utils/service_utils/fastapi_factory.py +0 -504
  73. agentscope_runtime/engine/deployers/utils/service_utils/fastapi_templates.py +0 -157
  74. agentscope_runtime/engine/deployers/utils/service_utils/process_manager.py +0 -268
  75. agentscope_runtime/engine/deployers/utils/service_utils/service_config.py +0 -75
  76. agentscope_runtime/engine/deployers/utils/service_utils/service_factory.py +0 -220
  77. agentscope_runtime/engine/deployers/utils/wheel_packager.py +0 -389
  78. agentscope_runtime/engine/helpers/agent_api_builder.py +0 -651
  79. agentscope_runtime/engine/llms/__init__.py +0 -3
  80. agentscope_runtime/engine/llms/base_llm.py +0 -60
  81. agentscope_runtime/engine/llms/qwen_llm.py +0 -47
  82. agentscope_runtime/engine/schemas/embedding.py +0 -37
  83. agentscope_runtime/engine/schemas/modelstudio_llm.py +0 -310
  84. agentscope_runtime/engine/schemas/oai_llm.py +0 -538
  85. agentscope_runtime/engine/schemas/realtime.py +0 -254
  86. /agentscope_runtime/engine/{deployers/adapter/responses → services/utils}/__init__.py +0 -0
  87. /agentscope_runtime/{engine/deployers/utils → sandbox/box/gui/box}/__init__.py +0 -0
  88. {agentscope_runtime-0.1.5b2.dist-info → agentscope_runtime-0.1.6.dist-info}/WHEEL +0 -0
  89. {agentscope_runtime-0.1.5b2.dist-info → agentscope_runtime-0.1.6.dist-info}/licenses/LICENSE +0 -0
  90. {agentscope_runtime-0.1.5b2.dist-info → agentscope_runtime-0.1.6.dist-info}/top_level.txt +0 -0
@@ -1,254 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- import os
3
- import uuid
4
- from enum import Enum
5
- from typing import Optional, List, Union, Any
6
-
7
- from openai.types.chat.chat_completion_chunk import ChoiceDeltaToolCall
8
- from pydantic import BaseModel, model_validator, Field
9
-
10
-
11
- class AsrVendor(str, Enum):
12
- MODELSTUDIO = "modelstudio"
13
- AZURE = "azure"
14
-
15
-
16
- class TtsVendor(str, Enum):
17
- MODELSTUDIO = "modelstudio"
18
- AZURE = "azure"
19
-
20
-
21
- class ModelstudioConnection(BaseModel):
22
- base_url: Optional[str] = None
23
- api_key: Optional[str] = None
24
- workspace_id: Optional[str] = None
25
- user_agent: Optional[str] = None
26
- data_inspection: Optional[str] = None
27
-
28
-
29
- class TtsConfig(BaseModel):
30
- model: Optional[str] = None
31
- voice: Optional[str] = None
32
- sample_rate: Optional[int] = None
33
- format: Optional[str] = None
34
- bits_per_sample: Optional[int] = None
35
- nb_channels: Optional[int] = None
36
- chat_id: Optional[str] = None
37
-
38
-
39
- class ModelstudioTtsConfig(TtsConfig, ModelstudioConnection):
40
- model: str = "cosyvoice-v2"
41
- voice: str = os.getenv("TTS_VOICE", "longcheng_v2")
42
- sample_rate: int = 16000
43
- format: Optional[str] = "pcm"
44
-
45
-
46
- class AsrConfig(BaseModel):
47
- model: Optional[str] = None
48
- language: Optional[str] = None
49
- sample_rate: Optional[int] = None
50
- format: Optional[str] = None
51
- bits_per_sample: Optional[int] = None
52
- nb_channels: Optional[int] = None
53
- initial_silence_timeout: Optional[int] = None
54
- max_end_silence: Optional[int] = None
55
- fast_vad_min_duration: Optional[int] = None
56
- fast_vad_max_duration: Optional[int] = None
57
-
58
-
59
- class ModelstudioAsrConfig(AsrConfig, ModelstudioConnection):
60
- model: Optional[str] = "gummy-realtime-v1"
61
- sample_rate: Optional[int] = 16000
62
- format: Optional[str] = "pcm"
63
- max_end_silence: Optional[int] = 700
64
- fast_vad_min_duration: Optional[int] = 200
65
- fast_vad_max_duration: Optional[int] = 1100
66
-
67
-
68
- class ModelstudioKnowledgeBaseConfig(BaseModel):
69
- index_ids: List[str]
70
- workspace_id: str
71
- api_key: str
72
-
73
-
74
- class ModelstudioVoiceChatUpstream(BaseModel):
75
- dialog_mode: Optional[str] = "duplex"
76
- enable_server_vad: Optional[bool] = True
77
- modalities: Optional[List[str]] = Field(default_factory=lambda: ["audio"])
78
- asr_vendor: Optional[AsrVendor] = AsrVendor(
79
- os.getenv("ASR_VENDOR", AsrVendor.MODELSTUDIO.value),
80
- )
81
- asr_options: Optional[AsrConfig] = AsrConfig()
82
-
83
-
84
- class ModelstudioVoiceChatDownstream(BaseModel):
85
- modalities: Optional[List[str]] = Field(
86
- default_factory=lambda: ["audio", "text"],
87
- )
88
- tts_vendor: Optional[TtsVendor] = TtsVendor(
89
- os.getenv("TTS_VENDOR", TtsVendor.MODELSTUDIO.value),
90
- )
91
- tts_options: Optional[TtsConfig] = TtsConfig()
92
-
93
-
94
- class ModelstudioVoiceChatParameters(BaseModel):
95
- modelstudio_kb: Optional[ModelstudioKnowledgeBaseConfig] = None
96
- enable_tool_call: Optional[bool] = False
97
-
98
-
99
- class ModelstudioVoiceChatInput(BaseModel):
100
- dialog_id: Optional[str] = None
101
- app_id: Optional[str] = None
102
- text: Optional[str] = None
103
-
104
-
105
- class ModelstudioVoiceChatDirective(str, Enum):
106
- SESSION_START = "SessionStart"
107
- SESSION_STOP = "SessionStop"
108
-
109
-
110
- class ModelstudioVoiceChatEvent(str, Enum):
111
- SESSION_STARTED = "SessionStarted"
112
- SESSION_STOPPED = "SessionStopped"
113
- AUDIO_TRANSCRIPT = "AudioTranscript"
114
- RESPONSE_TEXT = "ResponseText"
115
- RESPONSE_AUDIO_STARTED = "ResponseAudioStarted"
116
- RESPONSE_AUDIO_ENDED = "ResponseAudioEnded"
117
-
118
-
119
- class ModelstudioVoiceChatInPayload(BaseModel):
120
- pass
121
-
122
-
123
- class ModelstudioVoiceChatSessionStartPayload(ModelstudioVoiceChatInPayload):
124
- session_id: Optional[str] = Field(
125
- default_factory=lambda: str(uuid.uuid4()),
126
- )
127
- upstream: Optional[
128
- ModelstudioVoiceChatUpstream
129
- ] = ModelstudioVoiceChatUpstream()
130
- downstream: Optional[
131
- ModelstudioVoiceChatDownstream
132
- ] = ModelstudioVoiceChatDownstream()
133
- parameters: Optional[
134
- ModelstudioVoiceChatParameters
135
- ] = ModelstudioVoiceChatParameters()
136
-
137
-
138
- class ModelstudioVoiceChatSessionStopPayload(ModelstudioVoiceChatInPayload):
139
- pass
140
-
141
-
142
- class ModelstudioVoiceChatRequest(BaseModel):
143
- directive: ModelstudioVoiceChatDirective
144
- payload: Union[
145
- ModelstudioVoiceChatSessionStartPayload,
146
- ModelstudioVoiceChatSessionStopPayload,
147
- ]
148
-
149
- @model_validator(mode="wrap")
150
- def parse_payload_based_on_directive(
151
- self,
152
- values: Any,
153
- handler: Any,
154
- ) -> None:
155
- data = values if isinstance(values, dict) else values.model_dump()
156
-
157
- directive = data.get("directive")
158
- payload_data = data.get("payload", {})
159
-
160
- if directive == ModelstudioVoiceChatDirective.SESSION_START:
161
- data["payload"] = ModelstudioVoiceChatSessionStartPayload(
162
- **payload_data,
163
- )
164
- elif directive == ModelstudioVoiceChatDirective.SESSION_STOP:
165
- data["payload"] = ModelstudioVoiceChatSessionStopPayload(
166
- **payload_data,
167
- )
168
- else:
169
- raise ValueError(f"Unsupported directive: {directive}")
170
-
171
- return handler(data)
172
-
173
-
174
- class ModelstudioVoiceChatOutPayload(BaseModel):
175
- session_id: Optional[str] = None
176
-
177
-
178
- class ModelstudioVoiceChatSessionStartedPayload(
179
- ModelstudioVoiceChatOutPayload,
180
- ):
181
- pass
182
-
183
-
184
- class ModelstudioVoiceChatSessionStoppedPayload(
185
- ModelstudioVoiceChatOutPayload,
186
- ):
187
- pass
188
-
189
-
190
- class ModelstudioVoiceChatAudioTranscriptPayload(
191
- ModelstudioVoiceChatOutPayload,
192
- ):
193
- text: Optional[str] = ""
194
- finished: bool
195
-
196
-
197
- class ModelstudioVoiceChatResponseTextPayload(
198
- ModelstudioVoiceChatOutPayload,
199
- ):
200
- text: Optional[str] = ""
201
- tool_calls: Optional[List[ChoiceDeltaToolCall]] = Field(
202
- default_factory=list,
203
- )
204
- finished: bool
205
-
206
-
207
- class ModelstudioVoiceChatResponseAudioStartedPayload(
208
- ModelstudioVoiceChatOutPayload,
209
- ):
210
- pass
211
-
212
-
213
- class ModelstudioVoiceChatResponseAudioStoppedPayload(
214
- ModelstudioVoiceChatOutPayload,
215
- ):
216
- pass
217
-
218
-
219
- class ModelstudioVoiceChatResponse(BaseModel):
220
- event: Optional[ModelstudioVoiceChatEvent]
221
- payload: Union[
222
- ModelstudioVoiceChatSessionStartedPayload,
223
- ModelstudioVoiceChatSessionStoppedPayload,
224
- ModelstudioVoiceChatAudioTranscriptPayload,
225
- ModelstudioVoiceChatResponseTextPayload,
226
- ModelstudioVoiceChatResponseAudioStartedPayload,
227
- ModelstudioVoiceChatResponseAudioStoppedPayload,
228
- ]
229
-
230
-
231
- class AzureConnection(BaseModel):
232
- key: Optional[str] = None
233
- region: Optional[str] = None
234
-
235
-
236
- class AzureAsrConfig(AsrConfig, AzureConnection):
237
- sample_rate: Optional[int] = 16000
238
- format: Optional[str] = "pcm"
239
- bits_per_sample: Optional[int] = 16
240
- nb_channels: Optional[int] = 1
241
- initial_silence_timeout: Optional[int] = 5000
242
- max_end_silence: Optional[int] = 800
243
- language: Optional[str] = os.getenv("ASR_LANG", "en-US")
244
-
245
-
246
- class AzureTtsConfig(TtsConfig, AzureConnection):
247
- voice: Optional[str] = os.getenv(
248
- "TTS_VOICE",
249
- "en-US-AvaMultilingualNeural",
250
- )
251
- sample_rate: Optional[int] = 16000
252
- format: Optional[str] = "pcm"
253
- bits_per_sample: Optional[int] = 16
254
- nb_channels: Optional[int] = 1